* elfread.c (elf_symtab_read): Properly sort out the bss symbols
authorFred Fish <fnf@specifix.com>
Sat, 7 Aug 1993 20:27:19 +0000 (20:27 +0000)
committerFred Fish <fnf@specifix.com>
Sat, 7 Aug 1993 20:27:19 +0000 (20:27 +0000)
from the data symbols and give them the correct minimal_symbol_type.
Add file static symbols to the minimal symbol table, not just
global symbols.  Ignore symbols that are section names and file names.
* dwarfread.c (add_partial_symbol):  Add comment about limitations
of DWARF symbols for distinquishing data from bss when adding
minimal symbols.  Add file local symbols to minimal symbols.

gdb/ChangeLog
gdb/dwarfread.c
gdb/elfread.c

index 6d3af492397f16489d3221303e0c356a65633662..ce20df8fab12c28642ba1c49107b269acd1f8bf3 100644 (file)
@@ -1,3 +1,13 @@
+Sat Aug  7 10:59:03 1993  Fred Fish  (fnf@deneb.cygnus.com)
+
+       * elfread.c (elf_symtab_read):  Properly sort out the bss symbols
+       from the data symbols and give them the correct minimal_symbol_type.
+       Add file static symbols to the minimal symbol table, not just
+       global symbols.  Ignore symbols that are section names and file names.
+       * dwarfread.c (add_partial_symbol):  Add comment about limitations
+       of DWARF symbols for distinquishing data from bss when adding
+       minimal symbols.  Add file local symbols to minimal symbols.
+
 Thu Aug  5 08:58:58 1993  Jim Kingdon  (kingdon@lioth.cygnus.com)
 
        * ser-go32.c: Define job_control variable.
index 709b9584e72361329779509eb2ec52b30c2a0d42..3b9b225113214ebbc23977574a369dda82965e8a 100644 (file)
@@ -2614,6 +2614,20 @@ DESCRIPTION
        add to a partial symbol table, finish filling in the die info
        and then add a partial symbol table entry for it.
 
+       Also record the symbol in the minimal symbol table.  Note that
+       DWARF does not directly distinquish between data and bss symbols,
+       so we use mst_data/mst_file_data for both of them.  One way we
+       could make the distinction is checking the address of the symbol
+       and then checking the flags on the ELF section that contains
+       that address to look for SHT_PROGBITS (data) or SHT_NOBITS (bss),
+       but it probably isn't worth the effort.  A side effect of leaving
+       things as they are is that the minimal symbol created from the DWARF
+       info, containing the wrong minimal_symbol_type, overrides the minimal
+       symbol created from processing the canonical bfd symbols, which
+       did have the right minimal_symbol_type.  This is probably a side
+       effect of the way the table is sorted and duplicates are discarded.
+       (FIXME?)
+
 NOTES
 
        The caller must ensure that the DIE has a valid name attribute.
@@ -2628,7 +2642,7 @@ add_partial_symbol (dip, objfile)
     {
     case TAG_global_subroutine:
       record_minimal_symbol (dip -> at_name, dip -> at_low_pc, mst_text,
-                           objfile);
+                            objfile);
       ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
                           VAR_NAMESPACE, LOC_BLOCK,
                           objfile -> global_psymbols,
@@ -2636,19 +2650,23 @@ add_partial_symbol (dip, objfile)
       break;
     case TAG_global_variable:
       record_minimal_symbol (dip -> at_name, locval (dip -> at_location),
-                           mst_data, objfile);
+                            mst_data, objfile);
       ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
                           VAR_NAMESPACE, LOC_STATIC,
                           objfile -> global_psymbols,
                           0, cu_language, objfile);
       break;
     case TAG_subroutine:
+      record_minimal_symbol (dip -> at_name, dip -> at_low_pc, mst_file_text,
+                            objfile);
       ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
                           VAR_NAMESPACE, LOC_BLOCK,
                           objfile -> static_psymbols,
                           dip -> at_low_pc, cu_language, objfile);
       break;
     case TAG_local_variable:
+      record_minimal_symbol (dip -> at_name, locval (dip -> at_location),
+                            mst_file_data, objfile);
       ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
                           VAR_NAMESPACE, LOC_STATIC,
                           objfile -> static_psymbols,
index fbe9bc53dd9b44149820782f9694891b22a332a8..af625fe2d7b45dcce390a6cc153a1f1b069ac87b 100644 (file)
@@ -235,10 +235,17 @@ elf_symtab_read (abfd, addr, objfile)
       for (i = 0; i < number_of_symbols; i++)
        {
          sym = symbol_table[i];
-         /* Select global/weak symbols that are defined in a specific section.
-            Note that bfd now puts abs symbols in their own section, so
-            all symbols we are interested in will have a section. */
-         if ((sym -> flags & (BSF_GLOBAL | BSF_WEAK))
+         /* Bfd flags ELF symbol table STT_SECTION and STT_FILE symbols with
+            BSF_DEBUGGING.  We don't want these in the minimal symbols, so
+            skip over them. */
+         if (sym -> flags & BSF_DEBUGGING)
+           {
+             continue;
+           }
+         /* Select global/local/weak symbols that are defined in a specific
+            section.  Note that bfd puts abs symbols in their own section,
+            so all symbols we are interested in will have a section. */
+         if ((sym -> flags & (BSF_GLOBAL | BSF_LOCAL | BSF_WEAK))
              && (sym -> section != NULL))
            {
              /* Bfd symbols are section relative. */
@@ -252,18 +259,46 @@ elf_symtab_read (abfd, addr, objfile)
                 no way of figuring this out for absolute symbols. */
              if (sym -> section -> flags & SEC_CODE)
                {
-                 ms_type = mst_text;
+                 if (sym -> flags & BSF_GLOBAL)
+                   {
+                     ms_type = mst_text;
+                   }
+                 else
+                   {
+                     ms_type = mst_file_text;
+                   }
                }
              else if (sym -> section -> flags & SEC_DATA)
                {
-                 ms_type = mst_data;
+                 if (sym -> flags & BSF_GLOBAL)
+                   {
+                     if (sym -> section -> flags & SEC_HAS_CONTENTS)
+                       {
+                         ms_type = mst_data;
+                       }
+                     else
+                       {
+                         ms_type = mst_bss;
+                       }
+                   }
+                 else
+                   {
+                     if (sym -> section -> flags & SEC_HAS_CONTENTS)
+                       {
+                         ms_type = mst_file_data;
+                       }
+                     else
+                       {
+                         ms_type = mst_file_bss;
+                       }
+                   }
                }
              else
                {
                  /* FIXME:  Solaris2 shared libraries include lots of
                     odd "absolute" and "undefined" symbols, that play 
                     hob with actions like finding what function the PC
-                    is in.  Ignore them if they aren't text or data.  */
+                    is in.  Ignore them if they aren't text, data, or bss.  */
                  /* ms_type = mst_unknown; */
                  continue;             /* Skip this symbol. */
                }
This page took 0.032335 seconds and 4 git commands to generate.