Updated throwable and stacktrace printing patch

Mark Wielaard mark@klomp.org
Mon Aug 12 14:05:00 GMT 2002


Hi,

The following is a cleaned up version of the patch that I submitted a
while ago. <http://gcc.gnu.org/ml/java-patches/2002-q3/msg00084.html>
Please read that thread for the motivation, suggestions for improvement
and an example of a nice stack trace.

Changes since that version:
- Much more testing with multiple combinations of missing/broken
external programs. Including the addr2name.awk script. This resulted in
no longer using PrintStream since it hides errors and a few cleanups for
better handling 'unexpected' exceptions, null and/or empty Strings.
- Better sanitizeStack() heuristics which should always give a
meaningful stacktrace now (but you can always disable any or all
StackTraceElement processing by setting the appropriate system
properties if desired).
- natThrowable.cc removed and renamed to natVMThrowable.cc
- The native stacktrace is now stored as gnu.gcj.RawData and only
converted to longs when needed.

2002-08-12  Mark Wielaard  <mark@klomp.org>

    * Makefile.am (libgcj_la_SOURCES): Remove name-finder.cc.
    (core_java_source_files): Add VMThrowable.java and NameFinder.java
    (nat_source_files): Remove natThrowable.cc, add natVMThrowable.cc
    and natNameFinder.cc.
    * Makefile.in: Regenerate.
    * prims.cc: Use trace_enabled from VMThrowable.
    * name-finder.cc: Removed.
    * gcj/javaprims.h: Add class VMThrowable.
    * gnu/gcj/runtime/NameFinder.java: New file.
    * gnu/gcj/runtime/natNameFinder.cc: Likewise.
    * include/name-finder.h: Removed.
    * java/lang/Throwable.java (printStackTrace (PrintStream)): Use new
    method stackTraceString().
    (printStackTrace (PrintWriter)): Likewise.
    (stackTraceString): Complete rewrite of old printStackTrace using
    StringBuffer.
    (stackTraceStringBuffer): New helper method for stackTraceString().
    (fillInStackTrace): Delegate to VMTrowable.
    (getStackTrace): Likewise.
    (getStackTrace0): Removed. 
    (trace_enabled, stackTraceBytes): Moved to new VMThrowable.java.
    * java/lang/natThrowable.cc: Removed (replaced by natVMThrowable).
    * java/lang/VMThrowable.java: New class.
    * java/lang/natVMThrowable.cc: New file.

Tested on i686-pc-linux-gnu and currently building and testing on
powerpc-unknown-linux-gnu. OK to commit if build and tests are
successful?

Cheers,

Mark

-------------- next part --------------
A non-text attachment was scrubbed...
Name: exception.patch
Type: text/x-patch
Size: 32794 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20020812/8196d9b0/attachment.bin>


More information about the Java-patches mailing list