aboutsummaryrefslogtreecommitdiff
path: root/gdb/elfread.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-03-30 22:10:18 +0000
committerIan Lance Taylor <ian@airs.com>1994-03-30 22:10:18 +0000
commit70f42bae0b1b4d71dfa1b0da6a29d1e82053b118 (patch)
tree405c7bf6cdf03b271cdef51c0b4733c726a9318f /gdb/elfread.c
parentbd7fc39d753fe063c4cfbeffbf75b282891c6756 (diff)
downloadgdb-70f42bae0b1b4d71dfa1b0da6a29d1e82053b118.zip
gdb-70f42bae0b1b4d71dfa1b0da6a29d1e82053b118.tar.gz
gdb-70f42bae0b1b4d71dfa1b0da6a29d1e82053b118.tar.bz2
* elfread.c (elf_symtab_read): Change storage_needed,
number_of_symbols and i to long. Rename get_symtab_upper_bound to bfd_get_symtab_upper_bound. Check for errors from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab. * nlmread.c (nlm_symtab_read): Same changes.
Diffstat (limited to 'gdb/elfread.c')
-rw-r--r--gdb/elfread.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 5e8292c..89df794 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -244,11 +244,11 @@ elf_symtab_read (abfd, addr, objfile)
CORE_ADDR addr;
struct objfile *objfile;
{
- unsigned int storage_needed;
+ long storage_needed;
asymbol *sym;
asymbol **symbol_table;
- unsigned int number_of_symbols;
- unsigned int i;
+ long number_of_symbols;
+ long i;
int index;
struct cleanup *back_to;
CORE_ADDR symaddr;
@@ -263,12 +263,18 @@ elf_symtab_read (abfd, addr, objfile)
objfile->sym_stab_info;
unsigned long size;
- storage_needed = get_symtab_upper_bound (abfd);
+ storage_needed = bfd_get_symtab_upper_bound (abfd);
+ if (storage_needed < 0)
+ error ("Can't read symbols from %s: %s", bfd_get_filename (abfd),
+ bfd_errmsg (bfd_get_error ()));
if (storage_needed > 0)
{
symbol_table = (asymbol **) xmalloc (storage_needed);
back_to = make_cleanup (free, symbol_table);
- number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
+ number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
+ if (number_of_symbols < 0)
+ error ("Can't read symbols from %s: %s", bfd_get_filename (abfd),
+ bfd_errmsg (bfd_get_error ()));
for (i = 0; i < number_of_symbols; i++)
{
sym = symbol_table[i];