* dbxread.c (process_one_symbol): Ignore N_MAIN, N_ENDM for Solaris.

* partial-stab.h:  Ignore N_ENDM.
* elfread.c (elf_symtab_read):  Ignore symbols that don't have a
CODE or DATA section attachment.  This eliminates a lot of random
values from shared libraries, which screw up the ordinary symbols
in the address ranges they happen to overlap.
* buildsym.c (define_symbol):  Eliminate special tests
for function types; move into "function" cases in switch statement.
(define_symbol: 'f', 'F', 'P'):  Process all parameter types
in case they define new type numbers.  But ignore them (FIXME).
('k', 'B'):  Ignore const and volatile if we see them (FIXME).
(read_sun_builtin_type):  Add commentary.
This commit is contained in:
John Gilmore 1992-07-03 07:08:31 +00:00
parent 28b6b1ab85
commit 4c7c6bab1f
5 changed files with 98 additions and 51 deletions

View File

@ -1,3 +1,18 @@
Fri Jul 3 00:00:49 1992 John Gilmore (gnu at cygnus.com)
* dbxread.c (process_one_symbol): Ignore N_MAIN, N_ENDM for Solaris.
* partial-stab.h: Ignore N_ENDM.
* elfread.c (elf_symtab_read): Ignore symbols that don't have a
CODE or DATA section attachment. This eliminates a lot of random
values from shared libraries, which screw up the ordinary symbols
in the address ranges they happen to overlap.
* buildsym.c (define_symbol): Eliminate special tests
for function types; move into "function" cases in switch statement.
(define_symbol: 'f', 'F', 'P'): Process all parameter types
in case they define new type numbers. But ignore them (FIXME).
('k', 'B'): Ignore const and volatile if we see them (FIXME).
(read_sun_builtin_type): Add commentary.
Tue Jun 30 02:25:10 1992 John Gilmore (gnu at cygnus.com)
* tm-mips.h (GDB_TARGET_IS_MIPS): Define for mips-xdep.c.

View File

@ -1253,7 +1253,9 @@ define_symbol (valu, string, desc, type, objfile)
else
{
struct type *type_read;
/* The symbol class letter is followed by a type (typically the
type of the symbol, or its return-type, or etc). Read it. */
synonym = *p == 't';
if (synonym)
@ -1273,43 +1275,7 @@ define_symbol (valu, string, desc, type, objfile)
we can examine it to decide between "int" and "long". FIXME. */
long_kludge_name = SYMBOL_NAME (sym);
type_read = read_type (&p, objfile);
if ((deftype == 'F' || deftype == 'f') && *p == ';') {
/* Sun acc puts declared types of aguments here. We don't care
about their actual types (FIXME -- we should remember the whole
function prototype), but the list
may define some new types that we have to remember, so we must
scan them now. */
while (*p == ';') {
p++;
read_type (&p, objfile);
}
}
if ((deftype == 'F' || deftype == 'f')
&& TYPE_CODE (type_read) != TYPE_CODE_FUNC)
{
#if 0
/* This code doesn't work -- it needs to realloc and can't. */
/* Attempt to set up to record a function prototype... */
struct type *new = (struct type *)
obstack_alloc (&objfile -> type_obstack,
sizeof (struct type));
/* Generate a template for the type of this function. The
types of the arguments will be added as we read the symbol
table. */
*new = *lookup_function_type (type_read);
SYMBOL_TYPE(sym) = new;
TYPE_OBJFILE (new) = objfile;
in_function_type = new;
#else
SYMBOL_TYPE (sym) = lookup_function_type (type_read);
#endif
}
else
SYMBOL_TYPE (sym) = type_read;
SYMBOL_TYPE (sym) = read_type (&p, objfile);
}
switch (deftype)
@ -1323,16 +1289,55 @@ define_symbol (valu, string, desc, type, objfile)
break;
case 'f':
/* A static function definition. */
SYMBOL_CLASS (sym) = LOC_BLOCK;
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
add_symbol_to_list (sym, &file_symbols);
/* fall into process_function_types. */
process_function_types:
/* Function result types are described as the result type in stabs.
We need to convert this to the function-returning-type-X type
in GDB. E.g. "int" is converted to "function returning int". */
if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_FUNC)
{
#if 0
/* This code doesn't work -- it needs to realloc and can't. */
/* Attempt to set up to record a function prototype... */
struct type *new = (struct type *)
obstack_alloc (&objfile -> type_obstack,
sizeof (struct type));
/* Generate a template for the type of this function. The
types of the arguments will be added as we read the symbol
table. */
*new = *lookup_function_type (SYMBOL_TYPE(sym));
SYMBOL_TYPE(sym) = new;
TYPE_OBJFILE (new) = objfile;
in_function_type = new;
#else
SYMBOL_TYPE (sym) = lookup_function_type (SYMBOL_TYPE (sym));
#endif
}
/* fall into process_prototype_types */
process_prototype_types:
/* Sun acc puts declared types of arguments here. We don't care
about their actual types (FIXME -- we should remember the whole
function prototype), but the list may define some new types
that we have to remember, so we must scan it now. */
while (*p == ';') {
p++;
read_type (&p, objfile);
}
break;
case 'F':
/* A global function definition. */
SYMBOL_CLASS (sym) = LOC_BLOCK;
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
add_symbol_to_list (sym, &global_symbols);
break;
goto process_function_types;
case 'G':
/* For a class G (global) symbol, it appears that the
@ -1435,14 +1440,13 @@ define_symbol (valu, string, desc, type, objfile)
#endif /* no BELIEVE_PCC_PROMOTION_TYPE. */
case 'P':
/* acc seems to use P to delare the prototypes of functions that
are referenced by this file. gdb is not prepared to deal
with this extra information. FIXME, it ought to. */
if (type == N_FUN)
goto process_prototype_types;
/* Parameter which is in a register. */
/* acc seems to use P to delare the types of functions that
are called by this file. gdb is not prepared to deal
with this extra information. */
if (processing_acc_compilation)
break;
SYMBOL_CLASS (sym) = LOC_REGPARM;
SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
if (SYMBOL_VALUE (sym) >= NUM_REGS)
@ -1953,6 +1957,16 @@ read_type (pp, objfile)
type = make_function_type (type1, dbx_lookup_type (typenums));
break;
case 'k': /* Const qualifier on some type (Sun) */
type = read_type (pp, objfile);
/* FIXME! For now, we ignore const and volatile qualifiers. */
break;
case 'B': /* Volatile qual on some type (Sun) */
type = read_type (pp, objfile);
/* FIXME! For now, we ignore const and volatile qualifiers. */
break;
/* FIXME -- we should be doing smash_to_XXX types here. */
case '@': /* Member (class & variable) type */
{
@ -2969,7 +2983,18 @@ read_enum_type (pp, type, objfile)
return type;
}
/* this is for the initial typedefs in every file (for int, long, etc) */
/* Sun's ACC uses a somewhat saner method for specifying the builtin
typedefs in every file (for int, long, etc):
type = b <signed> <width>; <offset>; <nbits>
signed = u or s. Possible c in addition to u or s (for char?).
offset = offset from high order bit to start bit of type.
width is # bytes in object of this type, nbits is # bits in type.
The width/offset stuff appears to be for small objects stored in
larger ones (e.g. `shorts' in `int' registers). We ignore it for now,
FIXME. */
static struct type *
read_sun_builtin_type (pp, typenums, objfile)
char **pp;

