]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* Makefile.in (os9kread.o): Remove dependency on partial-stab.h.
authorStu Grossman <grossman@cygnus>
Tue, 23 Jul 1996 01:24:58 +0000 (01:24 +0000)
committerStu Grossman <grossman@cygnus>
Tue, 23 Jul 1996 01:24:58 +0000 (01:24 +0000)
* dbxread.c (read_dbx_symtab end_psymtab), partial-stab.h:  Don't
use partial_symtab->textlow==0 as a flag, as 0 is a legitimate
text address.  Use a seperate flag (textlow_not_set) instead.
This makes stabs in ELF .o files work a lot better.
* mdebugread.c xcoffread.c:  Define textlow_not_set for
partial-stab.h.
* stabsread.h (end_psymtab):  Add textlow_not_set arg to prototype.

gdb/ChangeLog
gdb/Makefile.in
gdb/dbxread.c
gdb/mdebugread.c
gdb/partial-stab.h
gdb/stabsread.h
gdb/xcoffread.c

index d5102dc93cc9e75d89b6a0bd43d1e586fb2206b6..60033029abd790fdcd5129ed1a01f83b8b727dc1 100644 (file)
@@ -1,3 +1,14 @@
+Mon Jul 22 18:13:27 1996  Stu Grossman  (grossman@critters.cygnus.com)
+
+       * Makefile.in (os9kread.o):  Remove dependency on partial-stab.h.
+       * dbxread.c (read_dbx_symtab end_psymtab), partial-stab.h:  Don't
+       use partial_symtab->textlow==0 as a flag, as 0 is a legitimate
+       text address.  Use a seperate flag (textlow_not_set) instead.
+       This makes stabs in ELF .o files work a lot better.
+       * mdebugread.c xcoffread.c:  Define textlow_not_set for
+       partial-stab.h.
+       * stabsread.h (end_psymtab):  Add textlow_not_set arg to prototype.
+
 Sat Jul 20 17:46:40 1996  Fred Fish  <fnf@cygnus.com>
 
        * gdbtk.tcl (files_command): Reorder the binding tags for
index 59946e7f7e575e7f851197dd24011295aae2420d..bcb9b59907e8bfe920ddcd6e6daa9b0539fc9522 100644 (file)
@@ -1261,7 +1261,7 @@ mipsm3-nat.o: mipsm3-nat.c $(defs_h) $(inferior_h)
 
 os9kread.o: os9kread.c buildsym.h complaints.h $(bfd_h) $(defs_h) \
         $(expression_h) gdb-stabs.h $(gdbcore_h) $(gdbtypes_h) language.h \
-        objfiles.h partial-stab.h stabsread.h symfile.h $(symtab_h) \
+        objfiles.h stabsread.h symfile.h $(symtab_h) \
        target.h gdb_string.h
 
 mem-break.o: mem-break.c $(defs_h) 
index de31d46472d394d344b630250973365678776578..043d67e611330768276631c2947104d480c4e969 100644 (file)
@@ -1131,6 +1131,7 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
   CORE_ADDR last_function_start = 0;
   struct cleanup *back_to;
   bfd *abfd;
+  int textlow_not_set;
 
   /* Current partial symtab */
   struct partial_symtab *pst;
@@ -1176,6 +1177,7 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
   abfd = objfile->obfd;
   symbuf_end = symbuf_idx = 0;
   next_symbol_text_func = dbx_next_symbol_text;
+  textlow_not_set = 1;
 
   for (symnum = 0; symnum < DBX_SYMCOUNT (objfile); symnum++)
     {
@@ -1224,8 +1226,8 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
 #define DBXREAD_ONLY
 #define START_PSYMTAB(ofile,secoff,fname,low,symoff,global_syms,static_syms)\
   start_psymtab(ofile, secoff, fname, low, symoff, global_syms, static_syms)
-#define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps)\
-  end_psymtab(pst,ilist,ninc,c_off,c_text,dep_list,n_deps)
+#define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set)\
+  end_psymtab(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set)
 
 #include "partial-stab.h"
     }
@@ -1249,7 +1251,7 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
                    ? (text_addr + section_offsets->offsets[SECT_OFF_TEXT])
                    : lowest_text_address)
                   + text_size,
