aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-12-28 01:44:21 +0000
committerFred Fish <fnf@specifix.com>1992-12-28 01:44:21 +0000
commit51db2323667f1495d8c51b72bc32e3498418f3c4 (patch)
treebad8e0452f45fa05f83d49d3b30088c982974cb0 /gdb
parent1169c958034a9cc0cd94acecd104b89243c15ba8 (diff)
downloadfsf-binutils-gdb-51db2323667f1495d8c51b72bc32e3498418f3c4.zip
fsf-binutils-gdb-51db2323667f1495d8c51b72bc32e3498418f3c4.tar.gz
fsf-binutils-gdb-51db2323667f1495d8c51b72bc32e3498418f3c4.tar.bz2
* 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/dbxread.c9
-rw-r--r--gdb/symfile.c35
3 files changed, 42 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8254fd5..d062e41 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+Sun Dec 27 17:34:15 1992 Fred Fish (fnf@cygnus.com)
+
+ * 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.
+
Sat Dec 26 20:51:41 1992 Fred Fish (fnf@cygnus.com)
* solib.c (BKPT_AT_MAIN): Change to BKPT_AT_SYMBOL.
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 0101a3c..7b3ec79 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -595,7 +595,8 @@ dbx_symfile_init (objfile)
DBX_STRINGTAB_SIZE (objfile) = bfd_h_get_32 (sym_bfd, size_temp);
#endif
- if (DBX_STRINGTAB_SIZE (objfile) <= 0)
+ if (DBX_STRINGTAB_SIZE (objfile) <= 0
+ || DBX_STRINGTAB_SIZE (objfile) > bfd_get_size (sym_bfd))
error ("ridiculous string table size (%d bytes).",
DBX_STRINGTAB_SIZE (objfile));
@@ -603,7 +604,8 @@ dbx_symfile_init (objfile)
(char *) obstack_alloc (&objfile -> psymbol_obstack,
DBX_STRINGTAB_SIZE (objfile));
#ifdef GDB_TARGET_IS_HPPA
- if (HP_STRINGTAB_SIZE (objfile) <= 0)
+ if (HP_STRINGTAB_SIZE (objfile) <= 0
+ || HP_STRINGTAB_SIZE (objfile) > bfd_get_size (sym_bfd))
error ("ridiculous string table size (%d bytes).",
HP_STRINGTAB_SIZE (objfile));
@@ -2095,7 +2097,8 @@ elfstab_build_psymtabs (objfile, section_offsets, mainline,
DBX_STRINGTAB_SIZE (objfile) = stabstrsize;
DBX_SYMTAB_OFFSET (objfile) = staboffset;
- if (stabstrsize < 0) /* FIXME: stabstrsize is unsigned; never true! */
+ if (stabstrsize < 0 /* FIXME: stabstrsize is unsigned; never true! */
+ || stabstrsize > bfd_get_size (sym_bfd))
error ("ridiculous string table size: %d bytes", stabstrsize);
DBX_STRINGTAB (objfile) = (char *)
obstack_alloc (&objfile->psymbol_obstack, stabstrsize+1);
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