View File

@ -1629,7 +1629,7 @@ process_one_symbol (type, desc, valu, name, offset, objfile)
#if 0
/* It seems that the Sun ANSI C compiler (acc) replaces N_FUN with N_GSYM and
N_STSYM with a type code of f or F. Can't enable this until we get some
stuff straightened out with psymtabs. */
stuff straightened out with psymtabs. FIXME. */
case N_GSYM:
case N_STSYM:
@ -1916,13 +1916,14 @@ process_one_symbol (type, desc, valu, name, offset, objfile)
/* N_UNDF: Solaris 2: file separator mark */
/* N_UNDF: -- we will never encounter it, since we only process one
file's symbols at once. */
case N_ENDM: /* Solaris 2: End of module */
case N_MAIN: /* Name of main routine. */
break;
/* The following symbol types we don't know how to process. Handle
them in a "default" way, but complain to people who care. */
default:
case N_EHDECL: /* Exception handler name */
case N_MAIN: /* Name of main routine (not used in C) */
case N_PC: /* Global symbol in Pascal */
case N_M2C: /* Modula-2 compilation unit */
/* N_MOD2: overlaps with N_EHDECL */

View File

@ -274,7 +274,12 @@ elf_symtab_read (abfd, addr, objfile)
}
else
{
ms_type = mst_unknown;
/* FIXME: Solaris2 shared libraries include lots of
odd "absolute" and "undefined" symbols, that play
hob with actions like finding what function the PC
is in. Ignore them if they aren't text or data. */
/* ms_type = mst_unknown; */
continue; /* Skip this symbol. */
}
/* Pass symbol size field in via BFD. FIXME!!! */
record_minimal_symbol_and_info ((char *) sym -> name,

View File

@ -630,8 +630,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
case N_NSYMS: /* Ultrix 4.0: symbol count */
case N_DEFD: /* GNU Modula-2 */
case N_OBJ: /* two useless types from Solaris */
case N_OBJ: /* useless types from Solaris */
case N_OPT:
case N_ENDM:
/* These symbols aren't interesting; don't worry about them */
continue;