Question about POSIX libgcj signals / exception handling

Andrew Haley aph@redhat.com
Sat Mar 11 17:26:00 GMT 2006


Mohan Embar writes:

 > Are the signal handlers in POSIX libgcj set up such that the
 > application is bulletproof and immune from core dumps? Even if I do
 > native stuff where I divide by zero or dereference invalid
 > pointers?  I'm not overly experienced with POSIX signal handling
 > and was wondering if a try...catch block in my main() method was
 > sufficient enough to catch all mishaps, even native ones. Also, are
 > there any restrictions or caveats concerning what I can do when
 > reacting to exceptions triggered by such signals (as opposed to
 > "normal" Java exceptions)?

Just one thing to add to David's comments: this isn't POSIX, and only
works because you have detailed knowledge of the operating system.
Exactly what you can do in a signal handler depends on the OS, not
some abstract standard like POSIX.

 > I seem to recall from the little UNIX
 > programming I've done that you shouldn't do too much in a signal
 > handler.

Right, but this isn't UNIX, it's Linux.  Usually that difference
doesn't matter, but in this case it does.  MD_FALLBACK_FRAME_STATE_FOR
has to be OS-specific.

Andrew.



More information about the Java mailing list