-                  dependency_list, dependencies_used);
+                  dependency_list, dependencies_used, textlow_not_set);
     }
 
   do_cleanups (back_to);
@@ -1306,7 +1308,7 @@ start_psymtab (objfile, section_offsets,
 
 struct partial_symtab *
 end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
-            capping_text, dependency_list, number_dependencies)
+            capping_text, dependency_list, number_dependencies, textlow_not_set)
      struct partial_symtab *pst;
      char **include_list;
      int num_includes;
@@ -1314,12 +1316,13 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
      CORE_ADDR capping_text;
      struct partial_symtab **dependency_list;
      int number_dependencies;
+     int textlow_not_set;
 {
   int i;
   struct objfile *objfile = pst -> objfile;
 
   if (capping_symbol_offset != -1)
-      LDSYMLEN(pst) = capping_symbol_offset - LDSYMOFF(pst);
+    LDSYMLEN(pst) = capping_symbol_offset - LDSYMOFF(pst);
   pst->texthigh = capping_text;
 
 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
@@ -1328,8 +1331,8 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
      we have to do some tricks to fill in texthigh and textlow.
      The first trick is in partial-stab.h: if we see a static
      or global function, and the textlow for the current pst
-     is still 0, then we use that function's address for 
-     the textlow of the pst.  */
+     is not set (ie: textlow_not_set), then we use that function's
+     address for the textlow of the pst.  */
 
   /* Now, to fill in texthigh, we remember the last function seen
      in the .o file (also in partial-stab.h).  Also, there's a hack in
@@ -1338,52 +1341,53 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
      a reliable texthigh by taking the address plus size of the
      last function in the file.  */
 
-  if (pst->texthigh == 0 && last_function_name) {
-    char *p;
-    int n;
-    struct minimal_symbol *minsym;
-
-    p = strchr (last_function_name, ':');
-    if (p == NULL)
-      p = last_function_name;
-    n = p - last_function_name;
-    p = alloca (n + 1);
-    strncpy (p, last_function_name, n);
-    p[n] = 0;
+  if (pst->texthigh == 0 && last_function_name)
+    {
+      char *p;
+      int n;
+      struct minimal_symbol *minsym;
+
+      p = strchr (last_function_name, ':');
+      if (p == NULL)
+       p = last_function_name;
+      n = p - last_function_name;
+      p = alloca (n + 1);
+      strncpy (p, last_function_name, n);
+      p[n] = 0;
     
-    minsym = lookup_minimal_symbol (p, pst->filename, objfile);
+      minsym = lookup_minimal_symbol (p, pst->filename, objfile);
 
-    if (minsym)
-      pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) +
-       (long) MSYMBOL_INFO (minsym);
+      if (minsym)
+       pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym)
+         + (long) MSYMBOL_INFO (minsym);
 
-    last_function_name = NULL;
-  }
+      last_function_name = NULL;
+    }
 
   /* this test will be true if the last .o file is only data */
-  if (pst->textlow == 0)
-    /* This loses if the text section really starts at address zero
-       (generally true when we are debugging a .o file, for example).
-       That is why this whole thing is inside SOFUN_ADDRESS_MAYBE_MISSING.  */
+  if (textlow_not_set)
     pst->textlow = pst->texthigh;
