backtrace from a SIGSEGV handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

[gcc/g++ 4.3 on i386, linux]

In our SIGSEGV handler we want to make a backtrace to get some context
in a generated bug report.

This works fine in most cases. However, when doing a virtual function call on
an non initialized C++ object this can lead to calling an arbitrary address.
And in the backtrace call, GCC generates a new SIGSEGV when attempting
to trace around that address. GCC then shuts down the app.

I tried installing a local SIGSEGV handler guarding the call to backtrace,
to catch this case, but it never got invoked.

Is there some way to reliably make a backtrace from inside a SIGSEGV
handler?

The alternative I can think of is to do memcpy on a chunk of the
current stack and then call backtrace at some later point, using
this saved data, when a temporary SIGSEGV handler can detect
when backtrace does invalid memory access.

But, I cannot find a backtrace variant that works with a stack copy
in this way.

Advice?

Regards
// ATS.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux