aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2000-12-04 15:55:09 +0000
committerKevin Buettner <kevinb@redhat.com>2000-12-04 15:55:09 +0000
commitbbeae047395eba4cd967ac6043d9ed5aa72cecb0 (patch)
tree8f65657ba2945f05b320c123f9293638f0d7cc42
parent6227bc851d73cda21a6f0e7a39780c1ad7eb1116 (diff)
downloadgdb-bbeae047395eba4cd967ac6043d9ed5aa72cecb0.zip
gdb-bbeae047395eba4cd967ac6043d9ed5aa72cecb0.tar.gz
gdb-bbeae047395eba4cd967ac6043d9ed5aa72cecb0.tar.bz2
Fix dwarf2read.c related crash in which section index was not being
initialized properly.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/elfread.c27
2 files changed, 11 insertions, 23 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fee3207..17221bb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2000-12-04 Kevin Buettner <kevinb@redhat.com>
+
+ * elfread.c (record_minimal_symbol_and_info): Don't guess
+ at the section index; instead just always use the bfd index.
+ (elf_symtab_read): Handle weak symbols appearing in data
+ sections.
+
Mon Dec 4 14:36:39 2000 Andrew Cagney <cagney@b1.cygnus.com>
* gdbarch.sh (STAB_REG_TO_REGNUM, ECOFF_REG_TO_REGNUM,
diff --git a/gdb/elfread.c b/gdb/elfread.c
index b964552..a7d5009 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -171,32 +171,13 @@ record_minimal_symbol_and_info (char *name, CORE_ADDR address,
enum minimal_symbol_type ms_type, char *info, /* FIXME, is this really char *? */
asection *bfd_section, struct objfile *objfile)
{
- int section;
-
- /* Guess the section from the type. This is likely to be wrong in
- some cases. */
- switch (ms_type)
- {
- case mst_text:
- case mst_file_text:
- section = bfd_section->index;
#ifdef SMASH_TEXT_ADDRESS
- SMASH_TEXT_ADDRESS (address);
+ if (ms_type == mst_text || ms_type == mst_file_text)
+ SMASH_TEXT_ADDRESS (address);
#endif
- break;
- case mst_data:
- case mst_file_data:
- case mst_bss:
- case mst_file_bss:
- section = bfd_section->index;
- break;
- default:
- section = -1;
- break;
- }
return prim_record_minimal_symbol_and_info
- (name, address, ms_type, info, section, bfd_section, objfile);
+ (name, address, ms_type, info, bfd_section->index, bfd_section, objfile);
}
/*
@@ -423,7 +404,7 @@ elf_symtab_read (struct objfile *objfile, int dynamic)
}
else if (sym->section->flags & SEC_ALLOC)
{
- if (sym->flags & BSF_GLOBAL)
+ if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
{
if (sym->section->flags & SEC_LOAD)
{