Hi, On Wed, 2013-10-30 at 08:58 +0100, Jan Kratochvil wrote: > On Wed, 30 Oct 2013 07:31:19 +0100, Jasper St. Pierre wrote: > > Whoops, I misspoke when I talked about libbacktrace. I meant libunwind all > > throughout, since that's what Xorg uses right now. > > I see now the libunwind support has been already upstreamed; I saw it before > only as a Fedora-only downstream patch so I did not have concerns for example > about the non-Linux OSes and I contacted Peter Hutterer only wrt the > downstream Fedora patch. The xorg-upstreamed libunwind support was: > commit e21e183059df5975e7086850d1931edb2c1bbd06 > Author: Marcin Slusarz <[email protected]> > Date: Thu Feb 21 09:02:44 2013 +1000 > os: use libunwind to generate backtraces > > http://cgit.freedesktop.org/xorg/xserver/commit/?id=e21e183059df5975e7086850d1931edb2c1bbd06 > > > > Should we work on making the elfutils backtrace API more like libunwind / > > libbacktrace, > > libunwind and libbacktrace have different API. Besides that their > functionality is almost disjunct (they just both contain the tiny > addr->elfsymbol part xorg needs). > > > > Should we focus on porting libbacktrace / libunwind to elfutils, and have > > one simple API for this? > > I do not understand what you are proposing. This is the current situation: > > elfutils: addr->elfsymbol (file:lineno) (inlines) > elfutils next: addr->elfsymbol (file:lineno) (inlines) unwinding > backtrace(): unwinding > libbacktrace: addr->elfsymbol file:lineno inlines > libunwind: addr->elfsymbol unwinding > GDB: addr->elfsymbol file:lineno inlines unwinding parameters
I might not have the full context (just got CCed on this message), but looking at the above patch it looks like what is needed here is just a simple in-process backtrace possibly with symbols. I would love to promote elfutils for that. But you could just use backtrace () and backtrace_symbols () if the C library provides them. http://www.gnu.org/software/libc/manual/html_node/Backtraces.html http://man7.org/linux/man-pages/man3/backtrace.3.html If your C library doesn't provide that, then you could use an alternative library (like libunwind). If you want more than a simple backtrace and elf symbols then look at one of the more specialized libraries listed above. Since this is for in-process unwinding gcc's libbacktrace seems the most obvious candidate for that. But other solutions like elfutils or invoking gdb might be more featurefull and flexible. All of them might be overkill in this situation though. Cheers, Mark _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
