Re: Solution sought to GCC 4.1.1 backtrace problem

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

 



Backtracing through segfaults is hard.  The approach we use in
glibc/GNU/Linux is a function called *_fallback_frame_state, which
copies the saved registers on the stack into the unwinder data.
However, this only works if you're using DWARF-style unwinder data,
which is used in the EABI port of ARM.

If you're not using EABI, you really need to write your own version of
backtrace() that starts from a signal fram and unwinds through it.
The SIGCONTEXT ctx that's passed to your segfault handler contains the
registers at the point the segfault occurred, and you can unwind
starting from there.

Don't do this:

   void *fp = __builtin_frame_address (0);

Instead, pull fp and sp out of the SIGCONTEXT ctx.

Andrew.

[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