base-4.6.0.1: Basic libraries

Portability | non-portable (GHC Extensions)
Stability | internal
Maintainer | cvs-ghc@haskell.org
Safe Haskell | None

GHC.Stack

Contents

- Call stack
- Internals

Description

Access to GHC's call-stack simulation

Synopsis

- currentCallStack :: IO [String]
- whoCreated :: a -> IO [String]
- data CostCentreStack
- data CostCentre
- getCurrentCCS :: dummy -> IO (Ptr CostCentreStack)
- getCCSOf :: a -> IO (Ptr CostCentreStack)
- ccsCC :: Ptr CostCentreStack -> IO (Ptr CostCentre)
- ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack)
- ccLabel :: Ptr CostCentre -> IO CString
- ccModule :: Ptr CostCentre -> IO CString
- ccSrcSpan :: Ptr CostCentre -> IO CString
- ccsToStrings :: Ptr CostCentreStack -> IO [String]
- renderStack :: [String] -> String

# Call stack

currentCallStack :: IO [String]

returns a '[String]' representing the current call stack. This can be useful for debugging.

The implementation uses the call-stack simulation maintined by the profiler, so it only works if the program was compiled with `-prof` and contains suitable SCC annotations (e.g. by using `-fprof-auto`). Otherwise, the list returned is likely to be empty or uninformative.

whoCreated :: a -> IO [String]

# Internals

data CostCentreStack

data CostCentre

getCurrentCCS :: dummy -> IO (Ptr CostCentreStack)

getCCSOf :: a -> IO (Ptr CostCentreStack)

ccsCC :: Ptr CostCentreStack -> IO (Ptr CostCentre)

ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack)

ccLabel :: Ptr CostCentre -> IO CString

ccModule :: Ptr CostCentre -> IO CString

ccSrcSpan :: Ptr CostCentre -> IO CString

ccsToStrings :: Ptr CostCentreStack -> IO [String]

renderStack :: [String] -> String