base-4.12.0.0: Basic libraries

Copyright(c) The University of Glasgow 2011
Licensesee libraries/base/LICENSE
Maintainercvs-ghc@haskell.org
Stabilityinternal
Portabilitynon-portable (GHC Extensions)
Safe HaskellTrustworthy
LanguageHaskell2010

GHC.Stack.CCS

Contents

Description

Access to GHC's call-stack simulation

Since: base-4.5.0.0

Synopsis

Call stacks

currentCallStack :: IO [String] #

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

The implementation uses the call-stack simulation maintained 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.

Since: base-4.5.0.0

whoCreated :: a -> IO [String] #

Get the stack trace attached to an object.

Since: base-4.5.0.0

Internals

data CostCentreStack #

A cost-centre stack from GHC's cost-center profiler.

data CostCentre #

A cost-centre from GHC's cost-center profiler.

getCurrentCCS :: dummy -> IO (Ptr CostCentreStack) #

Returns the current CostCentreStack (value is nullPtr if the current program was not compiled with profiling support). Takes a dummy argument which can be used to avoid the call to getCurrentCCS being floated out by the simplifier, which would result in an uninformative stack (CAF).

getCCSOf :: a -> IO (Ptr CostCentreStack) #

Get the CostCentreStack associated with the given value.

clearCCS :: IO a -> IO a #

Run a computation with an empty cost-center stack. For example, this is used by the interpreter to run an interpreted computation without the call stack showing that it was invoked from GHC.

ccLabel :: Ptr CostCentre -> IO CString #

Get the label of a CostCentre.

ccModule :: Ptr CostCentre -> IO CString #

Get the module of a CostCentre.

ccSrcSpan :: Ptr CostCentre -> IO CString #

Get the source span of a CostCentre.

ccsToStrings :: Ptr CostCentreStack -> IO [String] #

Format a CostCentreStack as a list of lines.