public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, libphobos] Committed fallback UnwindBacktrace if LibBacktrace unfound
@ 2019-02-13  7:15 Iain Buclaw
  0 siblings, 0 replies; only message in thread
From: Iain Buclaw @ 2019-02-13  7:15 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 640 bytes --]

Hi,

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

Only useful if building --without-libbacktrace or libbacktrace is
unsupported for whatever reason.

Bootstrapped and regression tested on x86_64-linux-gnu.

Committed to trunk as r268836.

-- 
Iain
---
libphobos/ChangeLog:

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

[-- Attachment #2: tracehandler.patch --]
[-- Type: text/x-patch, Size: 1443 bytes --]

diff --git a/libphobos/libdruntime/core/runtime.d b/libphobos/libdruntime/core/runtime.d
index a78363cf477..0ead04752e4 100644
--- a/libphobos/libdruntime/core/runtime.d
+++ b/libphobos/libdruntime/core/runtime.d
@@ -619,6 +619,22 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )
         }
         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 ) )
     {
         import core.demangle;
@@ -885,22 +901,6 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null )
         auto s = new StackTrace(FIRSTFRAME, cast(CONTEXT*)ptr);
         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
     {
         return null;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-02-13  7:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-13  7:15 [PATCH, libphobos] Committed fallback UnwindBacktrace if LibBacktrace unfound Iain Buclaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).