Commit 5522686e by Iain Buclaw Committed by Iain Buclaw

libphobos: Fallback on UnwindBacktrace if LibBacktrace not defined.

In the gcc.backtrace module, either one of LibBacktrace or
UnwindBacktrace will always be defined.  Giving UnwindBacktrace a higher
precedence over the libc backtrace as the default handler because the
latter depends on a rt.backtrace module that is not compiled in.

libphobos/ChangeLog:

	* libdruntime/core/runtime.d (defaultTraceHandler): Give
	UnwindBacktrace handler precedence over backtrace.

From-SVN: r268836
parent 91c50487
2019-02-13 Iain Buclaw <ibuclaw@gdcproject.org>
* libdruntime/core/runtime.d (defaultTraceHandler): Give
UnwindBacktrace handler precedence over backtrace.
2019-02-10 Iain Buclaw <ibuclaw@gdcproject.org> 2019-02-10 Iain Buclaw <ibuclaw@gdcproject.org>
* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Remove rt/util/hash.d * libdruntime/Makefile.am (DRUNTIME_DSOURCES): Remove rt/util/hash.d
......
...@@ -619,6 +619,22 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null ) ...@@ -619,6 +619,22 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )
} }
return new LibBacktrace(FIRSTFRAME); return new LibBacktrace(FIRSTFRAME);
} }
else static if ( __traits( compiles, new UnwindBacktrace(0) ) )
{
version (Posix)
{
static enum FIRSTFRAME = 5;
}
else version (Win64)
{
static enum FIRSTFRAME = 4;
}
else
{
static enum FIRSTFRAME = 0;
}
return new UnwindBacktrace(FIRSTFRAME);
}
else static if ( __traits( compiles, backtrace ) ) else static if ( __traits( compiles, backtrace ) )
{ {
import core.demangle; import core.demangle;
...@@ -885,22 +901,6 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null ) ...@@ -885,22 +901,6 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )
auto s = new StackTrace(FIRSTFRAME, cast(CONTEXT*)ptr); auto s = new StackTrace(FIRSTFRAME, cast(CONTEXT*)ptr);
return s; return s;
} }
else static if ( __traits( compiles, new UnwindBacktrace(0) ) )
{
version (Posix)
{
static enum FIRSTFRAME = 5;
}
else version (Win64)
{
static enum FIRSTFRAME = 4;
}
else
{
static enum FIRSTFRAME = 0;
}
return new UnwindBacktrace(FIRSTFRAME);
}
else else
{ {
return null; return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment