This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
name-finder fix
- To: java-patches at gcc dot gnu dot org
- Subject: name-finder fix
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- Date: Tue, 16 Oct 2001 20:32:07 +1300
Since upgrading to glibc 2.2.4, my stack traces started crashing. Looks
like dladdr is now returning a null dl_sname for a symbol not
dynamically exported (ie in the main program), which is probibly what it
should have been doing all along. This patch fixes. I'm checking it into
the branch as well since it is obvious and zero-risk.
regards
Bryce.
2001-10-16 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* name-finder.cc (_Jv_name_finder::lookup): Check for NULL dli_sname.
Index: name-finder.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/name-finder.cc,v
retrieving revision 1.7
diff -u -r1.7 name-finder.cc
--- name-finder.cc 2001/08/26 10:09:59 1.7
+++ name-finder.cc 2001/10/16 07:24:42
@@ -147,10 +147,12 @@
{
if (dl_info.dli_fname)
strncpy (file_name, dl_info.dli_fname, sizeof file_name);
- strncpy (method_name, dl_info.dli_sname, sizeof method_name);
+ if (dl_info.dli_sname)
+ strncpy (method_name, dl_info.dli_sname, sizeof method_name);
/* Don't trust dladdr() if the address is from the main program. */
if (dl_info.dli_fname != NULL
+ && dl_info.dli_sname != NULL
&& (_Jv_argv == NULL || strcmp (file_name, _Jv_argv[0]) != 0))
return true;
}