This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Solution sought to GCC 4.1.1 backtrace problem
- From: Blair Barnett <blairbarnett at sbcglobal dot net>
- To: Andrew Haley <aph-gcc at littlepinkcloud dot COM>, David Daney <ddaney at avtrex dot com>
- Cc: gcc-help mailing list <gcc-help at gcc dot gnu dot org>
- Date: Wed, 29 Aug 2007 11:30:27 -0700 (PDT)
- Subject: Re: Solution sought to GCC 4.1.1 backtrace problem
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!
-blair
----- Original Message ----
From: Andrew Haley <aph-gcc@littlepinkcloud.COM>
To: Blair Barnett <blairbarnett@sbcglobal.net>
Cc: gcc-help mailing list <gcc-help@gcc.gnu.org>
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.