SOLVED: Wrestling with exceptions on win32 gcj 4.1

Ranjit Mathew
Thu Feb 9 06:36:00 GMT 2006

Hash: SHA1

[Caveat: I'm out-of-touch with a whole lot of things, so the
following might be a *bit* inaccurate.]

tHE DPR wrote:
> the stack traces are pretty much unusable though.
> looking into that now.

Does it help if you put the folder containing
"addr2line" and "c++filt" (from binutils) in your
PATH before you run your applications? I'm not
in touch with GCJ/Win32 at all, but once upon a
time, these were necessary to get line numbers
and demangled names (respectively) in stack traces.

>> Is another patch needed to remove the -fomit-frame-pointer you
>> mentioned here? Maybe this is due to a new addition because manual
>> hacking wasn't previously necessary.
> i just didn't find any other way how to do it, so i replaced
> all -fomit-frame-pointer to -fno-omit-frame-pointer in

Without DWARF-2 unwinding information (which is generated when
you do not use SJLJ exceptions), the frame pointer (register
EBP) is the only link that can be used to unwind through
call frames. So I guess you should not use -fomit-frame-pointer
if you want to be able to get stack traces when using SJLJ
exceptions. If you're using DW2 exceptions though, you should
use it on x86-32 at least to free up a valuable register.

>> There is an old patch that unfortunately hit a dead end, but helped with
>> exceptions/stack traces by enabling basic Dwarf2 unwinding on win32
>> (but not across .dll boundaries AFAIK)
> not completely sure what it means. i remember somewhere in another post
> it was told that just callbacks don't work.

When using callbacks in Win32 GUI applications and using DW2
exceptions, the unwinder is not able to unwind from the
callback function all the way back to a suitable exception
handler because the Win32 OS functions do not have any DW2
unwind information associated with them. It is perhaps possible
to work around this by defining a suitable
MD_FALLBACK_FRAME_STATE_FOR, but there seems to be no one with
the requisite knowledge, time and enthusiasm to do this. :-/

DW2 unwind information based exception handling is far superior
(IMHO) to SJLJ-based EH and it would hurt a platform to not
move over to DW2 EH especially for languages like Java where
the general trend is to throw exceptions wily-nily. :-/


- --
Ranjit Mathew      Email: rmathew AT gmail DOT com

Bangalore, INDIA.    Web:

Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla -


More information about the Java mailing list