Commit 7bd518dd authored by mnislaih's avatar mnislaih
Browse files

GHCi debugger: added a new flag, -fno-print-binding-contents

The contents of bindings show at breakpoints and by :show bindings
is rendered using the same printer that :print uses.
But sometimes the output it gives spans over too many lines and the
user may want to be able to disable it.
parent 40739684
...@@ -681,13 +681,18 @@ printTypeOfName session n ...@@ -681,13 +681,18 @@ printTypeOfName session n
printTypeAndContents :: Session -> [Id] -> GHCi () printTypeAndContents :: Session -> [Id] -> GHCi ()
printTypeAndContents session ids = do printTypeAndContents session ids = do
terms <- mapM (io . GHC.obtainTermB session 10 False) ids dflags <- getDynFlags
docs_terms <- mapM (io . showTerm session) terms let pefas = dopt Opt_PrintExplicitForalls dflags
dflags <- getDynFlags pcontents = dopt Opt_PrintBindContents dflags
let pefas = dopt Opt_PrintExplicitForalls dflags if pcontents
printForUser $ vcat $ zipWith (\ty cts -> ty <+> equals <+> cts) then do
(map (pprTyThing pefas . AnId) ids) let depthBound = 100
docs_terms terms <- mapM (io . GHC.obtainTermB session depthBound False) ids
docs_terms <- mapM (io . showTerm session) terms
printForUser $ vcat $ zipWith (\ty cts -> ty <+> equals <+> cts)
(map (pprTyThing pefas . AnId) ids)
docs_terms
else printForUser $ vcat $ map (pprTyThing pefas . AnId) ids
specialCommand :: String -> GHCi Bool specialCommand :: String -> GHCi Bool
......
...@@ -272,6 +272,7 @@ data DynFlag ...@@ -272,6 +272,7 @@ data DynFlag
| Opt_BreakOnException | Opt_BreakOnException
| Opt_BreakOnError | Opt_BreakOnError
| Opt_PrintEvldWithShow | Opt_PrintEvldWithShow
| Opt_PrintBindContents
| Opt_GenManifest | Opt_GenManifest
| Opt_EmbedManifest | Opt_EmbedManifest
| Opt_RunCPSZ | Opt_RunCPSZ
...@@ -536,7 +537,8 @@ defaultDynFlags = ...@@ -536,7 +537,8 @@ defaultDynFlags =
Opt_DoAsmMangling, Opt_DoAsmMangling,
Opt_GenManifest, Opt_GenManifest,
Opt_EmbedManifest Opt_EmbedManifest,
Opt_PrintBindContents
] ]
++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns] ++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns]
-- The default -O0 options -- The default -O0 options
...@@ -1210,6 +1212,7 @@ fFlags = [ ...@@ -1210,6 +1212,7 @@ fFlags = [
( "break-on-exception", Opt_BreakOnException ), ( "break-on-exception", Opt_BreakOnException ),
( "break-on-error", Opt_BreakOnError ), ( "break-on-error", Opt_BreakOnError ),
( "print-evld-with-show", Opt_PrintEvldWithShow ), ( "print-evld-with-show", Opt_PrintEvldWithShow ),
( "print-bind-contents", Opt_PrintBindContents ),
( "run-cps", Opt_RunCPSZ ), ( "run-cps", Opt_RunCPSZ ),
( "convert-to-zipper-and-back", Opt_ConvertToZipCfgAndBack), ( "convert-to-zipper-and-back", Opt_ConvertToZipCfgAndBack),
( "vectorise", Opt_Vectorise ), ( "vectorise", Opt_Vectorise ),
......
...@@ -522,6 +522,13 @@ ...@@ -522,6 +522,13 @@
<entry>dynamic</entry> <entry>dynamic</entry>
<entry><option>-fno-print-bind-result</option></entry> <entry><option>-fno-print-bind-result</option></entry>
</row> </row>
<row>
<entry><option>-fno-print-bind-contents</option></entry>
<entry><link linkend="breakpoints">Turn off printing of binding contents in GHCi</link></entry>
<entry>dynamic</entry>
<entry>-</entry>
</row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment