mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-14 03:43:13 +01:00
Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
43 lines
839 B
D
43 lines
839 B
D
import tango.core.Exception;
|
|
import cn.kuehne.flectioned;
|
|
|
|
|
|
TracedExceptionInfo traceHandler( void* ptr = null )
|
|
{
|
|
class FlectionedTrace :
|
|
TracedExceptionInfo
|
|
{
|
|
this( void* ptr = null )
|
|
{
|
|
if( ptr )
|
|
m_trace = Trace.getTrace( cast(size_t) ptr );
|
|
else
|
|
m_trace = Trace.getTrace();
|
|
}
|
|
|
|
int opApply( int delegate( inout char[] ) dg )
|
|
{
|
|
int ret = 0;
|
|
foreach( t; m_trace )
|
|
{
|
|
char[] buf = t.toString;
|
|
ret = dg( buf );
|
|
if( ret != 0 )
|
|
break;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
private:
|
|
Trace[] m_trace;
|
|
}
|
|
|
|
return new FlectionedTrace( ptr );
|
|
}
|
|
|
|
|
|
static this()
|
|
{
|
|
setTraceHandler( &traceHandler );
|
|
}
|