| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
GHC.Debugger.Monad
Synopsis
- newtype Debugger a = Debugger {}
- data BreakpointInfo = BreakpointInfo {}
- data DebuggerState = DebuggerState {}
- data BreakpointStatus
- data BreakpointAction
- data RunDebuggerSettings = RunDebuggerSettings {}
- runDebugger :: LogAction IO DebuggerLog -> DebugRunner Ghc a -> RunDebuggerSettings -> Debugger a -> IO a
- type DebugSession (m :: Type -> Type) a = FilePath -> [String] -> m () -> Ghc a
- type DebugRunner (m :: Type -> Type) a = DebugSession m a -> IO a
- data ProjectDebugSpec = ProjectDebugSpec {
- rootDir :: FilePath
- componentDir :: FilePath
- libdir :: FilePath
- units :: [String]
- ghcInvocation :: [String]
- absEntryFile :: FilePath
- extraGhcArgs :: [String]
- withProjectDebugSession :: GhcMonad m => ProjectDebugSpec -> DebugRunner m a
- runDebuggerAction :: LogAction IO DebuggerLog -> FilePath -> [String] -> RunDebuggerSettings -> Ghc () -> Debugger a -> Ghc a
- preservingThreadLabel :: HasCallStack => Ghc a -> Ghc a
- loadInternal :: LogAction IO DebuggerLog -> Ways -> Ghc ()
- data FailedToLoadFFIInspectModule = FailedToLoadFFIInspectModule
- loadFFIInspect :: LogAction IO DebuggerLog -> Ways -> Ghc ()
- findOrLoadHaskellDebuggerView :: LogAction IO DebuggerLog -> Ways -> Ghc (UnitId, [ModuleName])
- cleanupInterp :: Ghc ()
- annotateDebuggerStackString :: String -> Debugger a -> Debugger a
- parseDynamicFlagsWithRootDir :: MonadIO m => FilePath -> Logger -> DynFlags -> [Located String] -> m (DynFlags, [Located String], Messages DriverMessage)
- doDownsweep :: GhcMonad m => Maybe ModuleGraph -> m ModuleGraph
- doLoad :: GhcMonad m => Maybe ModIfaceCache -> LoadHowMuch -> ModuleGraph -> m SuccessFlag
- loadInMemoryModules :: LogAction IO DebuggerLog -> UnitId -> [(ModuleName, StringBuffer)] -> Ghc [SuccessFlag]
- getHsDebuggerViewUid :: Debugger (Maybe UnitId)
- findHsDebuggerViewUnitId :: Ghc (Maybe UnitId)
- initialDebuggerState :: LogAction Debugger DebuggerLog -> Maybe UnitId -> Ghc DebuggerState
- liftGhc :: Ghc a -> Debugger a
- data DebuggerFailedToLoad = DebuggerFailedToLoad
- data UnsupportedHsDbgViewVersion = UnsupportedHsDbgViewVersion {
- supportedVersions :: [(Version, Version)]
- actualVersion :: Version
- data NonFatalException = NonFatalException {}
- expectRight :: Exception e => Either e a -> Debugger a
- getAllLoadedModules :: GhcMonad m => m [ModuleNodeInfo]
- getAllLoadedModulesWithPaths :: GhcMonad m => m [(AbsFilePath, ModuleNodeInfo)]
- defaultDepth :: Int
- seqTerm :: HscEnv -> Term -> IO Term
- deepseqTerm :: HscEnv -> Term -> IO Term
- logSDoc :: Severity -> SDoc -> Debugger ()
Documentation
A debugger action.
Constructors
| Debugger | |
Fields | |
Instances
data BreakpointInfo Source #
Constructors
| BreakpointInfo | |
Fields | |
Instances
| Eq BreakpointInfo Source # | |
Defined in GHC.Debugger.Monad Methods (==) :: BreakpointInfo -> BreakpointInfo -> Bool # (/=) :: BreakpointInfo -> BreakpointInfo -> Bool # | |
| Show BreakpointInfo Source # | |
Defined in GHC.Debugger.Monad Methods showsPrec :: Int -> BreakpointInfo -> ShowS # show :: BreakpointInfo -> String # showList :: [BreakpointInfo] -> ShowS # | |
data DebuggerState Source #
State required to run the debugger.
- Keep track of active breakpoints to easily unset them all.
Constructors
| DebuggerState | |
Fields
| |
Instances
| MonadReader DebuggerState Debugger Source # | |
Defined in GHC.Debugger.Monad Methods ask :: Debugger DebuggerState # local :: (DebuggerState -> DebuggerState) -> Debugger a -> Debugger a # reader :: (DebuggerState -> a) -> Debugger a # | |
data BreakpointStatus Source #
Enabling/Disabling a breakpoint
Constructors
| BreakpointDisabled | Breakpoint is disabled Note: this must be the first constructor s.t.
|
| BreakpointEnabled | Breakpoint is enabled |
| BreakpointAfterCount Int | Breakpoint is disabled the first N times and enabled afterwards |
| BreakpointWhenCond String | Breakpoint is enabled when condition evaluates to true |
| BreakpointAfterCountCond Int String | Breakpoint is disabled the first N times the condition evaluates to true and enabled in the next time it is true |
Instances
| Outputable BreakpointStatus Source # | |
Defined in GHC.Debugger.Monad Methods ppr :: BreakpointStatus -> SDoc # | |
| Eq BreakpointStatus Source # | |
Defined in GHC.Debugger.Monad Methods (==) :: BreakpointStatus -> BreakpointStatus -> Bool # (/=) :: BreakpointStatus -> BreakpointStatus -> Bool # | |
| Ord BreakpointStatus Source # | |
Defined in GHC.Debugger.Monad Methods compare :: BreakpointStatus -> BreakpointStatus -> Ordering # (<) :: BreakpointStatus -> BreakpointStatus -> Bool # (<=) :: BreakpointStatus -> BreakpointStatus -> Bool # (>) :: BreakpointStatus -> BreakpointStatus -> Bool # (>=) :: BreakpointStatus -> BreakpointStatus -> Bool # max :: BreakpointStatus -> BreakpointStatus -> BreakpointStatus # min :: BreakpointStatus -> BreakpointStatus -> BreakpointStatus # | |
| Show BreakpointStatus Source # | |
Defined in GHC.Debugger.Monad Methods showsPrec :: Int -> BreakpointStatus -> ShowS # show :: BreakpointStatus -> String # showList :: [BreakpointStatus] -> ShowS # | |
data BreakpointAction Source #
What to do when a breakpoint is enabled
Constructors
| BreakpointStop | Evaluation is stopped, typical behaviour |
| BreakpointLogAndResume String | A log message is printed and then evaluation resumes.
The |
Instances
| Outputable BreakpointAction Source # | |
Defined in GHC.Debugger.Monad Methods ppr :: BreakpointAction -> SDoc # | |
| Eq BreakpointAction Source # | |
Defined in GHC.Debugger.Monad Methods (==) :: BreakpointAction -> BreakpointAction -> Bool # (/=) :: BreakpointAction -> BreakpointAction -> Bool # | |
| Ord BreakpointAction Source # | |
Defined in GHC.Debugger.Monad Methods compare :: BreakpointAction -> BreakpointAction -> Ordering # (<) :: BreakpointAction -> BreakpointAction -> Bool # (<=) :: BreakpointAction -> BreakpointAction -> Bool # (>) :: BreakpointAction -> BreakpointAction -> Bool # (>=) :: BreakpointAction -> BreakpointAction -> Bool # max :: BreakpointAction -> BreakpointAction -> BreakpointAction # min :: BreakpointAction -> BreakpointAction -> BreakpointAction # | |
| Show BreakpointAction Source # | |
Defined in GHC.Debugger.Monad Methods showsPrec :: Int -> BreakpointAction -> ShowS # show :: BreakpointAction -> String # showList :: [BreakpointAction] -> ShowS # | |
data RunDebuggerSettings Source #
Additional settings configuring the debugger
Constructors
| RunDebuggerSettings | |
runDebugger :: LogAction IO DebuggerLog -> DebugRunner Ghc a -> RunDebuggerSettings -> Debugger a -> IO a Source #
Run a Debugger action on a session constructed by a DebugRunner
INVARIANT: The initUniqSupply has already been initialized.
Users of hdb-as-a-library will have to call initUniqSupply at their leisure,
special care needed if they supply any loaded units/modules to us via the DebugRunner,
as those will contain Uniques.
See Note [UniqueSupply is process global].
type DebugSession (m :: Type -> Type) a Source #
type DebugRunner (m :: Type -> Type) a = DebugSession m a -> IO a Source #
data ProjectDebugSpec Source #
Constructors
| ProjectDebugSpec | |
Fields
| |
withProjectDebugSession :: GhcMonad m => ProjectDebugSpec -> DebugRunner m a Source #
Construct a session from paths and flags inferred from the debugee's project.
Arguments
| :: LogAction IO DebuggerLog | |
| -> FilePath | rootDir |
| -> [String] | extraGhcArgs |
| -> RunDebuggerSettings | |
| -> Ghc () | load home units action |
| -> Debugger a | |
| -> Ghc a |
preservingThreadLabel :: HasCallStack => Ghc a -> Ghc a Source #
loadInternal :: LogAction IO DebuggerLog -> Ways -> Ghc () Source #
Throws exception when module fails to load.
data FailedToLoadFFIInspectModule Source #
Constructors
| FailedToLoadFFIInspectModule |
Instances
| Exception FailedToLoadFFIInspectModule Source # | |
| Show FailedToLoadFFIInspectModule Source # | |
Defined in GHC.Debugger.Monad Methods showsPrec :: Int -> FailedToLoadFFIInspectModule -> ShowS # show :: FailedToLoadFFIInspectModule -> String # showList :: [FailedToLoadFFIInspectModule] -> ShowS # | |
loadFFIInspect :: LogAction IO DebuggerLog -> Ways -> Ghc () Source #
Throws exception when module fails to load. Needed for GHC.Debugger.Runtime.Interpreter.Legacy
findOrLoadHaskellDebuggerView :: LogAction IO DebuggerLog -> Ways -> Ghc (UnitId, [ModuleName]) Source #
cleanupInterp :: Ghc () Source #
See Note [Shutting down the external interpreter]
parseDynamicFlagsWithRootDir :: MonadIO m => FilePath -> Logger -> DynFlags -> [Located String] -> m (DynFlags, [Located String], Messages DriverMessage) Source #
Variant of GHC's parseDynamicFlags which interprets paths relative to first arg.
Arguments
| :: GhcMonad m | |
| => Maybe ModuleGraph | Re-use existing module graph which was already summarised |
| -> m ModuleGraph | Module graph constructed from current set targets |
Run downsweep on the currently set targets (see hsc_targets)
doLoad :: GhcMonad m => Maybe ModIfaceCache -> LoadHowMuch -> ModuleGraph -> m SuccessFlag Source #
loadInMemoryModules :: LogAction IO DebuggerLog -> UnitId -> [(ModuleName, StringBuffer)] -> Ghc [SuccessFlag] Source #
Finding Debugger View
getHsDebuggerViewUid :: Debugger (Maybe UnitId) Source #
Fetch the haskell-debugger-view unit-id from the environment.
Nothing means custom debugger views are disabled.
findHsDebuggerViewUnitId :: Ghc (Maybe UnitId) Source #
Try to find the haskell-debugger-view unit-id in the transitive closure,
or, otherwise, return the a custom unit for which we'll load the
haskell-debugger-view modules in it (essentially preparing an in-memory
version of the library to find the built-in instances in).
See also comment on the field of hsDbgViewUnitIdDebuggerState
initialDebuggerState :: LogAction Debugger DebuggerLog -> Maybe UnitId -> Ghc DebuggerState Source #
Initialize a DebuggerState
data DebuggerFailedToLoad Source #
Constructors
| DebuggerFailedToLoad |
Instances
| Exception DebuggerFailedToLoad Source # | |
Defined in GHC.Debugger.Monad | |
| Show DebuggerFailedToLoad Source # | |
Defined in GHC.Debugger.Monad Methods showsPrec :: Int -> DebuggerFailedToLoad -> ShowS # show :: DebuggerFailedToLoad -> String # showList :: [DebuggerFailedToLoad] -> ShowS # | |
data UnsupportedHsDbgViewVersion Source #
Constructors
| UnsupportedHsDbgViewVersion | |
Fields
| |
Instances
| Exception UnsupportedHsDbgViewVersion Source # | |
| Show UnsupportedHsDbgViewVersion Source # | |
Defined in GHC.Debugger.Monad Methods showsPrec :: Int -> UnsupportedHsDbgViewVersion -> ShowS # show :: UnsupportedHsDbgViewVersion -> String # showList :: [UnsupportedHsDbgViewVersion] -> ShowS # | |
data NonFatalException Source #
Constructors
| NonFatalException | |
Fields
| |
Instances
| Exception NonFatalException Source # | |
Defined in GHC.Debugger.Monad Methods toException :: NonFatalException -> SomeException # fromException :: SomeException -> Maybe NonFatalException # | |
| Show NonFatalException Source # | |
Defined in GHC.Debugger.Monad Methods showsPrec :: Int -> NonFatalException -> ShowS # show :: NonFatalException -> String # showList :: [NonFatalException] -> ShowS # | |
Modules
getAllLoadedModules :: GhcMonad m => m [ModuleNodeInfo] Source #
List all loaded modules ModSummarys
getAllLoadedModulesWithPaths :: GhcMonad m => m [(AbsFilePath, ModuleNodeInfo)] Source #
Forcing laziness
defaultDepth :: Int Source #
The depth determines how much of the runtime structure is traversed.
obtainTerm and friends handle fetching arbitrarily nested data structures
so we only depth enough to get to the next level of subterms.