gcj.texi (libgcj Runtime Properties): Document gnu.gcj.runtime.NameFinder.show_raw...
authorDavid Daney <ddaney@avtrex.com>
Tue, 6 Jun 2006 17:00:16 +0000 (17:00 +0000)
committerDavid Daney <daney@gcc.gnu.org>
Tue, 6 Jun 2006 17:00:16 +0000 (17:00 +0000)
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

gcc/java/ChangeLog
gcc/java/gcj.texi
libjava/ChangeLog
libjava/gnu/gcj/runtime/NameFinder.java
libjava/stacktrace.cc

index e8b7c155cf0fa57fdbc330807080bac48f64f944..90f275ce32c85fa34c7a461580c63d8e09074376 100644 (file)
@@ -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,
index 2f82d7f981bc45c2652bde9d69507befbf1dcce4..38ae1abeaace6c805d1e470f2450d72ee0fc4690 100644 (file)
@@ -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
index 76031d52572ee525471477302e686fbf1f457805..8117d0871eff5cca74cf04c9dda51a4a883cb56d 100644 (file)
@@ -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.
index e43886feb4cc7c20c1c8caa2acaef7e9e3147f47..0742af193bc4389708c72a9b5b0c9ca245b49e6f 100644 (file)
@@ -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;
index 6423bbd87022d3b1018593727e2b1e6e22548732..5d429e67d145c6e2ab79b08c46ab8041dd6420fe 100644 (file)
@@ -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
 }