* elfread.c (elf_symtab_read): Change storage_needed,
authorIan Lance Taylor <ian@airs.com>
Wed, 30 Mar 1994 22:10:18 +0000 (22:10 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 30 Mar 1994 22:10:18 +0000 (22:10 +0000)
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.

gdb/ChangeLog
gdb/elfread.c
gdb/nlmread.c

index bc90023eb84d81f9c6c464ead5b1fe79e27503b6..da77cffa480015d62755a70e9cfab70300626382 100644 (file)
@@ -1,3 +1,11 @@
+Wed Mar 30 16:14:27 1994  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
+
+       * 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.
+
 Wed Mar 30 11:43:29 1994  Jim Kingdon  (kingdon@lioth.cygnus.com)
 
        * xcoffread.c (xcoff_next_symbol_text): New function.
index 5e8292c67aedd3a5e77e38d347e72b7f937154c0..89df794af2ce81581346b39b1fa1b0e1a1a3e854 100644 (file)
@@ -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];
index 218f293eddaf4bcbc50a8452743705e8f075b0bf..79dcfe3f79befd2c7e20812937bcc1db66f040ec 100644 (file)
@@ -119,21 +119,27 @@ nlm_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;
   struct cleanup *back_to;
   CORE_ADDR symaddr;
   enum minimal_symbol_type ms_type;
   
-  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); 
+      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++)
        {