This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using libdw to get symbol names inside signal handler


On Fri, Apr 1, 2016 at 4:34 PM Mark Wielaard <mjw@redhat.com> wrote:

>
> It does have documentation, but it is indeed not as full as we would
> like. Please take a look at libdw.h and libdwfl.h
>

For someone who is familiar with ELF innards maybe, but for someone who
just wants backtrace and symbol names not so much :-)


> If you really need an in-process unwinder then I would recommend you
> take a look at the libbacktrace from the GCC project:
> https://gcc.gnu.org/viewcvs/gcc/trunk/libbacktrace/


I really do. Not only for logging after segmentation fault, but also for
watchdog feature: print stack trace if program stuck somewhere and could
not rewind SIGALRM timeout in time.

I have found standalone fork of libbacktrace (
https://github.com/ErwanLegrand/libbacktrace
<https://github.com/ErwanLegrand/libbacktrace_>) and will try it. Thank
you.


> If you just want to get a good backtrace when you get a SIGSEGV or other
> fatal signal it makes sense to just call eu-stack -P TID on yourself.
> fork and exec are signal safe. And then you don't have to try to deal
> with a possibly corrupt program.
>

It would be fine for SIGSEGV case, but not for watchdog (SIGALRM) case.

Thanks again for rapid answer!

On Fri, Apr 1, 2016 at 4:34 PM Mark Wielaard <mjw@redhat.com> wrote:

It does have documentation, but it is indeed not as full as we would
like. Please take a look at libdw.h and libdwfl.h

For someone who is familiar with ELF innards maybe, but for someone who just wants backtrace and symbol names not so much :-)
 
If you really need an in-process unwinder then I would recommend you
take a look at the libbacktrace from the GCC project:
https://gcc.gnu.org/viewcvs/gcc/trunk/libbacktrace/

I really do. Not only for logging after segmentation fault, but also for watchdog feature: print stack trace if program stuck somewhere and could not rewind SIGALRM timeout in time.

I have found standalone fork of libbacktrace (https://github.com/ErwanLegrand/libbacktrace) and will try it. Thank you. 
 
If you just want to get a good backtrace when you get a SIGSEGV or other
fatal signal it makes sense to just call eu-stack -P TID on yourself.
fork and exec are signal safe. And then you don't have to try to deal
with a possibly corrupt program.

It would be fine for SIGSEGV case, but not for watchdog (SIGALRM) case. 

Thanks again for rapid answer!

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]