From 51db2323667f1495d8c51b72bc32e3498418f3c4 Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Mon, 28 Dec 1992 01:44:21 +0000 Subject: * dbxread.c (dbx_symfile_init, elfstab_build_psymtabs): Call new bfd_get_size() and verify that string table is no larger than the file that is supposed to contain it. * symfile.c (syms_from_objfile): Only complain about configured NAMES_HAVE_UNDERSCORE differences between gdb and bfd if the current target is the default BFD target. --- gdb/symfile.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'gdb/symfile.c') diff --git a/gdb/symfile.c b/gdb/symfile.c index 1c8fe1d..b09c691 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -440,21 +440,40 @@ syms_from_objfile (objfile, addr, mainline, verbo) addr -= bfd_section_vma (objfile->obfd, lowest_sect); } + { /* Debugging check inserted for testing elimination of NAMES_HAVE_UNDERSCORE. Complain if the dynamic setting of NAMES_HAVE_UNDERSCORE from BFD - doesn't match the static setting from the GDB config files. + doesn't match the static setting from the GDB config files, but only + if we are using the first BFD target (the default target selected by + the same configuration that decided whether NAMES_HAVE_UNDERSCORE is + defined or not). For other targets (such as when the user sets GNUTARGET + or we are reading a "foreign" object file), it is likely that the value + of bfd_get_symbol_leading_char has no relation to the value of + NAMES_HAVE_UNDERSCORE for the target for which this gdb was built. + Hack alert: the only way to currently do this with bfd is to ask it to + produce a list of known target names and compare the first one in the + list with the one for the bfd we are using. FIXME: Remove this check after a round of testing. -- gnu@cygnus.com, 16dec92 */ + char **targets = bfd_target_list (); + if (targets != NULL && *targets != NULL) + { + if (bfd_get_symbol_leading_char (objfile->obfd) != #ifdef NAMES_HAVE_UNDERSCORE - if (bfd_get_symbol_leading_char(objfile->obfd) != '_') + '_' #else - if (bfd_get_symbol_leading_char(objfile->obfd) != 0) + 0 #endif - fprintf (stderr, - "GDB internal error! NAMES_HAVE_UNDERSCORE set wrong for %s BFD:\n%s\n", - objfile->obfd->xvec->name, - objfile->obfd->filename); - /* End of debugging check. FIXME. */ + && STREQ (bfd_get_target (objfile->obfd), *targets)) + { + fprintf (stderr, "GDB internal error! NAMES_HAVE_UNDERSCORE set wrong for %s BFD:\n%s\n", + bfd_get_target (objfile->obfd), + bfd_get_filename (objfile->obfd)); + } + free (targets); + } + /* End of debugging check. FIXME. */ + } /* Initialize symbol reading routines for this objfile, allow complaints to appear for this new file, and record how verbose to be, then do the -- cgit v1.1