| 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 -> 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
- exposeModGraphUnitsInInteractiveGhcDebuggerUnit :: Ghc ()
- graphsUnits :: HscEnv -> [UnitId]
- compileModuleWithDepsInHpt :: Target -> Ghc (Maybe SourceError)
- home_unit_dflags :: HscEnv -> UnitId -> Maybe DynFlags
- packageImportDecl :: PackageQualifier -> ModuleName -> ImportDecl GhcPs
- withUnliftGhc :: ((Ghc b -> IO b) -> IO a) -> Ghc a
- annotateCallStackGhc :: HasCallStack => Ghc a -> Ghc a
- lookupUnitPackageQualifier :: HscEnv -> UnitId -> Maybe PackageQualifier
- fixHomeUnitsDynFlagsForIIDecl :: Ghc ()
- getPgmI :: DynFlags -> String
- initUniqSupplyIO :: IO ()
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 -> 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 #
exposeModGraphUnitsInInteractiveGhcDebuggerUnit :: Ghc () Source #
Sets the units from the ModuleGraph as the exposed ones for InteractiveGhcDebuggerUnit.
See Note [Must explicitly expose module graph units].
graphsUnits :: HscEnv -> [UnitId] Source #
Extracts UnitIds from ModuleGraph and HomeUnitGraph.
packageImportDecl :: PackageQualifier -> ModuleName -> ImportDecl GhcPs Source #
withUnliftGhc :: ((Ghc b -> IO b) -> IO a) -> Ghc a Source #
WARNING: callback is not to be used from other threads.
annotateCallStackGhc :: HasCallStack => Ghc a -> Ghc a Source #
fixHomeUnitsDynFlagsForIIDecl :: Ghc () Source #
See Note [ Ambiguous Package Qualified Imports Workaround ]
initUniqSupplyIO :: IO () Source #
See Note [ UniqSupply is process global ]
Orphan instances
| Ord PackageDBFlag Source # | |
Methods compare :: PackageDBFlag -> PackageDBFlag -> Ordering # (<) :: PackageDBFlag -> PackageDBFlag -> Bool # (<=) :: PackageDBFlag -> PackageDBFlag -> Bool # (>) :: PackageDBFlag -> PackageDBFlag -> Bool # (>=) :: PackageDBFlag -> PackageDBFlag -> Bool # max :: PackageDBFlag -> PackageDBFlag -> PackageDBFlag # min :: PackageDBFlag -> PackageDBFlag -> PackageDBFlag # | |
| Ord PkgDbRef Source # | |