This is the mail archive of the 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.

On Wed, May 07, 2003 at 11:46:57PM +0200, Michal Ludvig wrote:
> 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() :-).

At the moment I'm inclined to think this is a mis-use of
the API.  

> 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?

Well for one you should notice that mainline already has
_Unwind_GetGRPtr, though that isn't exported.

I'd be more inclined to simply return 0 (or deadbeef or
some other value) instead of crashing, rather than adding
another interface.


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