This is the mail archive of the java-patches@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Fix PR libgcj/341


This patch fixes Throwable.printStackTrace() on Red Hat 7.0

regards

  [ bryce ]


2000-10-06  Bryce McKinlay  <bryce@albatross.co.nz>

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

Index: name-finder.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/name-finder.cc,v
retrieving revision 1.4
diff -u -r1.4 name-finder.cc
--- name-finder.cc	2000/05/30 23:26:02	1.4
+++ name-finder.cc	2000/10/06 05:34:30
@@ -136,6 +136,7 @@
 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 @@
       {
 	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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]