ghc-7.10.3: The GHC API

Safe Haskell | None
Language | Haskell2010

Debug

Synopsis

- data DebugBlock = DebugBlock {
  - dblProcedure :: !Label
  - dblLabel :: !Label
  - dblCLabel :: !CLabel
  - dblHasInfoTbl :: !Bool
  - dblTicks :: ![CmmTickish]
  - dblSourceTick :: !(Maybe CmmTickish)
  - dblPosition :: !(Maybe Int)
  - dblUnwind :: !UnwindTable
  - dblBlocks :: ![DebugBlock]
  }
- dblIsEntry :: DebugBlock -> Bool
- type UnwindTable = Map GlobalReg UnwindExpr
- data UnwindExpr
  - = UwConst Int
  - | UwReg GlobalReg Int
  - | UwDeref UnwindExpr
  - | UwPlus UnwindExpr UnwindExpr
  - | UwMinus UnwindExpr UnwindExpr
  - | UwTimes UnwindExpr UnwindExpr
- cmmDebugGen :: ModLocation -> RawCmmGroup -> [DebugBlock]
- cmmDebugLabels :: (i -> Bool) -> GenCmmGroup d g (ListGraph i) -> [Label]
- cmmDebugLink :: [Label] -> [DebugBlock] -> [DebugBlock]
- debugToMap :: [DebugBlock] -> LabelMap DebugBlock

# Documentation

data DebugBlock

Debug information about a block of code. Ticks scope over nested blocks.

Constructors

DebugBlock |

Fields

dblProcedure :: !Label

  Entry label of containing proc

dblLabel :: !Label

  Hoopl label

dblCLabel :: !CLabel

  Output label

dblHasInfoTbl :: !Bool

  Has an info table?

dblTicks :: ![CmmTickish]

  Ticks defined in this block

dblSourceTick :: !(Maybe CmmTickish)

  Best source tick covering block

dblPosition :: !(Maybe Int)

  Output position relative to other blocks. `Nothing` means the block was optimized out

dblUnwind :: !UnwindTable

  Unwind information

dblBlocks :: ![DebugBlock]

  Nested blocks

Instances

Outputable DebugBlock |

dblIsEntry :: DebugBlock -> Bool

Is this the entry block?

type UnwindTable = Map GlobalReg UnwindExpr

Maps registers to expressions that yield their "old" values further up the stack. Most interesting for the stack pointer Sp, but might be useful to document saved registers, too.

data UnwindExpr

Expressions, used for unwind information

Constructors

UwConst Int | literal value
UwReg GlobalReg Int | register plus offset
UwDeref UnwindExpr | pointer dereferencing
UwPlus UnwindExpr UnwindExpr |
UwMinus UnwindExpr UnwindExpr |
UwTimes UnwindExpr UnwindExpr |

Instances

Eq UnwindExpr |
Outputable UnwindExpr |

cmmDebugGen :: ModLocation -> RawCmmGroup -> [DebugBlock]

Extract debug data from a group of procedures. We will prefer source notes that come from the given module (presumably the module that we are currently compiling).

cmmDebugLabels :: (i -> Bool) -> GenCmmGroup d g (ListGraph i) -> [Label]

cmmDebugLink :: [Label] -> [DebugBlock] -> [DebugBlock]

Sets position fields in the debug block tree according to native generated code.

debugToMap :: [DebugBlock] -> LabelMap DebugBlock

Converts debug blocks into a label map for easier lookups