ghc-9.13: The GHC API
Safe HaskellNone
LanguageGHC2021

GHC.Runtime.Debugger.Breakpoints

Description

GHC API debugger module for finding and setting breakpoints.

This module is user facing and is at least used by GHCi and `ghc-debugger` to find and set breakpoints.

Synopsis

Documentation

findBreakByLine Source #

Arguments

:: Int

Line number

-> TickArray 
-> Maybe (BreakIndex, RealSrcSpan) 

Find a breakpoint given a Module's TickArray and the line number.

When a line number is specified, the current policy for choosing the best breakpoint is this: - the leftmost complete subexpression on the specified line, or - the leftmost subexpression starting on the specified line, or - the rightmost subexpression enclosing the specified line

findBreakByCoord :: (Int, Int) -> TickArray -> Maybe (BreakIndex, RealSrcSpan) Source #

Find a breakpoint in the TickArray of a module, given a line number and a column coordinate.

enclosingTickSpan :: TickArray -> SrcSpan -> RealSrcSpan Source #

Returns the span of the largest tick containing the srcspan given

resolveFunctionBreakpoint :: GhcMonad m => String -> m (Either SDoc (Module, ModuleInfo, String)) Source #

Process and validate the user string of form [Module.]function into the relevant module information and function name.

Validation guarantees 1. The module exists 2. The identifier is in an interpreted module 3. The identifier has a breakpoint entry in the module's ModBreaks

Returns either an error SDoc or the Module and ModuleInfo for the relevant module paired with the function name

See also Note [Setting Breakpoints by Id]

findBreakForBind Source #

Arguments

:: String

Name of bind to break at

-> ModBreaks 
-> [(BreakIndex, RealSrcSpan)] 

The aim of this function is to find the breakpoints for all the RHSs of the equations corresponding to a binding. So we find all breakpoints for (a) this binder only (it maybe a top-level or a nested declaration) (b) that do not have an enclosing breakpoint

type TickArray = Array Int [(BreakIndex, RealSrcSpan)] Source #

Maps line numbers to the breakpoint ticks existing at that line for a module.

makeModuleLineMap :: GhcMonad m => Module -> m (Maybe TickArray) Source #

Construct the TickArray for the given module.