This is the mail archive of the
mailing list for the GCC project.
Re: unwinding through signal frame on ARM
- From: Ian Lance Taylor <iant at google dot com>
- To: Peng Yuan <yingbo dot com at gmail dot com>
- Cc: gcc <gcc at gcc dot gnu dot org>, Paul Brook <paul at codesourcery dot com>
- Date: Wed, 12 Mar 2014 13:34:03 -0700
- Subject: Re: unwinding through signal frame on ARM
- Authentication-results: sourceware.org; auth=none
- References: <CAKtXkwSrJZTdkf3QeuSV93YWQSrMyU6RNW0cbBkg_nE8-t0vRA at mail dot gmail dot com>
On Wed, Mar 12, 2014 at 8:33 AM, Peng Yuan <firstname.lastname@example.org> wrote:
> I'm using backtrace() to obtain call context by sending signals. But
> program segfaults if the first instruction of a function receives
> signal for backtrace.
> ARM unwinding in libgcc uses "return_address -= 2" to get the caller
> address. It is OK for normal function call with "bl xxx". But it
> cannot handle signal frame case because "return_address -= 2" may go
> to the preceding function.
> See get_eit_entry() in libgcc/unwind-arm-common.inc.
> Both GDB and libunwind take signal frame as a special case on ARM
> unwinding. Does libgcc also need to fix the case?
Note that the default libgcc unwinder does support special handling of
signal frames. See _Unwind_IsSignalFrame and _Unwind_SetSignalFrame
and the signal_frame field of _Unwind_FrameState. The signal_frame is
set by, for example, x86_64_fallback_frame_state in
So clearly something similar can be done for ARM. My understanding is
that the ARM EABI specifies the unwind info. I don't know how that
would affect this idea.