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: Fix backtrace for interpreted code


>  > >Surely it's better to fix MD_FALLBACK_FRAME_STATE_FOR to unwind
>  > >through SEH frames.  That would bring many benefits.
>  >
>  > Indeed. If we want proper stack traces on Windows - particularly
>  > ones that are good enough for the security model, this must be
>  > done.
> 
> There's example code at
> http://www.jorgon.freeserve.co.uk/ExceptFrame.htm.  There are more
> examples and some patches on the net.  As I see it, we don't need to
> provide full SEH support, only to unwind through an SEH frame.  Is
> there some specific problem anyone here knows about?

(Disclaimer: I have not worked on the Win32 port in
more than a year now.)

I think there's a mix-up here. If we are wondering
why MinGW/Cygwin doesn't use DWARF-2 EH
by default, it is not simply because of SEH frames.

The primary issue (as I recall it) is that DWARF-2
based unwinding cannot handle "alien" frames
on the call stack - all the callers from the handler
down to the offending method must be compiled
with DWARF-2 EH enabled. This is true for any
platform and not just Win32.

It so happens that GCC on Win32 is used quite
a bit to create GUI applications, where callback
methods are where all the action (including
an unfortunate exception) happens - if such a method 
throws an exception, the EH runtime support has to
unwind through user written code *as well as
Win32 OS code* which of course has not been
compiled with a DW2-EH enabled GCC and
therefore causes the program to abort.

SJLJ based EH does not suffer from this
problem and therefore, the MinGW GCC
maintainers decided to use it by default, 
even though DWARF-2 EH was superior
in every other way.

Assuming that the Win32 OS code has not
been compiled using the equivalent of
"-fomit-frame-pointer", it might be possible
to backtrack using the frame pointer till we
reach a method with a DWARF-2 FDE, but
to my knowledge no one has done it yet.
(This of course will have to be done in
MD_FALLBACK_FRAME_STATE_FOR.)

Someone more knowledgeable please
correct me if I've stated something wrong.

Ranjit.


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