Re: Solution sought to GCC 4.1.1 backtrace problem

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

 



Blair Barnett writes:

 > We're using the EABI extensions, so I think we're safe there. We're
 > trying the patch now. However, being unfamiliar with this code, I'm
 > wondering how it works, since I don't see any calls to the new
 > functions in the patch:
 > http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01388.html
 > 
 > Thanks for all the help! There may be light at the end of this tunnel!

For _Unwind_Backtrace to work, all code must be compiled with
-fexceptions.

Also, if you want to unwind through a signal handler you'll need some
code that recognizes a signal frame and unwinds through it.  There is
not yet any such thing for ARM EABI.  There's an example of how you do
this at x86_64_fallback_frame_state() in gcc/config/i386/linux-unwind.h.

This kind of thing is hard to write: I understand exactly how it all
works, and it would take me quite a while to figure out how to load
the _Unwind_Context from the sigcontext.

Andrew.

 > ----- Original Message ----
 > From: Andrew Haley <aph-gcc@xxxxxxxxxxxxxxxxxxx>
 > To: Blair Barnett <blairbarnett@xxxxxxxxxxxxx>
 > Cc: gcc-help mailing list <gcc-help@xxxxxxxxxxx>
 > Sent: Wednesday, August 29, 2007 11:00:43 AM
 > Subject: Re: Solution sought to GCC 4.1.1 backtrace problem
 > 
 > 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