[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libunwind-devel] cursor.is_interrupted() or is_...

From: Andrew Cagney
Subject: Re: [Libunwind-devel] cursor.is_interrupted() or is_...
Date: Tue, 08 Jan 2008 15:11:53 -0500
User-agent: Thunderbird (X11/20071115)

Arun Sharma wrote:
On Jan 8, 2008 7:42 AM, Andrew Cagney <address@hidden <mailto:address@hidden>> wrote:

    what thoughts are there on adding a cursor method such as
    is_interrupted() or is_caller() or ...?  The implementation would
    involve the addition of an extra bit field to the cursor.

This sounds analogous to unw_is_signal_frame() - which is implemented without an extra bit.

It is related yes; consider the back-trace:

  <signal>     is_interrupted=1 is_signal=1 -- inner
  handler()    is_interrupted=1 is_signal=0
  <signal>     is_interrupted=0 is_signal=1
  foo()        is_interrupted=1 is_signal=0
  main()       is_interrupted=0 is_signal=0 -- outer

(Note that, in the above, the inner most frame has both is_interrupted and is_signal as will occure when single stepping through the signal trampoline. More typically just is_interrupted would be set.)

And we can see that is_interrupted() can be computed thus:

  if (cursor is inner-most)
     return 1; // innermost frame (implicitly interrupted)
  else if (cursor's inner is_signal)
     return 1; // interrupted by signal
     return 0;

Unfortunatly the inner frame's state isn't available, so instead we implement this by caching the computed value during the step vis:

     cursor.is_interrupted = 1;

     cursor.is_interrupted = inner.is_signal

we can then use  cursor.is_interrupted to correctly handle:

From DWARF 3:
In most cases the return address is in the same context as the calling address, but that need not be the case, especially if the producer knows in some way the call never will return. The context of the 'return address' might be on a different line, in a different lexical block, or past the end of the calling subroutine. If a consumer were to assume that it was in the same context as the calling address, the unwind might fail.


reply via email to

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