This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Re: Throwable.printStackTrace ()
- To: bryce at albatross dot co dot nz
- Subject: Re: Throwable.printStackTrace ()
- From: Andrew Haley <aph at pasanda dot cygnus dot co dot uk>
- Date: 19 Jan 2000 11:16:06 -0000
- CC: java-patches at sourceware dot cygnus dot com
> Date: Wed, 19 Jan 2000 18:28:02 +1300
> From: Bryce McKinlay <bryce@albatross.co.nz>
>
> Andrew Haley wrote:
>
> > I've checked in code to print stack traces. It's not yet perfect, but
> > I figured that it's such a useful debugging tool that it makes no
> > sense to wait for perfection.
>
> Very cool!!
>
> One comment I would have is that the output may be a bit more verbose than
> needed. For example, consider the following stack traces produced by a simple
> test program, running under both the IBM VM and gcj:
Sure, our stack trace gives so much more information than the IBM VM.
That's a feature! I wasn't trying to emulate what Sun do, but to do
something better.
> $ java ExceptionTest
> java.lang.Exception
> at ExceptionTest.bar(ExceptionTest.java:23)
> at ExceptionTest.foo(ExceptionTest.java:18)
> at ExceptionTest.main(ExceptionTest.java:8
>
> $ ./exceptiontest
> java.lang.Exception
> at 0x400caa48: __Q34java4lang9Throwable (/usr/local/gcc/lib/libgcj.so.1)
> at 0x400beafb: __Q34java4lang9Exception (/usr/local/gcc/lib/libgcj.so.1)
> at 0x0804b2bb: ExceptionTest::bar(int)
> (/home/bryce/projects/tests/ExceptionTest.java:22)
> at 0x0804b286: ExceptionTest::foo(void)
> (/home/bryce/projects/tests/ExceptionTest.java:18)
> at 0x0804b217: ExceptionTest::main(JArray<java::lang::String *> *)
> (/home/bryce/projects/tests/ExceptionTest.java:8)
> at 0x4010ca30: run__Q34java4lang11FirstThread
> (/usr/local/gcc/lib/libgcj.so.1)
> at 0x400c81b2: run___Q34java4lang6Thread (/usr/local/gcc/lib/libgcj.so.1)
> at 0x40111fea: run____Q34java4lang6ThreadPQ34java4lang6Object
> (/usr/local/gcc/lib/libgcj.so.1)
> at 0x401222e2: _Jv_ThreadSetPriority__FP12_Jv_Thread_ti
> (/usr/local/gcc/lib/libgcj.so.1)
> at 0x401d0c56: GC_start_routine (/usr/local/gcc/lib/libgcjgc.so.1)
> at 0x401e6eca: pthread_detach (/lib/libpthread.so.0)
>
> Hmm. I suggest that first two lines and everything below main() are
> redundant for the vast majority of debugging tasks.
Perhaps, but don't forget that one of the things stack traces will be
used for is sending bug reports to the mailing list, where such info
is valuable. We could certainly lose the first two lines, but the
function signatures are very useful, and I very much like the fact
that you can see where the thread started.
Also, I have a bias because I get to debug the exception handler
mechanism!
> And how useful is having the address?
Hmm. Without the address you would not be able to distinguish between
identical static symbols.
Andrew.