Updated throwable and stacktrace printing patch
Bryce McKinlay
bryce@waitaki.otago.ac.nz
Tue Aug 20 21:38:00 GMT 2002
Andrew Haley wrote:
>Mark Wielaard writes:
> >
> > I wrote the code assuming that we want our stacktraces to look just like
> > conventional VM stacktraces and I believe this patch does that very
> > nicely. But maybe I have to think outside the box to see what you are
> > proposing here. (My box does not really include C or C++, as you have
> > seen, my main programming experience is with logic/functional languages
> > and some java.)
>
>That's to assume that the "conventional" VM stack trace is, in some
>way, ideal. However, I don't accept that it is ideal in our
>environment where we link to CNI and JNI code and sometimes interact
>with other languages and system interfaces.
>
>My approach to libgcj has been that we should try to do better than
>conventional VMs when we can. I believe that an informative stack
>trace is one such opportunity.
>
I believe that for most GCJ users, it is better that the stack trace
resemble the traditional VM stack trace as closely as possible. The
problem with having too much additional information in there, such as
the PC for each frame, ambiguates the reason for the stack trace:
_quickly_ figuring out where and possibly why an exception occured.
Many people will, in the course of debugging their application, want
more information than the stack trace can provide and can use gdb to get
far more information than a stack trace could ever provide. Thats what
its for!
I accept your argument that it may not be convenient for embedded
developers to use gdb and thus displaying the PC would be useful in an
embedded environment. It also seems reasonable to display the PC in the
event that line number information is unavailable. But in the general
case, the PC is unneccessary information for casual Java developers
which clutters the stack trace.
There should certainly be an option to switch on verbose stack traces
(and in the future we need to do a much better job of documenting
libgcj's knobs), and perhaps it should be the defualt for embedded
targets. But by default, I think simple, clean, stack traces should be
used.
regards
Bryce.
More information about the Java-patches
mailing list