This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Unwinding on Sparc/Solaris: MD_FALLBACK_FRAME_STATE_FOR
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 23 Jan 2003 13:26:04 -0500
- Subject: Re: Unwinding on Sparc/Solaris: MD_FALLBACK_FRAME_STATE_FOR
- References: <25D57F1C-2EFD-11D7-BF8A-00039344BF4A@gnat.com>
On Thu, Jan 23, 2003 at 01:04:42PM -0500, Geert Bosch wrote:
> I am trying to get GCC to correctly unwind through
> SPARC/Solaris signal frames. When the GCC unwinder encounters
> a frame without unwind info, it will execute the code
> given by the MD_FALLBACK_FRAME_STATE_FOR macro, which
> is not defined yet.
>
> The problem however is finding out what signal frames look like
> and where the information to unwind through them can be found,
> such as saved stack pointer, return address etc.
> Since GDB can display a correct backtrace when breaking in
> a signal handler, I have looked there for inspiration.
> The GDB 5.1 code to handle this are in gdb/sparc-tdep.c,
> function sparc_init_extra_frame_info and sparc_frame_saved_pc.
> However, most of the 3212 lines in this file seem related to tracing
> through these frames without DWARF info, and it's a bit of a mess
> that I have not been able to untangle.
sparc_frame_saved_pc is a good place to start; what it tells me is
that generally there is a pointer in %o2 to the sigcontext structure.
You can then look in Solaris headers to find the struct sigcontext.
The PC should be the fourth word, in 32-bit mode at least, to guess
from the comments in GDB. I don't know what else you need to unwind in
MD_FALLBACK_FRAME_STATE_FOR but it should all be in the struct
sigcontext.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer