[PATCH 4/5] Support backtracing through elfutils (#70746)

Peter Hutterer peter.hutterer at who-t.net
Thu Oct 31 05:00:36 CET 2013


On Wed, Oct 30, 2013 at 07:50:28PM +0100, Mark Wielaard wrote:
> On Wed, 2013-10-30 at 12:14 +0100, Jan Kratochvil wrote:
> > On Wed, 30 Oct 2013 11:02:25 +0100, Mark Wielaard wrote:
> > > I would love to promote elfutils for that. But you could just
> > > use backtrace () and backtrace_symbols () if the C library provides them.
> > 
> > It is unfortunately not so easy, I wrote there lower in the mail:
> > 
> > > On Wed, 30 Oct 2013 08:58:00 +0100, Jan Kratochvil wrote:
> > > > libgcc backtrace_symbols() can do some "addr->elfsymbol" but it resolves only
> > > > symbols in .dynsym (exported ones), not from .symtab, therefore also not from
> > > > separate .debug files.
> 
> I see. And I now looked a bit more at the actual os/backtrace.c code.
> The code already uses dladdr () which provides the same (limited) info.
> 
> It also looks like this might be called from OsSigHandler to handle a
> fatal signal. In that case you really should do the minimum possible and
> get out quickly.
> 
> Do you really want to do anything more than direct (.dynsym) symbol
> lookup? Looking up and loading separate .debug files or decompressing
> a .gnu_debugdata section for example to get more interesting tables with
> symbol names might not be the best thing to do from a signal handler
> through any of the proposed libraries.

tbh, the only thing I care about is good backtraces when the server crashes.
how we get to that I don't care too much about. The elfutils API isn't the
prettiest atm but this is code that barely moves once written, so I'd be
happy with it.

and yes, xorg_backtrace() is almost always called from within the signal
handler.

Cheers,
   Peter
 


More information about the xorg-devel mailing list