* Makefile.in (dbxread.o): Note new dependency on $(gdb_assert_h).
authorJim Blandy <jimb@codesourcery.com>
Mon, 8 Sep 2003 19:22:30 +0000 (19:22 +0000)
committerJim Blandy <jimb@codesourcery.com>
Mon, 8 Sep 2003 19:22:30 +0000 (19:22 +0000)
* dbxread.c: #include "gdb_assert.h".
(read_dbx_symtab): If the objfile has no .data section, use the
section index for the .bss section instead.

gdb/ChangeLog
gdb/Makefile.in
gdb/dbxread.c

index 75c9e68..15c342c 100644 (file)
@@ -1,3 +1,10 @@
+2003-09-08  Jim Blandy  <jimb@redhat.com>
+
+       * Makefile.in (dbxread.o): Note new dependency on $(gdb_assert_h).
+       * dbxread.c: #include "gdb_assert.h".
+       (read_dbx_symtab): If the objfile has no .data section, use the
+       section index for the .bss section instead.
+
 2003-09-08  Daniel Jacobowitz  <drow@mvista.com>
 
        * frame.c (deprecated_safe_get_selected_frame): New function.
index c93f2fd..b14c450 100644 (file)
@@ -1690,7 +1690,7 @@ dbxread.o: dbxread.c $(defs_h) $(gdb_string_h) $(gdb_obstack_h) \
        $(gdb_stat_h) $(symtab_h) $(breakpoint_h) $(target_h) $(gdbcore_h) \
        $(libaout_h) $(symfile_h) $(objfiles_h) $(buildsym_h) $(stabsread_h) \
        $(gdb_stabs_h) $(demangle_h) $(language_h) $(complaints_h) \
-       $(cp_abi_h) $(aout_aout64_h) $(aout_stab_gnu_h)
+       $(cp_abi_h) $(aout_aout64_h) $(aout_stab_gnu_h) $(gdb_assert_h)
 dcache.o: dcache.c $(defs_h) $(dcache_h) $(gdbcmd_h) $(gdb_string_h) \
        $(gdbcore_h) $(target_h)
 delta68-nat.o: delta68-nat.c $(defs_h)
index fbfd1a9..61c78c4 100644 (file)
@@ -58,6 +58,7 @@
 #include "language.h"          /* Needed for local_hex_string */
 #include "complaints.h"
 #include "cp-abi.h"
+#include "gdb_assert.h"
 
 #include "aout/aout64.h"
 #include "aout/stab_gnu.h"     /* We always use GNU stabs, not native, now */
@@ -1304,6 +1305,7 @@ read_dbx_symtab (struct objfile *objfile)
   struct cleanup *back_to;
   bfd *abfd;
   int textlow_not_set;
+  int data_sect_index;
 
   /* Current partial symtab */
   struct partial_symtab *pst;
@@ -1355,6 +1357,12 @@ read_dbx_symtab (struct objfile *objfile)
   textlow_not_set = 1;
   has_line_numbers = 0;
 
+  /* If the objfile has no .data section, try using the .bss section.  */
+  data_sect_index = objfile->sect_index_data;
+  if (data_sect_index == -1)
+    data_sect_index = SECT_OFF_BSS (objfile);
+  gdb_assert (data_sect_index != -1);
+
   for (symnum = 0; symnum < DBX_SYMCOUNT (objfile); symnum++)
     {
       /* Get the symbol for this run and pull out some info */
@@ -1401,7 +1409,7 @@ read_dbx_symtab (struct objfile *objfile)
 
          case N_DATA | N_EXT:
          case N_NBDATA | N_EXT:
-         nlist.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
+         nlist.n_value += ANOFFSET (objfile->section_offsets, data_sect_index);
          goto record_it;
 
          case N_BSS:
@@ -1468,7 +1476,7 @@ read_dbx_symtab (struct objfile *objfile)
          continue;
 
          case N_DATA:
-         nlist.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
+         nlist.n_value += ANOFFSET (objfile->section_offsets, data_sect_index);
          goto record_it;
 
          case N_UNDF | N_EXT:
@@ -1757,7 +1765,7 @@ read_dbx_symtab (struct objfile *objfile)
          switch (p[1])
          {
          case 'S':
-           nlist.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
+           nlist.n_value += ANOFFSET (objfile->section_offsets, data_sect_index);
 #ifdef STATIC_TRANSFORM_NAME
            namestring = STATIC_TRANSFORM_NAME (namestring);
 #endif
@@ -1768,7 +1776,7 @@ read_dbx_symtab (struct objfile *objfile)
                                 psymtab_language, objfile);
            continue;
          case 'G':
-           nlist.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
+           nlist.n_value += ANOFFSET (objfile->section_offsets, data_sect_index);
            /* The addresses in these entries are reported to be
               wrong.  See the code that reads 'G's for symtabs. */
            add_psymbol_to_list (namestring, p - namestring,