haskell-debugger
Safe HaskellNone
LanguageGHC2021

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

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

data Target Source #

A simplified view on a TargetId.

Implements Ord and Show which can be convenient.

Instances

Instances details
Eq Target Source # 
Instance details

Defined in GHC.Debugger.Session

Methods

(==) :: Target -> Target -> Bool #

(/=) :: Target -> Target -> Bool #

Ord Target Source # 
Instance details

Defined in GHC.Debugger.Session

Show Target Source # 
Instance details

Defined in GHC.Debugger.Session

Debugger's Interactive Home Unit

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]

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.