This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Unwinder improvements.
- From: Michal Ludvig <mludvig at suse dot cz>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 07 May 2003 23:46:57 +0200
- Subject: Re: [PATCH] Unwinder improvements.
- Organization: SuSE CR s.r.o.
- References: <3EB90ED7.firstname.lastname@example.org> <20030507212835.GE27351@redhat.com>
Richard Henderson wrote:
On Wed, May 07, 2003 at 03:49:11PM +0200, Michal Ludvig wrote:
the attached patch adds a new function _Unwind_GetGRAddr()' to the
unwinder. Having it there is necessary when doing a backtrace from the
application to prevent a segfault in _Unwind_GetGR if requesting unsaved
OK to apply?
No. You've not given sufficient rationale for why this function
would need to be exported.
The API in <unwind.h> offers a function _Unwind_GetGR(). If I'm printing
a backtrace (eg. in a case of a program crash) using
_Unwind_ForceUnwind() I may choose to print argument registers (on archs
where function parameters are passed in registers) or even all
registers. However trying to fetch any register value via
_Unwind_GetGR() without knowing if it was saved or not will sooner or
later lead to a segfault (see a comment in _Unwind_GetGR() :-).
So I need a way to determine if a given register was saved in the
context or not and that's why I added _Unwind_GetGRAddr(). Of course it
could have been _Unwind_IsGRValid() returning true or false, but
returning the address itself (or zero if not saved) is IMHO harmless.
Or am I wrong?