]> gcc.gnu.org Git - gcc.git/commitdiff
NameFinder.java (blacklist): New static field.
authorBryce McKinlay <mckinlay@redhat.com>
Thu, 11 May 2006 20:53:04 +0000 (20:53 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Thu, 11 May 2006 20:53:04 +0000 (21:53 +0100)
2006-05-11  Bryce McKinlay  <mckinlay@redhat.com>

* gnu/gcj/runtime/NameFinder.java (blacklist): New static field.
(lookup): If addr2line fails to find an address, flag the binary as
having no debug info and avoid calling addr2line on it again.

From-SVN: r113711

libjava/ChangeLog
libjava/gnu/gcj/runtime/NameFinder.java

index b110904c45eceaa95de990f430600ee655836892..fa8be5db688dfb73cceda5e60186f96a38191312 100644 (file)
@@ -1,3 +1,9 @@
+2006-05-11  Bryce McKinlay  <mckinlay@redhat.com>
+
+       * gnu/gcj/runtime/NameFinder.java (blacklist): New static field.
+       (lookup): If addr2line fails to find an address, flag the binary as
+       having no debug info and avoid calling addr2line on it again.
+
 2006-05-11  David Daney  <ddaney@avtrex.com>
 
        * testsuite/libjava.compile/PR20418.java: New.
index 3a31a2d2d9be3891e7bd2ac3ca659815ba0e696d..bfc3e25d34545293cbb8eafcf8a9c4aaae95531b 100644 (file)
@@ -20,8 +20,11 @@ import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.io.IOException;
 import java.io.File;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
 
 
 /**
@@ -54,6 +57,10 @@ public class NameFinder
   private String sourceFile;
   private int lineNum;
   private HashMap procs = new HashMap();
+  /**
+   * Set of binary files that addr2line should not be called on.
+   */
+  private static Set blacklist = Collections.synchronizedSet(new HashSet());
 
   private static final boolean use_addr2line
           = Boolean.valueOf(System.getProperty
@@ -150,7 +157,7 @@ public class NameFinder
     sourceFile = null;
     lineNum = -1;
     
-    if (! use_addr2line)
+    if (! use_addr2line || blacklist.contains(file))
       return;
     Addr2Line addr2line = (Addr2Line) procs.get(file);
     if (addr2line == null)
@@ -179,6 +186,12 @@ public class NameFinder
          String lineNumStr = result.substring(split + 1, result.length());
          lineNum = Integer.parseInt (lineNumStr);
        }
+      else
+        {
+         /* This binary has no debug info (assuming addr was valid). 
+            Avoid repeat addr2line invocations. */
+         blacklist.add(binaryFile);
+       }
       }
     catch (IOException ioe)
       {
This page took 0.074969 seconds and 5 git commands to generate.