@@ -21,7 +21,26 @@ import Data.Maybe
2121import System.FilePath
2222import System.Directory
2323
24- import GHC
24+ import GHC qualified
25+ import GHC (
26+ ExecOptions (.. ),
27+ ExecResult (.. ),
28+ execStmt' ,
29+ ForeignHValue ,
30+ GhciLStmt ,
31+ GhcPs ,
32+ InteractiveImport (.. ),
33+ mkHsString ,
34+ ModSummary (.. ),
35+ Name ,
36+ nlHsLit ,
37+ nlList ,
38+ parseImportDecl ,
39+ SingleStep (.. ),
40+ SrcSpan (.. ),
41+ StmtLR (.. ),
42+ unLoc ,
43+ )
2544import GHC.Plugins (SourceError )
2645import GHC.Builtin.Names (gHC_INTERNAL_GHCI_HELPERS )
2746import GHC.Unit.Types
@@ -45,7 +64,7 @@ import GHC.Debugger.Interface.Messages
4564import Colog.Core as Logger
4665import qualified GHC.Debugger.Breakpoint.Map as BM
4766import GHC.Debugger.Runtime.Thread
48- import GHC.Debugger.Session (setInteractiveDebuggerDynFlags , getInteractiveDebuggerDynFlags )
67+ import GHC.Debugger.Session (setInteractiveDebuggerDynFlags , getInteractiveDebuggerDynFlags , resumeExec )
4968
5069--------------------------------------------------------------------------------
5170-- * Evaluation
@@ -126,27 +145,27 @@ debugExecution entryFile entry args = do
126145-- | Resume execution of the stopped debuggee program
127146doContinue :: Debugger EvalResult
128147doContinue = do
129- GHC. resumeExec RunToCompletion Nothing
148+ resumeExec RunToCompletion Nothing
130149 >>= handleExecResult
131150
132151-- | Resume execution but only take a single step.
133152doSingleStep :: Debugger EvalResult
134153doSingleStep = do
135- GHC. resumeExec SingleStep Nothing
154+ resumeExec SingleStep Nothing
136155 >>= handleExecResult
137156
138157doStepOut :: Debugger EvalResult
139158doStepOut = do
140159 mb_span <- getCurrentBreakSpan
141160 case mb_span of
142161 Nothing ->
143- GHC. resumeExec (GHC. StepOut Nothing ) Nothing
162+ resumeExec (GHC. StepOut Nothing ) Nothing
144163 >>= handleExecResult
145164 Just loc -> do
146165 md <- fromMaybe (error " doStepOut" ) <$> getCurrentBreakModule
147166 ticks <- fromMaybe (error " doLocalStep:getTicks" ) <$> makeModuleLineMap md
148167 let current_toplevel_decl = enclosingTickSpan ticks loc
149- GHC. resumeExec (GHC. StepOut (Just (RealSrcSpan current_toplevel_decl Strict. Nothing ))) Nothing
168+ resumeExec (GHC. StepOut (Just (RealSrcSpan current_toplevel_decl Strict. Nothing ))) Nothing
150169 >>= handleExecResult
151170
152171-- | Resume execution but stop at the next tick within the same function.
@@ -162,13 +181,13 @@ doLocalStep = do
162181 Nothing -> error " not stopped at a breakpoint?!"
163182 Just (UnhelpfulSpan _) -> do
164183 liftIO $ putStrLn " Stopped at an exception. Forcing step into..."
165- GHC. resumeExec SingleStep Nothing >>= handleExecResult
184+ resumeExec SingleStep Nothing >>= handleExecResult
166185 Just loc -> do
167186 md <- fromMaybe (error " doLocalStep" ) <$> getCurrentBreakModule
168187 -- TODO: Cache moduleLineMap?
169188 ticks <- fromMaybe (error " doLocalStep:getTicks" ) <$> makeModuleLineMap md
170189 let current_toplevel_decl = enclosingTickSpan ticks loc
171- GHC. resumeExec (LocalStep (RealSrcSpan current_toplevel_decl mempty )) Nothing >>= handleExecResult
190+ resumeExec (LocalStep (RealSrcSpan current_toplevel_decl mempty )) Nothing >>= handleExecResult
172191
173192-- | Generalized `doEval` that also handles `imports`
174193doEvalCommand :: String -> Debugger EvalResult
@@ -226,7 +245,7 @@ doEval expr = withCurrentBreakExtensions $ do
226245-- We use this in 'doEval' because we want to ignore breakpoints in expressions given at the prompt.
227246continueToCompletion :: Debugger GHC. ExecResult
228247continueToCompletion = do
229- execr <- GHC. resumeExec GHC. RunToCompletion Nothing
248+ execr <- resumeExec GHC. RunToCompletion Nothing
230249 case execr of
231250 GHC. ExecBreak {} -> continueToCompletion
232251 GHC. ExecComplete {} -> return execr
@@ -324,7 +343,7 @@ handleExecResult = \case
324343 EvalAbortedWith e -> do
325344 logSDoc Logger. Warning (evalFailedMsg e)
326345 resume
327- resume = GHC. resumeExec GHC. RunToCompletion Nothing >>= handleExecResult
346+ resume = resumeExec GHC. RunToCompletion Nothing >>= handleExecResult
328347
329348-- | Get the value and type of a given 'Name' as rendered strings in 'VarInfo'.
330349inspectName :: Name -> Debugger (Maybe VarInfo )
0 commit comments