use remote-utils facilities for baud_rate
[deliverable/binutils-gdb.git] / gdb / dbxread.c
index 81e38274e22144066bd56c092fc02b54c511ebe4..cc0c43ea9f7bdee82085178f13037a8bd227760b 100644 (file)
@@ -407,8 +407,8 @@ explicit_lookup_type (real_filenum, index)
       f->length *= 2;
       f->vector = (struct type **)
        xrealloc (f->vector, f->length * sizeof (struct type *));
-      bzero (&f->vector[f->length / 2],
-            f->length * sizeof (struct type *) / 2);
+      memset (&f->vector[f->length / 2],
+            '\0', f->length * sizeof (struct type *) / 2);
     }
   return &f->vector[index];
 }
@@ -1049,19 +1049,12 @@ start_psymtab (objfile, section_offsets,
   return result;
 }
 
-/* Close off the current usage of a partial_symbol table entry.  This
-   involves setting the correct number of includes (with a realloc),
-   setting the high text mark, setting the symbol length in the
-   executable, and setting the length of the global and static lists
-   of psymbols.
+/* Close off the current usage of PST.  
+   Returns PST or NULL if the partial symtab was empty and thrown away.
 
-   The global symbols and static symbols are then seperately sorted.
+   FIXME:  List variables and peculiarities of same.  */
 
-   Then the partial symtab is put on the global list.
-   *** List variables and peculiarities of same. ***
-   */
-
-void
+struct partial_symtab *
 end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
             capping_text, dependency_list, number_dependencies)
      struct partial_symtab *pst;
@@ -1245,7 +1238,11 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
 
     pst->next = pst->objfile->free_psymtabs;
     pst->objfile->free_psymtabs = pst;
+
+    /* Indicate that psymtab was thrown away.  */
+    pst = (struct partial_symtab *)NULL;
   }
+  return pst;
 }
 \f
 static void
@@ -1359,7 +1356,6 @@ read_ofile_symtab (pst)
   unsigned char type;
   unsigned max_symnum;
   register bfd *abfd;
-  struct symtab *rtn;
   struct objfile *objfile;
   int sym_offset;              /* Offset to start of symbols to read */
   int sym_size;                        /* Size of symbols to read */
@@ -1813,7 +1809,10 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
        .stab "foo:V...",N_STSYM        is relative (section base subtracted).
        This leaves us no choice but to search for the 'S' or 'V'...
        (or pass the whole section_offsets stuff down ONE MORE function
-       call level, which we really don't want to do).  */
+       call level, which we really don't want to do).
+
+       The above is indeed true for Solaris 2.1.  I'm not sure what
+       happens in Solaris 2.3, in which ld stops relocating stabs.  */
       {
        char *p;
        p = strchr (name, ':');
@@ -1821,7 +1820,9 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
          {
            /* FIXME!  We relocate it by the TEXT offset, in case the
               whole module moved in memory.  But this is wrong, since
-              the sections can side around independently.  */
+              the sections can side around independently.  (I suspect that
+              the text offset is always zero anyway--elfread.c doesn't
+              process (and Sun cc doesn't produce) Ttext.text symbols).  */
            valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
            goto define_a_symbol;
          }
@@ -1915,7 +1916,15 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
                 previous function. This means that we can use the
                 minimal symbol table to get the address.  */
 
-             if (type == N_GSYM || type == N_STSYM)
+             /* On solaris up to 2.2, the N_FUN stab gets relocated.
+                On Solaris 2.3, ld no longer relocates stabs (which
+                is good), and the N_FUN's value is now always zero.
+                We only provide this correction for functions, not for
+                all N_FUN symbols, because that is easiest and all
+                readonly variables seem to go in the .rodata on Solaris.  */
+
+             if (type == N_GSYM || type == N_STSYM
+                 || (type == N_FUN && valu == 0))
                {
                  struct minimal_symbol *m;
                  int l = colon_pos - name;
@@ -2080,8 +2089,7 @@ elfstab_build_psymtabs (objfile, section_offsets, mainline,
   DBX_STRINGTAB_SIZE (objfile) = stabstrsize;
   DBX_SYMTAB_OFFSET  (objfile) = staboffset;
   
-  if (stabstrsize < 0  /* FIXME:  stabstrsize is unsigned; never true! */
-      || stabstrsize > bfd_get_size (sym_bfd))
+  if (stabstrsize > bfd_get_size (sym_bfd))
     error ("ridiculous string table size: %d bytes", stabstrsize);
   DBX_STRINGTAB (objfile) = (char *)
     obstack_alloc (&objfile->psymbol_obstack, stabstrsize+1);
This page took 0.024581 seconds and 4 git commands to generate.