add ':show context' which lists the current stack of breakpoint contexts
authorSimon Marlow <simonmar@microsoft.com>
Wed, 18 Apr 2007 13:38:56 +0000 (13:38 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Wed, 18 Apr 2007 13:38:56 +0000 (13:38 +0000)
compiler/ghci/InteractiveUI.hs

index c83e4df..ddd6a13 100644 (file)
@@ -1200,7 +1200,8 @@ showCmd str =
        ["bindings"] -> showBindings
        ["linker"]   -> io showLinkerState
         ["breaks"] -> showBkptTable
-       _ -> throwDyn (CmdLineError "syntax:  :show [modules|bindings]")
+        ["context"] -> showContext
+       _ -> throwDyn (CmdLineError "syntax:  :show [modules|bindings|breaks]")
 
 showModules = do
   session <- getSession
@@ -1234,6 +1235,13 @@ showBkptTable = do
    activeBreaks <- getActiveBreakPoints 
    printForUser $ ppr activeBreaks 
 
+showContext :: GHCi ()
+showContext = do
+   st <- getGHCiState
+   printForUser $ vcat (map pp_resume (resume st))
+  where
+   pp_resume (span, _, _) = ptext SLIT("Stopped at") <+> ppr span
+
 -- -----------------------------------------------------------------------------
 -- Completion