This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: New stack trace code
Now that we have full line number info for shared libraries, it seems
that calls to addr2line are taking far too much time in any
application that does much logging.
We need a way to disable line number info, even when we have our own
built-in dwarf reader.
Something like this, perhaps.
Andrew.
Index: stacktrace.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/stacktrace.cc,v
retrieving revision 1.4
diff -c -u -r1.4 stacktrace.cc
cvs diff: conflicting specifications of output style
--- stacktrace.cc 21 Mar 2005 14:50:07 -0000 1.4
+++ stacktrace.cc 21 Mar 2005 16:22:15 -0000
@@ -22,12 +22,14 @@
#include <stdio.h>
#include <java/lang/Class.h>
+#include <java/lang/System.h>
#include <java/lang/Long.h>
#include <java/util/ArrayList.h>
#include <java/util/IdentityHashMap.h>
#include <gnu/java/lang/MainThread.h>
#include <gnu/gcj/runtime/NameFinder.h>
+
#include <sysdep/backtrace.h>
using namespace java::lang;
@@ -269,6 +271,10 @@
_Jv_StackTrace::GetStackTraceElements (_Jv_StackTrace *trace,
Throwable *throwable __attribute__((unused)))
{
+ jboolean debug = ! (JvNewStringUTF ("no")->equals
+ (java::lang::System::getProperty
+ (JvNewStringUTF ("gnu.gcj.stacktrace.source"))));
+
ArrayList *list = new ArrayList ();
#ifdef SJLJ_EXCEPTIONS
@@ -342,8 +348,9 @@
jstring sourceFileName = NULL;
jint lineNum = -1;
-
- getLineNumberForFrame(frame, finder, &sourceFileName, &lineNum);
+
+ if (debug)
+ getLineNumberForFrame(frame, finder, &sourceFileName, &lineNum);
StackTraceElement *element = new StackTraceElement (sourceFileName, lineNum,
className, methodName, 0);