Throwable.TraceInfo
david via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jan 28 06:45:03 PST 2015
On Wednesday, 28 January 2015 at 14:17:36 UTC, Dicebot wrote:
> AFAIK it is exactly generation of stack trace that takes so
> long. Recently it was changes to be generated lazily which is
> why version without `toString` is much faster. I don't think it
> can be any better if you want stack trace. For getting just the
> exception data one can directly access `e.msg` / `e.file` /
> `e.line`
BTW: The code of the 'ctor generates the calltrace - so it's not
lazy!
From the druntime:
auto stackTop = getBasePtr();
auto stackBottom = cast(void**)
thread_stackBottom();
void* dummy;
if( stackTop && &dummy < stackTop && stackTop
< stackBottom )
{
auto stackPtr = stackTop;
for( numframes = 0; stackTop <= stackPtr
&&
stackPtr <
stackBottom &&
numframes <
MAXFRAMES; )
{
callstack[numframes++] = *(stackPtr +
1);
stackPtr = cast(void**) *stackPtr;
}
}
More information about the Digitalmars-d
mailing list