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
+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.
#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>
bool
_Jv_name_finder::lookup (void *p)
{
+ extern char **_Jv_argv;
toHex (p);
#if defined (HAVE_DLFCN_H) && defined (HAVE_DLADDR)
{
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