[RFA] Fix JVMTI/JDWP Exception Handling

Keith Seitz keiths@redhat.com
Thu May 3 01:21:00 GMT 2007


Tom Tromey wrote:
> One problem with this is that if we have a call chain that goes from
> interpreted code, to compiled code, and back to interpreted, since
> this doesn't look at the dwarf unwind info, I think it can report an
> incorrect result -- namely that the exception will be caught in the
> interpreted frame, when in reality the compiled frame might catch it.
> 
> Do we care?  I realize support for compiled code here is not really
> there anyway...

Well, I think that the spec doesn't care. [Or perhaps it's wishful 
thinking?] Any way, the JVMTI spec says:

"Exception events are generated whenever an exception is first detected 
in a Java programming language method. The exception may have been 
thrown by a Java programming language or native method, but in the case 
of native methods, the event is not generated until the exception is 
first seen by a Java programming language method. If an exception is set 
and cleared in a native method (and thus is never visible to Java 
programming language code), no exception event is generated."

So, perhaps I am reading too much into this (that "wishful thinking" 
thing again), but I read this to mean that any exception event reporting 
from native frames is pretty much ignored (and I *assumed* that meant 
that catch location stuff in native methods is also consequently ignored).

In the description for JVMTI ExceptionCatch event:

"If the exception is caught in a native method, the event is generated 
as soon as control is returned to a Java programming language method."

[Okay, I don't believe my patch covered this case...]

In any case, I don't see how any of the proprietary VMs could possibly 
implement this if they had to do native method analysis to find out 
where the method was caught. Heck, gcj (and other open source VMs) are 
probably in the best position to implement this, but I don't think it 
really makes much sense. The information isn't really all that useful 
anyway.

However, JDWP doesn't use any of the catch method/location information: 
only the throw method/location bits. :-)

Keith



More information about the Java-patches mailing list