[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libunwind] Unwinding using the context passed to a signal handler (
Re: [libunwind] Unwinding using the context passed to a signal handler (doesn't work)
Thu, 18 Mar 2004 10:18:59 -0800
>>>>> On Thu, 18 Mar 2004 15:46:37 +0100, Johan Walles <address@hidden> said:
Johan> Which registers exactly are missing from the sigcontext
Johan> passed to the signal handler?
ar.rnat (in the absence of an alternate signal stack)
ar.bspstore (in the absence of an alternate signal stack)
I may be missing some, but these are certainly the main ones.
Johan> I was guessing that the only thing needed to walk the stack
Johan> would be the IP, BSP, SP (=R12), and the CFM.
No, in general, you need the entire machine-state because relevant
values may have been stored in any of the above registers.
Johan> Aren't those part of the signal context?
Yes, IP, BSP, SP, and CFM are valid in the signal context. However,
the stacked registers are not flushed to memory unless an alternate
signal stack is in effect.
>> You should be able to just do a unw_getcontext() anywhere in the
>> signal handler and then step until you hit the signal frame (as
>> indicated by unw_is_signal_frame()).
Johan> I'd prefer just filling in a few more registers in the
Johan> sigcontext struct. Can we do that? Which registers would
Johan> that be?
Several alternatives are possible, depending on your exact needs. I
think you have a copy of my book. If so, this is being discussed on
page 249-215 (and Figure 5.11). The discussion there is in regards to
short-circuiting out of a signal handler, but the issue is obviously
analogous to unwinding.