Re: errbacktrace - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: errbacktrace
Date
Msg-id 20190708162851.GA11054@alvherre.pgsql
Whole thread Raw
In response to Re: errbacktrace  (Dmitry Dolgov <9erthalion6@gmail.com>)
Responses Re: errbacktrace  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Re: errbacktrace  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On 2019-Jul-08, Dmitry Dolgov wrote:

> > On Sat, Jun 29, 2019 at 7:41 AM Jaime Casanova <jaime.casanova@2ndquadrant.com> wrote:
> >
> > This is certainly a very useful thing. Sadly, it doesn't seem to compile when
> > trying to use libunwind.
> 
> Yeah, the same for me. To make it works I've restricted libunwind to local
> unwinding only:
> 
>     #ifdef USE_LIBUNWIND
>     #define UNW_LOCAL_ONLY
>     #include <libunwind.h>
>     #endif

Ah, yes.  unwind's manpage says:

  Normally, libunwind supports both local and remote unwinding (the latter will
  be explained in the next section). However, if you tell libunwind that your
  program only needs local unwinding, then a special implementation can be
  selected which may run much faster than the generic implementation which
  supports both kinds of unwinding. To select this optimized version, simply
  define the macro UNW_LOCAL_ONLY before including the headerfile <libunwind.h>.

so I agree with unconditionally defining that symbol.

Nitpicking dept: I think in these tests:

+   if (!edata->backtrace &&
+       edata->funcname &&
+       backtrace_function[0] &&
+       strcmp(backtrace_function, edata->funcname) == 0)
+       set_backtrace(edata, 2);

we should test for backtrace_function[0] before edata->funcname, since
it seems more likely to be unset.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Switching PL/Python to Python 3 by default in PostgreSQL 12
Next
From: Tom Lane
Date:
Subject: Re: Switching PL/Python to Python 3 by default in PostgreSQL 12