[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libunwind] Unwinding using the context passed to a signal handler (
From: |
David Mosberger |
Subject: |
Re: [libunwind] Unwinding using the context passed to a signal handler (doesn't work) |
Date: |
Wed, 17 Mar 2004 08:05:24 -0800 |
>>>>> On Wed, 17 Mar 2004 16:18:45 +0100, Johan Walles <address@hidden> said:
Johan> Note that the function that crashes (crash()) isn't part of
Johan> the first stack trace (initialized using the context passed
Johan> to the signal handler).
Johan> Why isn't it? And if I want that, what should I do? Am I
Johan> using libunwind correctly?
The program attempts to unwind from a sigcontext_t, by casting it to
ucontext_t. That can't work. There is a reason these are different
types, even though they have the same layout: unw_getcontext() returns
the _preserved_ state in ucontext_t, whereas a signal handler saves
only the _scratch_ state in sigcontext. To initiate unwinding, the
preserved state is needed. 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()).
--david