diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2022-05-25 11:48:41 +0200 |
---|---|---|
committer | doyougnu <jeffrey.young@iohk.io> | 2022-06-13 13:42:46 -0400 |
commit | b93e3c6ee3eefce43f48c26b2e57a2f7e5bbc827 (patch) | |
tree | 74535a6215ce41996ffbedc4b3599031532861c8 /compiler | |
parent | dc1c712ed69a832dd96e9aefb516c0b178ccc40b (diff) | |
download | haskell-b93e3c6ee3eefce43f48c26b2e57a2f7e5bbc827.tar.gz |
Linker: enhance debugging message
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/StgToJS/Linker/Linker.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/StgToJS/Object.hs | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/compiler/GHC/StgToJS/Linker/Linker.hs b/compiler/GHC/StgToJS/Linker/Linker.hs index 30071d7d83..ad3fabdadc 100644 --- a/compiler/GHC/StgToJS/Linker/Linker.hs +++ b/compiler/GHC/StgToJS/Linker/Linker.hs @@ -485,7 +485,7 @@ getDeps loaded_deps base fun startlu = go' S.empty (S.fromList startlu) (S.toLis Nothing -> pprPanic "getDeps.go': object file not loaded for: " $ pprModule key Just (Deps _m _r e _b) -> let lun :: Int - lun = fromMaybe (pprPanic "exported function not found: " $ pprModule key) + lun = fromMaybe (pprPanic "exported function not found: " $ ppr f) (M.lookup f e) lu = (key, lun) in go' result (addOpen result open [lu]) fs diff --git a/compiler/GHC/StgToJS/Object.hs b/compiler/GHC/StgToJS/Object.hs index 11e62e2eb1..a7d79d6a7b 100644 --- a/compiler/GHC/StgToJS/Object.hs +++ b/compiler/GHC/StgToJS/Object.hs @@ -124,6 +124,7 @@ import GHC.Data.FastString import GHC.Data.ShortText as ST import GHC.Utils.Misc +import GHC.Utils.Outputable (ppr, Outputable, hcat, vcat, text) data Header = Header { hdrModuleName :: !BS.ByteString @@ -194,6 +195,12 @@ data ExportedFun = ExportedFun , funSymbol :: !ShortText } deriving (Eq, Ord) +instance Outputable ExportedFun where + ppr (ExportedFun m f) = vcat + [ hcat [ text "module: ", pprModule m ] + , hcat [ text "symbol: ", ppr f ] + ] + -- we need to store the size separately, since getting a HashMap's size is O(n) data SymbolTable = SymbolTable !Int !(Map ShortText Int) |