GHC.Runtime.Eval.Types

ghc-9.14.0.20251028: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Runtime.Eval.Types

Synopsis

- data Resume = Resume {
  - resumeStmt :: String
  - resumeContext :: ForeignRef (ResumeContext [HValueRef])
  - resumeBindings :: ResumeBindings
  - resumeFinalIds :: [Id]
  - resumeApStack :: ForeignHValue
  - resumeBreakpointId :: Maybe InternalBreakpointId
  - resumeSpan :: SrcSpan
  - resumeDecl :: String
  - resumeCCS :: RemotePtr CostCentreStack
  - resumeHistory :: [History]
  - resumeHistoryIx :: Int
  }
- type ResumeBindings = ([TyThing], IcGlobalRdrEnv)
- data IcGlobalRdrEnv = IcGlobalRdrEnv {
  - igre_env :: !GlobalRdrEnv
  - igre_prompt_env :: !GlobalRdrEnv
  }
- data History = History {
  - historyApStack :: ForeignHValue
  - historyBreakpointId :: InternalBreakpointId
  - historyEnclosingDecls :: [String]
  }
- data ExecResult
  - = ExecComplete {
    - execResult :: Either SomeException [Name]
    - execAllocation :: Word64
    }
  - | ExecBreak {
    - breakNames :: [Name]
    - breakPointId :: Maybe InternalBreakpointId
    }
- data SingleStep
  - = RunToCompletion
  - | RunAndLogSteps
  - | SingleStep
  - | StepOut {
    - initiatedFrom :: Maybe SrcSpan
    }
  - | LocalStep {
    - breakAt :: SrcSpan
    }
  - | ModuleStep {
    - breakAt :: SrcSpan
    }
- enableGhcStepMode :: SingleStep -> EvalStep
- breakHere :: Bool -> SingleStep -> SrcSpan -> Bool
- data ExecOptions = ExecOptions {
  - execSingleStep :: SingleStep
  - execSourceFile :: String
  - execLineNumber :: Int
  - execWrap :: ForeignHValue -> EvalExpr ForeignHValue
  }

# Documentation

data Resume Source #

Constructors

Resume |
Fields resumeStmt :: String resumeContext :: ForeignRef (ResumeContext [HValueRef]) resumeBindings :: ResumeBindings resumeFinalIds :: [Id] resumeApStack :: ForeignHValue resumeBreakpointId :: Maybe InternalBreakpointId the internal breakpoint we stopped at (Nothing = exception) resumeSpan :: SrcSpan resumeDecl :: String resumeCCS :: RemotePtr CostCentreStack resumeHistory :: [History] resumeHistoryIx :: Int

type ResumeBindings = ([TyThing], IcGlobalRdrEnv) Source #

data IcGlobalRdrEnv Source #

Essentially a GlobalRdrEnv, but with additional cached values to allow efficient re-calculation when the imports change. Fields are strict to avoid space leaks (see T4029) All operations are in GHC.Runtime.Context. See Note [icReaderEnv recalculation]

Constructors

IcGlobalRdrEnv |
Fields igre_env :: !GlobalRdrEnv The final environment igre_prompt_env :: !GlobalRdrEnv Just the things defined at the prompt (excluding imports!)

data History Source #

Constructors

History |
Fields historyApStack :: ForeignHValue historyBreakpointId :: InternalBreakpointId breakpoint identifier historyEnclosingDecls :: [String] declarations enclosing the breakpoint

data ExecResult Source #

Constructors

ExecComplete | Execution is complete with either an exception or the list of user-visible names that were brought into scope.
Fields execResult :: Either SomeException [Name] execAllocation :: Word64
ExecBreak | Execution stopped at a breakpoint. Note: `ExecBreak` is only returned by `handleRunStatus` when GHCi should definitely stop at this breakpoint. GHCi is not responsible for subsequently deciding whether to really stop here. `ExecBreak` always means GHCi breaks.
Fields breakNames :: [Name] breakPointId :: Maybe InternalBreakpointId

data SingleStep Source #

What kind of stepping are we doing?

Constructors

RunToCompletion |
RunAndLogSteps | :trace [expr]
SingleStep | :step [expr]
StepOut | :stepout
Fields initiatedFrom :: Maybe SrcSpan Step-out locations are filtered to make sure we don't stop at a continuation that is within the function from which step-out was initiated. See Note [Debugger: Step-out]
LocalStep | :steplocal [expr]
Fields breakAt :: SrcSpan
ModuleStep | :stepmodule [expr]
Fields breakAt :: SrcSpan

enableGhcStepMode :: SingleStep -> EvalStep Source #

Whether this `SingleStep` mode requires instructing the interpreter to step at every breakpoint or after every return (see ``EvalStep``).

breakHere Source #

Arguments

:: Bool | Was this breakpoint explicitly active (in the `BreakArray`s)?
-> SingleStep | What kind of stepping were we doing
-> SrcSpan | The span of the breakpoint we hit
-> Bool | Should we stop here then?

Given a `SingleStep` mode, whether the breakpoint was explicitly active, and the SrcSpan of a breakpoint we hit, return `True` if we should stop at this breakpoint.

In particular, this will always be `False` for ``RunToCompletion`` and ``RunAndLogSteps``. We'd need further information e.g. about the user breakpoints to determine whether to break in those modes.

data ExecOptions Source #

Constructors

ExecOptions |
Fields execSingleStep :: SingleStep stepping mode execSourceFile :: String filename (for errors) execLineNumber :: Int line number (for errors) execWrap :: ForeignHValue -> EvalExpr ForeignHValue