| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
GHC.Debugger.Session
Description
Initialise the GHC session for one or more home units.
This code is inspired of HLS's session initialisation. It would be great to extract common functions in the future.
Synopsis
- parseHomeUnitArguments :: GhcMonad m => FilePath -> FilePath -> [String] -> [String] -> DynFlags -> FilePath -> m (NonEmpty (DynFlags, [Target]))
- setupHomeUnitGraph :: GhcMonad m => [(DynFlags, [Target])] -> m ()
- validateUnitsWays :: NonEmpty (DynFlags, [Target]) -> IO Ways
- data TargetDetails = TargetDetails {}
- data Target
- toGhcTarget :: TargetDetails -> Target
- data CacheDirs = CacheDirs {}
- getCacheDirs :: String -> [String] -> IO CacheDirs
- interactiveGhcDebuggerUnitId :: UnitId
- getInteractiveDebuggerDynFlags :: GhcMonad m => m DynFlags
- setInteractiveDebuggerDynFlags :: GhcMonad m => DynFlags -> m ()
- setWorkingDirectory :: FilePath -> DynFlags -> DynFlags
- setCacheDirs :: CacheDirs -> DynFlags -> DynFlags
- setBytecodeBackend :: DynFlags -> DynFlags
- enableByteCodeGeneration :: DynFlags -> DynFlags
- enableExternalInterpreter :: Bool -> DynFlags -> DynFlags
- enableDynamicDebuggee :: DynFlags -> DynFlags
- setPgmI :: String -> DynFlags -> DynFlags
- addOptI :: String -> DynFlags -> DynFlags
- setDynFlagWays :: Ways -> DynFlags -> DynFlags
- makeDynFlagsAbsoluteOverall :: FilePath -> DynFlags -> DynFlags
- resumeExec :: GhcMonad m => SingleStep -> Maybe Int -> m ExecResult
- setExposedInUnit :: UnitId -> [UnitId] -> Ghc ()
- graphUnits :: ModuleGraph -> [UnitId]
Documentation
parseHomeUnitArguments Source #
Arguments
| :: GhcMonad m | |
| => FilePath | Main entry point function |
| -> FilePath | Component root. Important for multi-package cabal projects. |
| -> [String] | |
| -> [String] | |
| -> DynFlags | |
| -> FilePath | root dir, see Note [Root Directory] |
| -> m (NonEmpty (DynFlags, [Target])) |
Throws if package flags are unsatisfiable
validateUnitsWays :: NonEmpty (DynFlags, [Target]) -> IO Ways Source #
Find and return the ways in which the home units are built.
INVARIANT: All home units are built with the same Ways
data TargetDetails Source #
Constructors
| TargetDetails | |
Fields
| |
Constructors
| TargetModule ModuleName | |
| TargetFile FilePath |
toGhcTarget :: TargetDetails -> Target Source #
Turn a TargetDetails into a Target.
Constructors
| CacheDirs | |
Fields | |
Debugger's Interactive Home Unit
getInteractiveDebuggerDynFlags :: GhcMonad m => m DynFlags Source #
setInteractiveDebuggerDynFlags :: GhcMonad m => DynFlags -> m () Source #
Set the interactive DynFlags for the haskell-debugger session.
We manage a separate home unit for the interactive DynFlags.
The invariant is that DynFlags found in InteractiveContext *must* be
the same DynFlags as the ones found in interactiveGhcDebuggerUnitId in
the HomeUnitEnv
This function upholds this invariant.
Always prefer this, over setInteractiveDynFlags.
DynFlags modifications
enableByteCodeGeneration :: DynFlags -> DynFlags Source #
If the compiler supports `.gbc` files (>= 9.14.2), then persist these artefacts to disk.
enableExternalInterpreter :: Bool -> DynFlags -> DynFlags Source #
Enable the external interpreter by default unless the user sets
preferInternalInterpreter=True (with --internal-interpreter)
enableDynamicDebuggee :: DynFlags -> DynFlags Source #
Force -dynamic on the debuggee if the debugger (which is also the external interpreter) was compiled with -dynamic. On Windows the debugger can't be built dynamic, so we won't enable it there.
See Note [Dynamic Debuggee for dynamic debugger]
resumeExec :: GhcMonad m => SingleStep -> Maybe Int -> m ExecResult Source #
setExposedInUnit :: UnitId -> [UnitId] -> Ghc () Source #
Rebuilds the UnitState of the unit, exposing the given packages.
Takes care of updating hsc_dflags, ue_platform, and ue_namever if this is the ue_currentUnit.
graphUnits :: ModuleGraph -> [UnitId] Source #
Extracts UnitIds from the graph.