]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* dbxread.c (process_one_symbol), partial-stab.h: Ignore
authorStu Grossman <grossman@cygnus>
Tue, 16 Jun 1992 01:43:35 +0000 (01:43 +0000)
committerStu Grossman <grossman@cygnus>
Tue, 16 Jun 1992 01:43:35 +0000 (01:43 +0000)
extraneous SO stabs from busted C++ compilers.

gdb/ChangeLog
gdb/dbxread.c
gdb/partial-stab.h

index 51ca98e1acb2853a868eac5d30c364a5fdc0e51a..d29a4159909be0acf2a6bda39c597bff959c802b 100644 (file)
@@ -1,3 +1,8 @@
+Mon Jun 15 18:41:23 1992  Stu Grossman  (grossman at cygnus.com)
+
+       * dbxread.c (process_one_symbol), partial-stab.h:  Ignore
+       extraneous SO stabs from busted C++ compilers.
+
 Mon Jun 15 12:21:45 1992  Fred Fish  (fnf@cygnus.com)
 
        * Makefile.in (VERSION):  Bump to 4.5.5.
index 7cbdbe13fe3dd191bc798c726ce1e0390760c055..f437935d73f7c8ac8499f8a9678f7a87d2f2bc3f 100644 (file)
@@ -33,6 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "defs.h"
 #include <string.h>
+#include <strings.h>
 
 #if defined(USG) || defined(__CYGNUSCLIB__)
 #include <sys/types.h>
@@ -1618,16 +1619,18 @@ process_one_symbol (type, desc, valu, name, offset, objfile)
             sanity checks).  If so, that one was actually the directory
             name, and the current one is the real file name.
             Patch things up. */           
-         if (previous_stab_code == N_SO
-             && current_subfile && current_subfile->dirname == NULL
-             && current_subfile->name != NULL
-             && current_subfile->name[strlen(current_subfile->name)-1] == '/')
+         if (previous_stab_code == N_SO)
            {
-             current_subfile->dirname = current_subfile->name;
-             current_subfile->name =
-                 obsavestring (name, strlen (name),
-                               &objfile -> symbol_obstack);
-             break;
+             if (current_subfile && current_subfile->dirname == NULL
+                 && current_subfile->name != NULL
+                 && current_subfile->name[strlen(current_subfile->name)-1] == '/')
+               {
+                 current_subfile->dirname = current_subfile->name;
+                 current_subfile->name =
+                   obsavestring (name, strlen (name),
+                                 &objfile -> symbol_obstack);
+               }
+             break;            /* Ignore repeated SOs */
            }
          (void) end_symtab (valu, 0, 0, objfile);
        }
index 9686301b691e63e0b8eb7b599c86c30498350009..862cfad3b2f4dd39bc3150378ab7833593a31993 100644 (file)
@@ -186,9 +186,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
        case N_SO: {
          unsigned long valu = CUR_SYMBOL_VALUE;
-         /* Symbol number of the first symbol of this file (i.e. the N_SO
-            if there is just one, or the first if we have a pair).  */
-         int first_symnum = symnum;
+         static int last_so_symnum = -10;
+         static int dir_so_symnum = -1;
+         int tmp;
+         char *p;
          
          /* End the current partial symtab and start a new one */
 
@@ -196,40 +197,47 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
          valu += addr;         /* Relocate */
 
-         if (pst && past_first_source_file)
+         /* Some compilers (including gcc) emit a pair of initial N_SOs.
+            The first one is a directory name; the second the file name.
+            If pst exists, is empty, and has a filename ending in '/',
+            we assume the previous N_SO was a directory name. */
+
+         p = rindex(namestring, '/');
+         if (p && *(p+1) == '\000')
+           {
+             dir_so_symnum = symnum;
+             continue;         /* Simply ignore directory name SOs */
+           }
+
+         /* Some other compilers (C++ ones in particular) emit useless
+            SOs for non-existant .c files. */
+
+         if (last_so_symnum == symnum - 1)
+           continue;           /* Ignore repeated SOs */
+         last_so_symnum = symnum;
+
+         if (pst)
            {
-             /* Some compilers (including gcc) emit a pair of initial N_SOs.
-                The first one is a directory name; the second the file name.
-                If pst exists, is empty, and has a filename ending in '/',
-                we assume the previous N_SO was a directory name. */
-             if (pst -> objfile -> global_psymbols.next
-                 ==  (pst -> objfile -> global_psymbols.list + pst->globals_offset)
-               && pst -> objfile -> static_psymbols.next
-                 == (pst -> objfile -> static_psymbols.list + pst->statics_offset)
-               && pst->filename && pst->filename[0]
-               && pst->filename[strlen(pst->filename)-1] == '/') {
-                 /* Just replace the directory name with the real filename. */
-                 pst->filename =
-                     (char *) obstack_alloc (&pst->objfile->psymbol_obstack,
-                                             strlen (namestring) + 1);
-                 strcpy (pst->filename, namestring);
-                 continue;
-             }
              END_PSYMTAB (pst, psymtab_include_list, includes_used,
-                          first_symnum * symbol_size, valu,
+                          symnum * symbol_size, valu,
                           dependency_list, dependencies_used);
              pst = (struct partial_symtab *) 0;
              includes_used = 0;
              dependencies_used = 0;
            }
-         else
-           past_first_source_file = 1;
 
+         past_first_source_file = 1;
+
+         if (dir_so_symnum == symnum - 1) /* Was prev. SO a directory? */
+           tmp = dir_so_symnum;
+         else
+           tmp = symnum;
          pst = START_PSYMTAB (objfile, addr,
                               namestring, valu,
-                              first_symnum * symbol_size,
+                              tmp * symbol_size,
                               objfile -> global_psymbols.next,
                               objfile -> static_psymbols.next);
+         dir_so_symnum = -1;
          continue;
        }