re GNATS libgcj/341 (Throwable.printStackTrace() isn't working)
authorBryce McKinlay <bryce@albatross.co.nz>
Mon, 9 Oct 2000 01:54:50 +0000 (01:54 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Mon, 9 Oct 2000 01:54:50 +0000 (02:54 +0100)
2000-10-09  Bryce McKinlay  <bryce@albatross.co.nz>

* include/jvm.h: Enable __builtin_expect().

* name-finder.cc (lookup): Don't trust dladdr() if the address is from
the main program. Fix for PR libgcj/341.

From-SVN: r36794

libjava/ChangeLog
libjava/include/jvm.h
libjava/name-finder.cc

index 9bb268d1374473a13a93d843557b227edba0d71b..0486f6b319525a4e666920bb37feb4b29aad9b66 100644 (file)
@@ -1,3 +1,10 @@
+2000-10-09  Bryce McKinlay  <bryce@albatross.co.nz>
+
+       * include/jvm.h: Enable __builtin_expect().
+       
+        * name-finder.cc (lookup): Don't trust dladdr() if the address is from 
+        the main program. Fix for PR libgcj/341.
+
 2000-10-07  Tom Tromey  <tromey@cygnus.com>
 
        * java/util/Properties.java: Merged with Classpath version.
index f453c9c351d18fb352b306951932f5353dc08d1f..006f1d9adc4d5c329bdb0e3fb618b40f34e8e343 100644 (file)
@@ -11,9 +11,6 @@ details.  */
 #ifndef __JAVA_JVM_H__
 #define __JAVA_JVM_H__
 
-// FIXME: __builtin_expect doesn't work yet.
-#define __builtin_expect(A,B) (A)
-
 #include <gcj/javaprims.h>
 
 #include <java-assert.h>
index 00857934e3eca35a34b59cf8089480b5cb6b15ca..a29f5bd233cbf27984bbbbba77f47e3e22e8cd25 100644 (file)
@@ -136,6 +136,7 @@ _Jv_name_finder::toHex (void *p)
 bool
 _Jv_name_finder::lookup (void *p)
 {
+  extern char **_Jv_argv;
   toHex (p);
       
 #if defined (HAVE_DLFCN_H) && defined (HAVE_DLADDR)
@@ -146,7 +147,10 @@ _Jv_name_finder::lookup (void *p)
       {
        strncpy (file_name, dl_info.dli_fname, sizeof file_name);
        strncpy (method_name, dl_info.dli_sname, sizeof method_name);
-       return true;
+       
+       /* Don't trust dladdr() if the address is from the main program. */
+       if (strcmp (file_name, _Jv_argv[0]) != 0)
+         return true;
       }
   }
 #endif