tango.core.tools.StackTrace

Stacktracing

Functions to generate a stacktrace.

License:
Tango License

Author:
Fawzi Mohamed

void rt_setAddrBacktraceFnc(AddrBacktraceFunc f);
sets the function used for address stacktraces

void rt_setSymbolizeFrameInfoFnc(SymbolizeFrameInfoFnc f);
sets the function used to symbolize a FrameInfo

Exception.TraceInfo rt_createTraceContext(void* ptr);
creates a stack trace (defined in the runtime)

size_t rt_addrBacktrace(TraceContext* context, TraceContext* contextOut, ulong* traceBuf, size_t bufLength, int* flags);
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, TraceContext* context, char[] buf);
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: object.Throwable.TraceInfo;
basic class that represents a stacktrace

this();
cretes an empty stacktrace

this(ulong[] 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 char[]) dg);
loops on the stacktrace

void writeOut(scope void delegate(const(char[])) sink);
Writes out the stacktrace.

size_t defaultAddrBacktrace(TraceContext* context, TraceContext* contextOut, ulong* traceBuf, size_t length, int* flags);
default (tango given) backtrace function

bool dladdrSymbolizeFrameInfo(ref FrameInfo fInfo, TraceContext* context, char[] buf);
poor symbolication, uses dladdr, gives no line info, limited info on statically linked files

bool defaultSymbolizeFrameInfo(ref FrameInfo fInfo, 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)


Page generated by Ddoc. Copyright (C) 2009 Fawzi