HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulebase-4.20.2.0Haskell2010

GHC.Stack.CloneStack

This module exposes an interface for capturing the state of a thread's execution stack for diagnostics purposes: cloneMyStack, cloneThreadStack.

Such a "cloned" stack can be decoded with decode to a stack trace, given that the -finfo-table-map is enabled.

  • 2 types
  • 3 values
  • Packagebase-4.20.2.0
  • Exports5
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceCloneStack.hs

Decode a StackSnapshot to a stacktrace (a list of StackEntry). The stack trace is created from return frames with according InfoProvEnt entries. To generate them, use the GHC flag -finfo-table-map. If there are no InfoProvEnt entries, an empty list is returned.

Please note:

  • To gather StackEntry from libraries, these have to be compiled with -finfo-table-map, too.

  • Due to optimizations by GHC (e.g. inlining) the stacktrace may change with different GHC parameters and versions.

  • The stack trace is empty (by design) if there are no return frames on the stack. (These are pushed every time when a case ... of scrutinee is evaluated.)