This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
exceptions: gross hideous hack works, need guru to tell me if I have caused major breakage
- From: Adam Megacz <gcj at lists dot megacz dot com>
- To: java at gcc dot gnu dot org
- Date: 14 Dec 2001 23:34:16 -0800
- Subject: exceptions: gross hideous hack works, need guru to tell me if I have caused major breakage
- Organization: Myself
I've been using OReilly's _Win32 API Programming with Visual Basic_,
because, well, I'd rather use an OReilly book that's intended for the
wrong language than a book by any other publisher that's for the right
one =)
Anyways, there's an exception-handling example where they do little
more than register an exception handler, check the type of the
exception, and then throw a language exception (not an OS exception)
right out of the OS-exception handler.
I tried this, and it works. Incredibly simple, but it works.
I also found code on the mailing list from a while back that had some
rather complex technique for unrolling the stack to the appropriate
java exception handler, then figuring out the appropriate EBP/EIP/ESP
values for that handler and returning them from the signal handler,
along with instructions to the OS saying "take these register values
and resume from there". Unfortunately it used an interface to GCC's
exception logic that no longer works.
So I'm wondering which of these is true:
1) I've done something horribly wrong, and it will come back to bite
me when I start incurring NullPointerExceptions in larger programs
2) The author of the old SEGV-to-NullPointerException code did
something way more complex than was required. Perhaps this is
because you can't just throw a language-level exception out of a
POSIX exception handler, but you _can_ do this on Win32?
3) What I've done works, but yields invalid stack traces (which don't
work on Win32 anyways due to SJLJ, so it's all moot).
Anyways, I know very, very little about signal handlers, either on
POSIX or Win32, but my gross hack works, and I'd appreciate input from
somebody who knows more than me on whether I need to take a closer
look at this.
- a