Commit 7068f60c authored by Simon Marlow's avatar Simon Marlow

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.
parent e542d75c
......@@ -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
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment