diff options
author | Stu Grossman <grossman@cygnus> | 1992-06-16 01:43:35 +0000 |
---|---|---|
committer | Stu Grossman <grossman@cygnus> | 1992-06-16 01:43:35 +0000 |
commit | c72af08913dcf61045305c1c048b2a20639b9d99 (patch) | |
tree | 0e8bdd10396c1b11a2aeea4801d76a6d4b878309 | |
parent | 65f14e33aa430affc876a5dc5fa6bf36aa1eed8c (diff) | |
download | ppe42-binutils-c72af08913dcf61045305c1c048b2a20639b9d99.tar.gz ppe42-binutils-c72af08913dcf61045305c1c048b2a20639b9d99.zip |
* dbxread.c (process_one_symbol), partial-stab.h: Ignore
extraneous SO stabs from busted C++ compilers.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/dbxread.c | 21 | ||||
-rw-r--r-- | gdb/partial-stab.h | 58 |
3 files changed, 50 insertions, 34 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 51ca98e1ac..d29a415990 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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. diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 7cbdbe13fe..f437935d73 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -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); } diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h index 9686301b69..862cfad3b2 100644 --- a/gdb/partial-stab.h +++ b/gdb/partial-stab.h @@ -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; } |