This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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: [MinGW] RFC/RFA: Get Partial Stack Traces on Windows


Ranjit Mathew wrote:
That function has just three independent sections (with my patch):

  1. If the frame is from the interpreter.
  2. If the target has a working dladdr().
  3. If the target is Windows.

It's neatly separated in my opinion but I can change it if you
want me to. The problem is that I will have to anyway copy over
the code for #1 above, so I can't escape the #ifdef-ing. Moreover,
since this is stack tracing code, it belongs (again, in my opinion)
to stacktrace.cc more than it does elsewhere.

I was thinking you'd just move out the windows-specific part to a "platform_getLineNumberForFrame()" (or whatever), which would be called from getLineNumberForFrame() after the interpreter-specific code. I agree, we don't want to duplicate the interpreter part of the code.
By the way Bryce, in fallback_backtrace() why do you set the IP of
the faulting instruction to be the operand part of a "CALL <XYZ>"
instruction instead of the actual beginning of the instruction? You
then compensate for it in getLineNumberForFrame() by decrementing
the offset by one. Is it because the DWARF-2 unwinder has the
same curious behaviour?

Actually I didn't write fallback_backtrace(), that code was already there - but this sounds about right. The Dwarf-2 unwinder normally gives us the return address, which needs to be rolled back in order to get the correct line number. But, in the case of a frame where a fault occurred, it gives the address of the faulting instruction. I think there is actually a slight bug with this on Dwarf-2 since the "decrement the offset by one" isn't correct for a segfault/NullPointerException frame, so sometimes we get the wrong line number.


Bryce


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