* dbxread.c (process_one_symbol), partial-stab.h: Ignore

extraneous SO stabs from busted C++ compilers.
This commit is contained in:
Stu Grossman 1992-06-16 01:43:35 +00:00
parent 65f14e33aa
commit c72af08913
3 changed files with 50 additions and 34 deletions

View 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.

View 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);
}

View 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;
}