summaryrefslogtreecommitdiff
path: root/ghc/GhciMonad.hs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-10-21 12:52:40 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-10-21 12:52:40 +0000
commit7068f60cc7aefef514f02d5927d5abbdcd5c94d4 (patch)
tree5d00de66c440e3f8fc68420c9858982d429f3898 /ghc/GhciMonad.hs
parente542d75c0a4b529aeafc0fc51038d670a8adc74c (diff)
downloadhaskell-7068f60cc7aefef514f02d5927d5abbdcd5c94d4.tar.gz
GhciMonad.resume should restore the program's argv and progname
I discovered that single-stepping over getArgs gave the wrong answer sometimes, because we were forgetting to set the program's argv and progname when resuming at a breakpoint. Test is ghci.debugger/scripts/getargs.script.
Diffstat (limited to 'ghc/GhciMonad.hs')
-rw-r--r--ghc/GhciMonad.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/ghc/GhciMonad.hs b/ghc/GhciMonad.hs
index 0b9239d553..94bd9c2576 100644
--- a/ghc/GhciMonad.hs
+++ b/ghc/GhciMonad.hs
@@ -258,7 +258,13 @@ runStmt expr step = do
GHC.runStmt expr step
resume :: (SrcSpan -> Bool) -> GHC.SingleStep -> GHCi GHC.RunResult
-resume canLogSpan step = GHC.resume canLogSpan step
+resume canLogSpan step = do
+ st <- getGHCiState
+ reifyGHCi $ \x ->
+ withProgName (progname st) $
+ withArgs (args st) $
+ reflectGHCi x $ do
+ GHC.resume canLogSpan step
-- --------------------------------------------------------------------------
-- timing & statistics