tango.core.tools.StackTrace

Stacktracing
Functions to generate a stacktrace.

License:

Tango License

Author:

Fawzi Mohamed
void rt_setAddrBacktraceFnc(AddrBacktraceFunc f) [extern(C)]
sets the function used for address stacktraces
void rt_setSymbolizeFrameInfoFnc(SymbolizeFrameInfoFnc f) [extern(C)]
sets the function used to symbolize a FrameInfo
Exception.TraceInfo rt_createTraceContext(void* ptr) [extern(C)]
creates a stack trace (defined in the runtime)
size_t rt_addrBacktrace(TraceContext* context, TraceContext* contextOut, size_t* traceBuf, size_t bufLength, int* flags) [extern(C)]
builds a backtrace of addresses, the addresses are addresses of the *next* instruction, *return* addresses, the most likely the calling instruction is the one before them (stack top excluded)
bool rt_symbolizeFrameInfo(ref FrameInfo fInfo, const(TraceContext)* context, char[] buf) [extern(C)]
tries to sybolize a frame information, this should try to build the best backtrace information, if possible finding the calling context, thus if fInfo.exactAddress is false the address might be changed to the one preceding it returns true if it managed to at least find the function name
const(char)[] nameOfFunctionAt(void* addr, char[] buf)
const(char)[] nameOfFunctionAt(void* addr)
returns the name of the function at the given adress (if possible) function@ and then the address. For delegates you can use .funcptr does not demangle
enum AddrPrecision
precision of the addresses given by the backtrace function
class BasicTraceInfo : Throwable.TraceInfo
basic class that represents a stacktrace
this()
cretes an empty stacktrace
this(size_t[] traceAddresses, AddrPrecision addrPrecision)
creates a stacktrace with the given traceAddresses
void trace(TraceContext* contextIn = null, int skipFrames = 0)
takes a stacktrace
int opApply(scope int delegate(ref const(char[])) dg) [override, const]
loops on the stacktrace
void writeOut(scope void delegate(const(char[])) sink) [const]
Writes out the stacktrace.
size_t defaultAddrBacktrace(TraceContext* context, TraceContext* contextOut, size_t* traceBuf, size_t length, int* flags)
default (tango given) backtrace function
bool dladdrSymbolizeFrameInfo(ref FrameInfo fInfo, const(TraceContext)* context, char[] buf)
poor symbolication, uses dladdr, gives no line info, limited info on statically linked files
bool defaultSymbolizeFrameInfo(ref FrameInfo fInfo, const(TraceContext)* context, char[] buf)
loads symbols for the given frame info with the methods defined in tango itself
Exception.TraceInfo basicTracer(void* ptr = null)
function that generates a trace (handler compatible with old TraceInfo)