+  else
+    {
+      struct partial_symtab *p1;
 
-  /* If we know our own starting text address, then walk through all other
-     psymtabs for this objfile, and if any didn't know their ending text
-     address, set it to our starting address.  Take care to not set our
-     own ending address to our starting address, nor to set addresses on
-     `dependency' files that have both textlow and texthigh zero.  */
-  if (pst->textlow) {
-    struct partial_symtab *p1;
-
-    ALL_OBJFILE_PSYMTABS (objfile, p1) {
-      if (p1->texthigh == 0  && p1->textlow != 0 && p1 != pst) {
-       p1->texthigh = pst->textlow;
-       /* if this file has only data, then make textlow match texthigh */
-       if (p1->textlow == 0)
-         p1->textlow = p1->texthigh;
-      }
+      /* If we know our own starting text address, then walk through all other
+        psymtabs for this objfile, and if any didn't know their ending text
+        address, set it to our starting address.  Take care to not set our
+        own ending address to our starting address, nor to set addresses on
+        `dependency' files that have both textlow and texthigh zero.  */
+
+      ALL_OBJFILE_PSYMTABS (objfile, p1)
+       {
+         if (p1->texthigh == 0  && p1->textlow != 0 && p1 != pst)
+           {
+             p1->texthigh = pst->textlow;
+             /* if this file has only data, then make textlow match texthigh */
+             if (p1->textlow == 0)
+               p1->textlow = p1->texthigh;
+           }
+       }
     }
-  }
 
   /* End of kludge for patching Solaris textlow and texthigh.  */
 #endif /* SOFUN_ADDRESS_MAYBE_MISSING.  */
index 927c79654a895643ab87fa054382c95b04af3d55..1aa2bf5495af73a86c20d65fdd05ddec817f23fd 100644 (file)
@@ -2235,7 +2235,7 @@ parse_partial_symbols (objfile, section_offsets)
   EXTR *ext_in_end;
   SYMR sh;
   struct partial_symtab *pst;
-
+  int textlow_not_set = 1;
   int past_first_source_file = 0;
 
   /* List of current psymtab's include files */
@@ -2631,7 +2631,7 @@ parse_partial_symbols (objfile, section_offsets)
 #define CUR_SYMBOL_VALUE sh.value
 #define START_PSYMTAB(ofile,secoff,fname,low,symoff,global_syms,static_syms)\
   pst = save_pst
-#define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps) (void)0
+#define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set) (void)0
 #define HANDLE_RBRAC(val) \
   if ((val) > save_pst->texthigh) save_pst->texthigh = (val);
 #include "partial-stab.h"
@@ -2939,7 +2939,7 @@ parse_partial_symbols (objfile, section_offsets)
       fdr_to_pst[f_idx].pst = end_psymtab (save_pst,
                                           psymtab_include_list, includes_used,
                                           -1, save_pst->texthigh,
-                                          dependency_list, dependencies_used);
+                                          dependency_list, dependencies_used, textlow_not_set);
       includes_used = 0;
       dependencies_used = 0;
 
index 9fe653b7a15a7d79a6102de4baae378b59272ef6..c51f091f1d45b711396d055dfc056611f979fee8 100644 (file)
@@ -106,7 +106,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
                               symnum * symbol_size,
                               CUR_SYMBOL_VALUE > pst->texthigh
                                 ? CUR_SYMBOL_VALUE : pst->texthigh, 
-                              dependency_list, dependencies_used);
+                              dependency_list, dependencies_used, textlow_not_set);
                  pst = (struct partial_symtab *) 0;
                  includes_used = 0;
                  dependencies_used = 0;
@@ -197,16 +197,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
          static int prev_so_symnum = -10;
          static int first_so_symnum;
          char *p;
+         int prev_textlow_not_set;
 
          valu = CUR_SYMBOL_VALUE + ANOFFSET (section_offsets, SECT_OFF_TEXT);
+
+         prev_textlow_not_set = textlow_not_set;
+
 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
          /* A zero value is probably an indication for the SunPRO 3.0
             compiler. end_psymtab explicitly tests for zero, so
             don't relocate it.  */
+
          if (CUR_SYMBOL_VALUE == 0)
-           valu = 0;
+           {
+             textlow_not_set = 1;
+             valu = 0;
+           }
+         else
+           textlow_not_set = 0;
+#else
+         textlow_not_set = 0;
 #endif
-
          past_first_source_file = 1;
 
          if (prev_so_symnum != symnum - 1)
@@ -218,7 +229,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
                  END_PSYMTAB (pst, psymtab_include_list, includes_used,
                               symnum * symbol_size,
                               valu > pst->texthigh ? valu : pst->texthigh,
-                              dependency_list, dependencies_used);
+                              dependency_list, dependencies_used,
+                              prev_textlow_not_set);
                  pst = (struct partial_symtab *) 0;
                  includes_used = 0;
                  dependencies_used = 0;
@@ -554,9 +566,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
              /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
                 value for the bottom of the text seg in those cases. */
