This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] java run-time stack trace
- To: gcc-patches at gcc dot gnu dot org, java at gcc dot gnu dot org
- Subject: [patch] java run-time stack trace
- From: Per Bothner <per at bothner dot com>
- Date: 07 Feb 2001 20:06:51 -0800
If you call printStackTrace() on a Throwable, the output is demangled
in C++-style:
at 0x40182616: java::lang::Class::forName(java::lang::String *, java::lang::ClassLoader *) (/home/bothner/GNU/linux/lib/libgcj.so.1)
We probably want:
at 0x40182616: java.lang.Class.forName(java.lang.String, java.lang.ClassLoader) (/home/bothner/GNU/linux/lib/libgcj.so.1)
This patch accomplishes that. It does have the undesirable side-effect that
C or C++ functions are are written Java-style (i.e no * or ::):
at 0x40186645: _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/home/bothner/GNU/linux/lib/libgcj.so.1)
but I think that is reasonable enough for a Java stack printer.
Any objections to checking this in (now, before the branch)?
I believe glibc includes a demangler. It would be better to use that
when available but that requires some configury magic.
2001-02-07 Per Bothner <per@bothner.com>
* java/lang/Throwable.java (CPlusPlusDemangler): Pass -s java to
c++filt to select java-style output.
Index: Throwable.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/Throwable.java,v
retrieving revision 1.9
diff -u -r1.9 Throwable.java
--- Throwable.java 2000/12/22 06:19:24 1.9
+++ Throwable.java 2001/02/08 03:46:46
@@ -57,7 +57,7 @@
CPlusPlusDemangler (PrintWriter writer) throws IOException
{
p = writer;
- proc = Runtime.getRuntime ().exec ("c++filt");
+ proc = Runtime.getRuntime ().exec ("c++filt -s java");
procOut = proc.getOutputStream ();
procIn = proc.getInputStream ();
}
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/