libunwind-devel
[Top][All Lists]
Advanced

[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: Tue, 23 Mar 2004 16:02:56 -0800

>>>>> On Tue, 23 Mar 2004 13:15:09 +0100, Johan Walles <address@hidden> said:

  Johan> 1. Calling unw_getcontext() is the same as just calling
  Johan> libc's getcontext().

That's been true until last Friday, when I created a separate
unw_getcontext() for ia64.  But even so, the only difference is that
unw_getcontext() doesn't obtain the current signal mask (i.e.,
obviates the need for calling sigprocmask()).

  Johan> 2. getcontext() on Linux / ia64 returns the context *inside
  Johan> the getcontext() function*, not the context at the place from
  Johan> where getcontext() is called (which is what I always thought
  Johan> it did).

What makes you say this?  The return-pointer is saved in the context,
which is the address of the call-site.

  Johan> 3. To compensate for this, unw_init_local() starts by
  Johan> unwinding the context it receives by one frame.

It only does this on HP-UX.

  Johan> 1. The unw_getcontext() man page says:

  Johan> "The unw_getcontext() routine initializes the context
  Johan> structure pointed to by ucp with the machine-state of the
  Johan> call-site."

  Johan> This is how I think it should be working, but isn't in fact
  Johan> how it works in reality.  IMO, the man page is correct, and
  Johan> the implementation should be fixed.

The implementation matches the man-page as far as I'm concerned.

  Johan> 2. The unw_init_local() man page says:

  Johan> "The unw_init_local() routine initializes the unwind cursor
  Johan> pointed to by c with the machine-state in the context
  Johan> structure pointed to by ctxt.  As such, the machine-state
  Johan> pointed to by ctxt identifies the initial stack frame at
  Johan> which unwinding starts."

  Johan> Again, this is how I think it should be working, but isn't in
  Johan> fact how it works in reality.  IMO, this man page is correct
  Johan> as well, and the implementation should be fixed.

I do not understand why you think the implementation doesn't match the
description.  I'm guess here, but are you perhaps concerned about the
meaning of the BSP member in ucontext_t?  In any case, as I explained
earlier, you simply _cannot_ reliably unwind directly from sigcontext.
Even if it happened to work for some cases, it would definitely fail
for others.

        --david


reply via email to

[Prev in Thread] Current Thread [Next in Thread]