-             if (pst && pst->textlow == 0 && !symfile_relocatable)
-               pst->textlow =
-                 find_stab_function_addr (namestring, pst, objfile);
+             if (pst && textlow_not_set)
+               {
+                 pst->textlow =
+                   find_stab_function_addr (namestring, pst, objfile);
+                 textlow_not_set = 0;
+               }
 #endif
 #if 0
              if (startup_file_end == 0)
@@ -568,11 +583,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
                 the bounds created by N_SO symbols.  If that's the case
                 use the address of this function as the low bound for
                 the partial symbol table.  */
-             if (pst->textlow == 0
+             if (textlow_not_set
                  || (CUR_SYMBOL_VALUE < pst->textlow
                      && CUR_SYMBOL_VALUE
                           != ANOFFSET (section_offsets, SECT_OFF_TEXT)))
-               pst->textlow = CUR_SYMBOL_VALUE;
+               {
+                 pst->textlow = CUR_SYMBOL_VALUE;
+                 textlow_not_set = 0;
+               }
 #endif /* DBXREAD_ONLY */
              add_psymbol_to_list (namestring, p - namestring,
                                   VAR_NAMESPACE, LOC_BLOCK,
@@ -594,9 +612,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #ifdef SOFUN_ADDRESS_MAYBE_MISSING
              /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
                 value for the bottom of the text seg in those cases. */
-             if (pst && pst->textlow == 0 && !symfile_relocatable)
-               pst->textlow =
-                 find_stab_function_addr (namestring, pst, objfile);
+             if (pst && textlow_not_set)
+               {
+                 pst->textlow =
+                   find_stab_function_addr (namestring, pst, objfile);
+                 textlow_not_set = 0;
+               }
 #endif
 #if 0
              if (startup_file_end == 0)
@@ -607,11 +628,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
                 the bounds created by N_SO symbols.  If that's the case
                 use the address of this function as the low bound for
                 the partial symbol table.  */
-             if (pst->textlow == 0
+             if (textlow_not_set
                  || (CUR_SYMBOL_VALUE < pst->textlow
                      && CUR_SYMBOL_VALUE
                           != ANOFFSET (section_offsets, SECT_OFF_TEXT)))
-               pst->textlow = CUR_SYMBOL_VALUE;
+               {
+                 pst->textlow = CUR_SYMBOL_VALUE;
+                 textlow_not_set = 0;
+               }
 #endif /* DBXREAD_ONLY */
              add_psymbol_to_list (namestring, p - namestring,
                                   VAR_NAMESPACE, LOC_BLOCK,
@@ -728,7 +752,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
              END_PSYMTAB (pst, psymtab_include_list, includes_used,
                           symnum * symbol_size,
                           (CORE_ADDR) 0,
-                          dependency_list, dependencies_used);
+                          dependency_list, dependencies_used, textlow_not_set);
              pst = (struct partial_symtab *) 0;
              includes_used = 0;
              dependencies_used = 0;
index b348738fc028b3ea1f4a2109cc9bc118c61181ec..090de16b480e36f7ea71ca3c2f6a679a45c08260 100644 (file)
@@ -187,8 +187,14 @@ start_psymtab PARAMS ((struct objfile *, struct section_offsets *, char *,
                       struct partial_symbol **));
 
 extern struct partial_symtab *
-end_psymtab PARAMS ((struct partial_symtab *, char **, int, int, CORE_ADDR,
-                    struct partial_symtab **, int));
+end_psymtab PARAMS ((struct partial_symtab *pst,
+                    char **include_list,
+                    int num_includes,
+                    int capping_symbol_offset,
+                    CORE_ADDR capping_text,
+                    struct partial_symtab **dependency_list,
+                    int number_dependencies,
+                    int textlow_not_set));
 
 extern void
 process_one_symbol PARAMS ((int, int, CORE_ADDR, char *,
index 727d558041f0872ee9ccdf0e9a7d5a8df8dfe308..03308fccf0814b7905f681b3a0fb7c134c640e4a 100644 (file)
@@ -2188,6 +2188,7 @@ scan_xcoff_symtab (section_offsets, objfile)
   CORE_ADDR last_csect_val = 0;
   int last_csect_sec = 0;
   int  misc_func_recorded = 0;         /* true if any misc. function */
+  int textlow_not_set = 1;
 
   pst = (struct partial_symtab *) 0;