This would be really helpful. 2007/10/15, Gregory Shimansky <[EMAIL PROTECTED]>: > > Oliver Deakin wrote: > > 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? > > I wonder if simply adding > > if ((*env)->ExceptionCheck(env)) > (*env)->ExceptionDescribe(env); > > is enough to print out stack trace in the main thread without violating > the spec. > > > -- > Gregory > >
-- Sean Qiu China Software Development Lab, IBM
