aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Daney <ddaney@avtrex.com>2006-06-06 17:00:16 +0000
committerDavid Daney <daney@gcc.gnu.org>2006-06-06 17:00:16 +0000
commit696dad4b6bbaf23576e59546d1bd3e93dd0e96c4 (patch)
treee86d94df433101038a6e23099459185aff9d2089
parentc02174abd15428eaa2a47df5a1ca6dbbcc1703de (diff)
downloadgcc-696dad4b6bbaf23576e59546d1bd3e93dd0e96c4.zip
gcc-696dad4b6bbaf23576e59546d1bd3e93dd0e96c4.tar.gz
gcc-696dad4b6bbaf23576e59546d1bd3e93dd0e96c4.tar.bz2
gcj.texi (libgcj Runtime Properties): Document gnu.gcj.runtime.NameFinder.show_raw and...
2006-06-05 David Daney <ddaney@avtrex.com> * gcj.texi (libgcj Runtime Properties): Document gnu.gcj.runtime.NameFinder.show_raw and gnu.gcj.runtime.NameFinder.remove_unknown. 2006-06-05 David Daney <ddaney@avtrex.com> * gnu/gcj/runtime/NameFinder.java (show_raw): New field. (showRaw): New method. * stacktrace.cc : Include gnu/gcj/runtime/StringBuffer.h. (getLineNumberForFrame): Show IP offset in trace if line number not available and show_raw true. From-SVN: r114437
-rw-r--r--gcc/java/ChangeLog6
-rw-r--r--gcc/java/gcj.texi15
-rw-r--r--libjava/ChangeLog8
-rw-r--r--libjava/gnu/gcj/runtime/NameFinder.java20
-rw-r--r--libjava/stacktrace.cc12
5 files changed, 59 insertions, 2 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index e8b7c155..90f275c 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-06 David Daney <ddaney@avtrex.com>
+
+ * gcj.texi (libgcj Runtime Properties): Document
+ gnu.gcj.runtime.NameFinder.show_raw and
+ gnu.gcj.runtime.NameFinder.remove_unknown.
+
2006-06-06 Tom Tromey <tromey@redhat.com>
* jcf-dump.c (print_access_flags): Handle varargs, bridge,
diff --git a/gcc/java/gcj.texi b/gcc/java/gcj.texi
index 2f82d7f..38ae1ab 100644
--- a/gcc/java/gcj.texi
+++ b/gcc/java/gcj.texi
@@ -2793,6 +2793,21 @@ the java.util.logging infrastructure. However, performance may improve
significantly for applications that print stack traces or make logging calls
frequently.
+@item gnu.gcj.runtime.NameFinder.show_raw
+Whether the address of a stack frame should be printed when the line
+number is unavailable. Setting this to @code{true} will cause the name
+of the object and the offset within that object to be printed when no
+line number is available. This allows for off-line decoding of
+stack traces if necessary debug information is available. The default
+is @code{false}, no raw addresses are printed.
+
+@item gnu.gcj.runtime.NameFinder.remove_unknown
+Whether stack frames for non-java code should be included in a stack
+trace. The default value is @code{true}, stack frames for non-java
+code are suppressed. Setting this to @code{false} will cause any
+non-java stack frames to be printed in addition to frames for the java
+code.
+
@item gnu.gcj.runtime.VMClassLoader.library_control
This controls how shared libraries are automatically loaded by the
built-in class loader. If this property is set to @samp{full}, a full
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 76031d5..8117d08 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,11 @@
+2006-06-06 David Daney <ddaney@avtrex.com>
+
+ * gnu/gcj/runtime/NameFinder.java (show_raw): New field.
+ (showRaw): New method.
+ * stacktrace.cc : Include gnu/gcj/runtime/StringBuffer.h.
+ (getLineNumberForFrame): Show IP offset in trace if line number
+ not available and show_raw true.
+
2006-06-06 Gary Benson <gbenson@redhat.com>
* java/io/natFilePosix.cc (getCanonicalPath): Rewritten.
diff --git a/libjava/gnu/gcj/runtime/NameFinder.java b/libjava/gnu/gcj/runtime/NameFinder.java
index e43886f..0742af1 100644
--- a/libjava/gnu/gcj/runtime/NameFinder.java
+++ b/libjava/gnu/gcj/runtime/NameFinder.java
@@ -67,13 +67,29 @@ public class NameFinder
("gnu.gcj.runtime.NameFinder.use_addr2line", "true")
).booleanValue();
+ private static boolean show_raw
+ = Boolean.valueOf(System.getProperty
+ ("gnu.gcj.runtime.NameFinder.show_raw", "false")
+ ).booleanValue();
+
+ /**
+ * Return true if raw addresses should be printed in stacktraces
+ * when no line number information is available.
+ */
+ static final boolean showRaw()
+ {
+ return show_raw;
+ }
+
private static final boolean remove_unknown
= Boolean.valueOf(System.getProperty
("gnu.gcj.runtime.NameFinder.remove_unknown", "true")
).booleanValue();
- // Return true if non-Java frames should be removed from stack
- // traces.
+ /**
+ * Return true if non-Java frames should be removed from stack
+ * traces.
+ */
static final boolean removeUnknown()
{
return remove_unknown;
diff --git a/libjava/stacktrace.cc b/libjava/stacktrace.cc
index 6423bbd8..5d429e6 100644
--- a/libjava/stacktrace.cc
+++ b/libjava/stacktrace.cc
@@ -27,6 +27,7 @@ details. */
#include <java/util/IdentityHashMap.h>
#include <gnu/java/lang/MainThread.h>
#include <gnu/gcj/runtime/NameFinder.h>
+#include <gnu/gcj/runtime/StringBuffer.h>
#include <sysdep/backtrace.h>
#include <sysdep/descriptor.h>
@@ -221,6 +222,17 @@ _Jv_StackTrace::getLineNumberForFrame(_Jv_StackFrame *frame, NameFinder *finder,
finder->lookup (binaryName, (jlong) offset);
*sourceFileName = finder->getSourceFile();
*lineNum = finder->getLineNum();
+ if (*lineNum == -1 && NameFinder::showRaw())
+ {
+ gnu::gcj::runtime::StringBuffer *t =
+ new gnu::gcj::runtime::StringBuffer(binaryName);
+ t->append ((jchar)' ');
+ t->append ((jchar)'[');
+ // + 1 to compensate for the - 1 adjustment above;
+ t->append (Long::toHexString (offset + 1));
+ t->append ((jchar)']');
+ *sourceFileName = t->toString();
+ }
}
#endif
}