]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* NEWS: Mention below.
authorAndrew Cagney <cagney@redhat.com>
Sun, 16 Jun 2002 14:13:59 +0000 (14:13 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sun, 16 Jun 2002 14:13:59 +0000 (14:13 +0000)
Merge from mainline:
2002-04-22 J. Brobecker <brobecker@gnat.com>:
* symfile.h (get_section_index): Define.
* symfile.c (get_section_index): New function.
* mdebugread.c (SC_IS_SBSS): New macro.
(SC_IS_BSS): Return true for the scBss storage class only, as
the scSBss storage class refers to the .sbss section.
(parse_partial_symbols): Discard the symbols which associated
section does not exist.
Make sure to use the .sbss section index for symbols which
storage class is scBss, rather than using the .bss section index.

gdb/ChangeLog
gdb/NEWS
gdb/mdebugread.c
gdb/symfile.c
gdb/symfile.h

index 7c71a91279a38ede0256f1eed1093124c25a216d..f4de19b70bfb6549bff60a461e4e90c5e89a6e78 100644 (file)
@@ -1,3 +1,19 @@
+2002-06-16  Andrew Cagney  <ac131313@redhat.com>
+
+       * NEWS: Mention below.
+
+       Merge from mainline:
+       2002-04-22 J. Brobecker <brobecker@gnat.com>:
+       * symfile.h (get_section_index): Define.
+       * symfile.c (get_section_index): New function.
+       * mdebugread.c (SC_IS_SBSS): New macro.
+       (SC_IS_BSS): Return true for the scBss storage class only, as
+       the scSBss storage class refers to the .sbss section.
+       (parse_partial_symbols): Discard the symbols which associated
+       section does not exist.
+       Make sure to use the .sbss section index for symbols which
+       storage class is scBss, rather than using the .bss section index.
+
 2002-05-28  Theodore A. Roth  <troth@verinet.com>
 
        * MAINTAINERS: Add myself as AVR maintainer.
index 0c2f175de8501e0a851f8391e0e19b2d29799136..2e794a2036b32096555ae93b12f10ee1087ada2b 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -7,6 +7,12 @@
 
 Atmel AVR                                      avr*-*-*
 
+* Bug fixes
+
+gdb/182: gdb/323: gdb/237: On alpha, gdb was reporting:
+mdebugread.c:2443: gdb-internal-error: sect_index_data not initialized
+Fix, by Joel Brobecker imported from mainline.
+
 *** Changes in GDB 5.2:
 
 * New command "set trust-readonly-sections on[off]".
index 1bc9eef786e4bdfff36d81ba0d542dea699d115c..c974c9e874a19da6d268d3580b78a025ca5eeee3 100644 (file)
@@ -143,7 +143,8 @@ struct symloc
                   || (sc) == scPData \
                   || (sc) == scXData)
 #define SC_IS_COMMON(sc) ((sc) == scCommon || (sc) == scSCommon)
-#define SC_IS_BSS(sc) ((sc) == scBss || (sc) == scSBss)
+#define SC_IS_BSS(sc) ((sc) == scBss)
+#define SC_IS_SBSS(sc) ((sc) == scSBss)
 #define SC_IS_UNDEF(sc) ((sc) == scUndefined || (sc) == scSUndefined)
 \f
 /* Various complaints about symbol reading that don't abort the process */
@@ -2425,26 +2426,72 @@ parse_partial_symbols (struct objfile *objfile)
              ms_type = mst_bss;
              svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
            }
+          else if (SC_IS_SBSS (ext_in->asym.sc))
+            {
+              ms_type = mst_bss;
+              svalue += ANOFFSET (objfile->section_offsets, 
+                                  get_section_index (objfile, ".sbss"));
+            }
          else
            ms_type = mst_abs;
          break;
        case stLabel:
          /* Label */
+
+          /* On certain platforms, some extra label symbols can be
+             generated by the linker. One possible usage for this kind
+             of symbols is to represent the address of the begining of a
+             given section. For instance, on Tru64 5.1, the address of
+             the _ftext label is the start address of the .text section.
+
+             The storage class of these symbols is usually directly
+             related to the section to which the symbol refers. For
+             instance, on Tru64 5.1, the storage class for the _fdata
+             label is scData, refering to the .data section.
+
+             It is actually possible that the section associated to the
+             storage class of the label does not exist. On True64 5.1
+             for instance, the libm.so shared library does not contain
+             any .data section, although it contains a _fpdata label
+             which storage class is scData... Since these symbols are
+             usually useless for the debugger user anyway, we just
+             discard these symbols.
+           */
+          
          if (SC_IS_TEXT (ext_in->asym.sc))
            {
+              if (objfile->sect_index_text == -1)
+                continue;
+                
              ms_type = mst_file_text;
              svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
            }
          else if (SC_IS_DATA (ext_in->asym.sc))
            {
+              if (objfile->sect_index_data == -1)
+                continue;
+
              ms_type = mst_file_data;
              svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
            }
          else if (SC_IS_BSS (ext_in->asym.sc))
            {
+              if (objfile->sect_index_bss == -1)
+                continue;
+
              ms_type = mst_file_bss;
              svalue += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
            }
+          else if (SC_IS_SBSS (ext_in->asym.sc))
+            {
+              const int sbss_sect_index = get_section_index (objfile, ".sbss");
+
+              if (sbss_sect_index == -1)
+                continue;
+
+              ms_type = mst_file_bss;
+              svalue += ANOFFSET (objfile->section_offsets, sbss_sect_index);
+            }
          else
            ms_type = mst_abs;
          break;
index bb10ac185ff4fcfba0f0eafa4e021757eecabec2..8513d34e912ea8f69c10d9379a1b51741326b8cc 100644 (file)
@@ -120,6 +120,8 @@ static void cashier_psymtab (struct partial_symtab *);
 
 bfd *symfile_bfd_open (char *);
 
+int get_section_index (struct objfile *, char *);
+
 static void find_sym_fns (struct objfile *);
 
 static void decrement_reading_symtab (void *);
@@ -1109,6 +1111,18 @@ symfile_bfd_open (char *name)
   return (sym_bfd);
 }
 
+/* Return the section index for the given section name. Return -1 if
+   the section was not found. */
+int
+get_section_index (struct objfile *objfile, char *section_name)
+{
+  asection *sect = bfd_get_section_by_name (objfile->obfd, section_name);
+  if (sect)
+    return sect->index;
+  else
+    return -1;
+}
+
 /* Link a new symtab_fns into the global symtab_fns list.  Called on gdb
    startup by the _initialize routine in each object file format reader,
    to register information about each format the the reader is prepared
index 9ab8068d11286538feafd0aa2a241c8541a8a622..39eb3080f13c9522d31e2f97da660cc29016a211 100644 (file)
@@ -252,6 +252,8 @@ extern void find_lowest_section (bfd *, asection *, PTR);
 
 extern bfd *symfile_bfd_open (char *);
 
+extern int get_section_index (struct objfile *, char *);
+
 /* Utility functions for overlay sections: */
 extern enum overlay_debugging_state {
   ovly_off,