Hi all,
A little while back there was a thread called "[drlvm] Should the
launcher print uncaught exceptions?" [1] where we discussed the fact
that running a test case like [2] did not print a stack trace with the
Harmony launcher. As part of this discussion, HARMONY-1819 was raised
and the line "(*jvm)->DetachCurrentThread(jvm)" was added to the
launcher main.c in repo revision r464443.
HARMONY-3713 was later raised pointing out that calling
DetachCurrentThread() to detach the main thread was contrary to the spec
[3], and the line was removed from main.c. However, I have just noticed
that if you run [2] on the current J9 VME (and, in fact, on the RI with
a simple launcher) you do not get any stack trace printed, and I imagine
this has been the case since the commit of HARMONY-3713.
The RI has a bug [4], contrary to the spec [3], which requires
DetachCurrentThread() to be called by the invoking launcher if you wish
to see the stack trace of an uncaught exception. It appears that J9 has
matched this bug, probably so no unexpected trace is printed in
launchers programmed against the RI.
So currently running Harmony classlib with the J9 VME will not result in
any stack trace being printed for uncaught exceptions, which makes
debugging issues where that occurs more troublesome. Id like to propose
that the DetachCurrentThread() line be readded to main.c (i.e. the
opposite of the patch for HARMONY-3713), perhaps with a comment to show
that this is to match the behaviour of the RI rather than the spec.
Any objections?
Regards,
Oliver
[1]
http://mail-archives.apache.org/mod_mbox/harmony-dev/200609.mbox/[EMAIL PROTECTED]
[2]
public class HelloWorld {
public static void main(String[] args) {
throw new RuntimeException("hello");
}
}
[3]
http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/invocation.html#wp16553
[4] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4992454
--
Oliver Deakin
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU