This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Unwinder improvements.


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 register.

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?

Michal Ludvig


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]