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] DWARF-2 unwinder off-by-one problem with signal frames

Richard Henderson wrote:

> At present the fix is to not do *anything* different in the unwinder.

This is unfortunate, in particular as we now rely on the unwinder
even to produce stack backtraces (which should most especially work
from within a SIGSEGV handler ...).

> It's the responsibility of the signal handler to distinguish between
> the case of a signal that points to the beginning of the trapping
> insn (SEGV), and one that points to the end (FPE).  See all the
> frobbing that goes on in libjava to handle these cases.
> I'll admit that it would be more ideal for the user if this were
> all done automatically, but given the amount of variance in behaviour
> of signals on different platforms, I don't know how to do this.

This will certainly have to be handled in platform specific code.
However, if we assume that the platform *has* the information 
required to decide whether the RA points to the begin or end of
the trapping insn, one possible implementation would be a new
flag in _Unwind_FrameState that MD_FALLBACK_FRAME_STATE_FOR
could set to indicate the former case.  Common unwind-dw.c code
would then simply need to consider that flag.

(In the case of RT signals, where the signal number is actually
stored as part of the siginfo_t on the stack, most platforms
should be able to make that decision correctly.  For non-RT
signal frames it gets more difficult, of course.)

Should I go ahead and try to implement a solution along these lines?


  Dr. Ulrich Weigand

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