summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-03-19 16:35:50 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-06 04:43:21 -0400
commit94e7c563ab24fe452a16900a6777349970df1945 (patch)
treea9c6ee505079fb9929d77e09efe7d86a6cb6fff8
parentcab1871ab93feeacf2bf9a1c65b1c919ca9c5399 (diff)
downloadhaskell-94e7c563ab24fe452a16900a6777349970df1945.tar.gz
Don't use DynFlags in showLinkerState (#17957)
-rw-r--r--compiler/GHC/Runtime/Linker.hs7
-rw-r--r--ghc/GHCi/UI.hs5
2 files changed, 7 insertions, 5 deletions
diff --git a/compiler/GHC/Runtime/Linker.hs b/compiler/GHC/Runtime/Linker.hs
index 9ae8270558..b936bde303 100644
--- a/compiler/GHC/Runtime/Linker.hs
+++ b/compiler/GHC/Runtime/Linker.hs
@@ -234,11 +234,10 @@ withExtendedLinkEnv dl new_env action
-- | Display the persistent linker state.
-showLinkerState :: DynLinker -> DynFlags -> IO ()
-showLinkerState dl dflags
+showLinkerState :: DynLinker -> IO SDoc
+showLinkerState dl
= do pls <- readPLS dl
- putLogMsg dflags NoReason SevDump noSrcSpan
- $ withPprStyle defaultDumpStyle
+ return $ withPprStyle defaultDumpStyle
(vcat [text "----- Linker state -----",
text "Pkgs:" <+> ppr (pkgs_loaded pls),
text "Objs:" <+> ppr (objs_loaded pls),
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index 3a297be7b1..6e4bc40afd 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -3047,7 +3047,10 @@ showCmd str = do
, action "imports" $ showImports
, action "modules" $ showModules
, action "bindings" $ showBindings
- , action "linker" $ getDynFlags >>= liftIO . (showLinkerState (hsc_dynLinker hsc_env))
+ , action "linker" $ do
+ msg <- liftIO $ showLinkerState (hsc_dynLinker hsc_env)
+ dflags <- getDynFlags
+ liftIO $ putLogMsg dflags NoReason SevDump noSrcSpan msg
, action "breaks" $ showBkptTable
, action "context" $ showContext
, action "packages" $ showPackages