* gdbtypes.h (struct main_type): Move artificial flag out of

loc.  New member of ``struct field'' named static_kind.  Reduce
	overloaded meaning of bitsize.
	(FIELD_ARTIFICIAL, SET_FIELD_PHYSNAME, SET_FIELD_PHYSADDR)
	(TYPE_FIELD_STATIC, TYPE_FIELD_STATIC_HAS_ADDR): Likewise.
	(FIELD_STATIC_KIND, TYPE_FIELD_STATIC_KIND): New macros.

	* ada-lang.c (fill_in_ada_prototype): Initialize static_kind for
	new fields.
	(template_to_fixed_record_type, template_to_static_fixed_type)
	(to_record_with_fixed_variant_part): Likewise.
	* coffread.c (coff_read_struct_type, coff_read_enum_type): Likewise.
	* dwarf2read.c (dwarf2_add_field, read_enumeration): Likewise.
	* dwarfread.c (struct_type, enum_type): Likewise.
	* hpread.c (hpread_read_enum_type)
	(hpread_read_function_type, hpread_read_doc_function_type)
	(hpread_read_struct_type): Likewise.
	* mdebugread.c (parse_symbol): Likewise.
This commit is contained in:
Daniel Jacobowitz 2002-11-11 00:55:34 +00:00
parent 299aba957e
commit 01ad7f3617
8 changed files with 64 additions and 15 deletions

View file

@ -1,3 +1,24 @@
2002-11-10 Daniel Jacobowitz <drow@mvista.com>
* gdbtypes.h (struct main_type): Move artificial flag out of
loc. New member of ``struct field'' named static_kind. Reduce
overloaded meaning of bitsize.
(FIELD_ARTIFICIAL, SET_FIELD_PHYSNAME, SET_FIELD_PHYSADDR)
(TYPE_FIELD_STATIC, TYPE_FIELD_STATIC_HAS_ADDR): Likewise.
(FIELD_STATIC_KIND, TYPE_FIELD_STATIC_KIND): New macros.
* ada-lang.c (fill_in_ada_prototype): Initialize static_kind for
new fields.
(template_to_fixed_record_type, template_to_static_fixed_type)
(to_record_with_fixed_variant_part): Likewise.
* coffread.c (coff_read_struct_type, coff_read_enum_type): Likewise.
* dwarf2read.c (dwarf2_add_field, read_enumeration): Likewise.
* dwarfread.c (struct_type, enum_type): Likewise.
* hpread.c (hpread_read_enum_type)
(hpread_read_function_type, hpread_read_doc_function_type)
(hpread_read_struct_type): Likewise.
* mdebugread.c (parse_symbol): Likewise.
2002-11-10 Andrew Cagney <ac131313@redhat.com> 2002-11-10 Andrew Cagney <ac131313@redhat.com>
* breakpoint.h (deprecated_frame_in_dummy): Rename frame_in_dummy. * breakpoint.h (deprecated_frame_in_dummy): Rename frame_in_dummy.

View file

@ -4189,6 +4189,7 @@ fill_in_ada_prototype (struct symbol *func)
case LOC_REGPARM_ADDR: case LOC_REGPARM_ADDR:
TYPE_FIELD_BITPOS (ftype, nargs) = nargs; TYPE_FIELD_BITPOS (ftype, nargs) = nargs;
TYPE_FIELD_BITSIZE (ftype, nargs) = 0; TYPE_FIELD_BITSIZE (ftype, nargs) = 0;
TYPE_FIELD_STATIC_KIND (ftype, nargs) = 0;
TYPE_FIELD_TYPE (ftype, nargs) = TYPE_FIELD_TYPE (ftype, nargs) =
lookup_pointer_type (check_typedef (SYMBOL_TYPE (sym))); lookup_pointer_type (check_typedef (SYMBOL_TYPE (sym)));
TYPE_FIELD_NAME (ftype, nargs) = SYMBOL_NAME (sym); TYPE_FIELD_NAME (ftype, nargs) = SYMBOL_NAME (sym);
@ -4202,6 +4203,7 @@ fill_in_ada_prototype (struct symbol *func)
case LOC_BASEREG_ARG: case LOC_BASEREG_ARG:
TYPE_FIELD_BITPOS (ftype, nargs) = nargs; TYPE_FIELD_BITPOS (ftype, nargs) = nargs;
TYPE_FIELD_BITSIZE (ftype, nargs) = 0; TYPE_FIELD_BITSIZE (ftype, nargs) = 0;
TYPE_FIELD_STATIC_KIND (ftype, nargs) = 0;
TYPE_FIELD_TYPE (ftype, nargs) = check_typedef (SYMBOL_TYPE (sym)); TYPE_FIELD_TYPE (ftype, nargs) = check_typedef (SYMBOL_TYPE (sym));
TYPE_FIELD_NAME (ftype, nargs) = SYMBOL_NAME (sym); TYPE_FIELD_NAME (ftype, nargs) = SYMBOL_NAME (sym);
nargs += 1; nargs += 1;
@ -6046,6 +6048,7 @@ template_to_fixed_record_type (struct type *type, char *valaddr,
* rediscover why we needed field_offset and fix it properly. */ * rediscover why we needed field_offset and fix it properly. */
TYPE_FIELD_BITPOS (rtype, f) = off; TYPE_FIELD_BITPOS (rtype, f) = off;
TYPE_FIELD_BITSIZE (rtype, f) = 0; TYPE_FIELD_BITSIZE (rtype, f) = 0;
TYPE_FIELD_STATIC_KIND (rtype, f) = 0;
if (ada_is_variant_part (type, f)) if (ada_is_variant_part (type, f))
{ {
@ -6149,6 +6152,7 @@ template_to_static_fixed_type (struct type *templ_type)
{ {
TYPE_FIELD_BITPOS (type, f) = 0; TYPE_FIELD_BITPOS (type, f) = 0;
TYPE_FIELD_BITSIZE (type, f) = 0; TYPE_FIELD_BITSIZE (type, f) = 0;
TYPE_FIELD_STATIC_KIND (type, f) = 0;
if (is_dynamic_field (templ_type, f)) if (is_dynamic_field (templ_type, f))
{ {
@ -6218,6 +6222,7 @@ to_record_with_fixed_variant_part (struct type *type, char *valaddr,
TYPE_FIELD_TYPE (rtype, nfields - 1) = branch_type; TYPE_FIELD_TYPE (rtype, nfields - 1) = branch_type;
TYPE_FIELD_NAME (rtype, nfields - 1) = "S"; TYPE_FIELD_NAME (rtype, nfields - 1) = "S";
TYPE_FIELD_BITSIZE (rtype, nfields - 1) = 0; TYPE_FIELD_BITSIZE (rtype, nfields - 1) = 0;
TYPE_FIELD_STATIC_KIND (rtype, nfields - 1) = 0;
TYPE_LENGTH (rtype) += TYPE_LENGTH (branch_type); TYPE_LENGTH (rtype) += TYPE_LENGTH (branch_type);
-TYPE_LENGTH (TYPE_FIELD_TYPE (type, nfields - 1)); -TYPE_LENGTH (TYPE_FIELD_TYPE (type, nfields - 1));
} }

View file

@ -1997,6 +1997,7 @@ coff_read_struct_type (int index, int length, int lastsym)
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux); FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux);
FIELD_BITPOS (list->field) = 8 * ms->c_value; FIELD_BITPOS (list->field) = 8 * ms->c_value;
FIELD_BITSIZE (list->field) = 0; FIELD_BITSIZE (list->field) = 0;
FIELD_STATIC_KIND (list->field) = 0;
nfields++; nfields++;
break; break;
@ -2015,6 +2016,7 @@ coff_read_struct_type (int index, int length, int lastsym)
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux); FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux);
FIELD_BITPOS (list->field) = ms->c_value; FIELD_BITPOS (list->field) = ms->c_value;
FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size; FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size;
FIELD_STATIC_KIND (list->field) = 0;
nfields++; nfields++;
break; break;
@ -2135,6 +2137,7 @@ coff_read_enum_type (int index, int length, int lastsym)
if (SYMBOL_VALUE (xsym) < 0) if (SYMBOL_VALUE (xsym) < 0)
unsigned_enum = 0; unsigned_enum = 0;
TYPE_FIELD_BITSIZE (type, n) = 0; TYPE_FIELD_BITSIZE (type, n) = 0;
TYPE_FIELD_STATIC_KIND (type, n) = 0;
} }
if (syms == osyms) if (syms == osyms)
break; break;

View file

@ -2149,6 +2149,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
/* Get type of field. */ /* Get type of field. */
fp->type = die_type (die, objfile, cu_header); fp->type = die_type (die, objfile, cu_header);
FIELD_STATIC_KIND (*fp) = 0;
/* Get bit size of field (zero if none). */ /* Get bit size of field (zero if none). */
attr = dwarf_attr (die, DW_AT_bit_size); attr = dwarf_attr (die, DW_AT_bit_size);
if (attr) if (attr)
@ -2257,6 +2259,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
FIELD_BITPOS (*fp) = (decode_locdesc (DW_BLOCK (attr), objfile, cu_header) FIELD_BITPOS (*fp) = (decode_locdesc (DW_BLOCK (attr), objfile, cu_header)
* bits_per_byte); * bits_per_byte);
FIELD_BITSIZE (*fp) = 0; FIELD_BITSIZE (*fp) = 0;
FIELD_STATIC_KIND (*fp) = 0;
FIELD_TYPE (*fp) = die_type (die, objfile, cu_header); FIELD_TYPE (*fp) = die_type (die, objfile, cu_header);
FIELD_NAME (*fp) = type_name_no_tag (fp->type); FIELD_NAME (*fp) = type_name_no_tag (fp->type);
fip->nbaseclasses++; fip->nbaseclasses++;
@ -2761,6 +2764,7 @@ read_enumeration (struct die_info *die, struct objfile *objfile,
FIELD_TYPE (fields[num_fields]) = NULL; FIELD_TYPE (fields[num_fields]) = NULL;
FIELD_BITPOS (fields[num_fields]) = SYMBOL_VALUE (sym); FIELD_BITPOS (fields[num_fields]) = SYMBOL_VALUE (sym);
FIELD_BITSIZE (fields[num_fields]) = 0; FIELD_BITSIZE (fields[num_fields]) = 0;
FIELD_STATIC_KIND (fields[num_fields]) = 0;
num_fields++; num_fields++;
} }

View file

@ -1027,6 +1027,7 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie,
&objfile->type_obstack); &objfile->type_obstack);
FIELD_TYPE (list->field) = decode_die_type (&mbr); FIELD_TYPE (list->field) = decode_die_type (&mbr);
FIELD_BITPOS (list->field) = 8 * locval (&mbr); FIELD_BITPOS (list->field) = 8 * locval (&mbr);
FIELD_STATIC_KIND (list->field) = 0;
/* Handle bit fields. */ /* Handle bit fields. */
FIELD_BITSIZE (list->field) = mbr.at_bit_size; FIELD_BITSIZE (list->field) = mbr.at_bit_size;
if (BITS_BIG_ENDIAN) if (BITS_BIG_ENDIAN)
@ -1694,6 +1695,7 @@ enum_type (struct dieinfo *dip, struct objfile *objfile)
list = new; list = new;
FIELD_TYPE (list->field) = NULL; FIELD_TYPE (list->field) = NULL;
FIELD_BITSIZE (list->field) = 0; FIELD_BITSIZE (list->field) = 0;
FIELD_STATIC_KIND (list->field) = 0;
FIELD_BITPOS (list->field) = FIELD_BITPOS (list->field) =
target_to_host (scan, TARGET_FT_LONG_SIZE (objfile), GET_SIGNED, target_to_host (scan, TARGET_FT_LONG_SIZE (objfile), GET_SIGNED,
objfile); objfile);

View file

@ -397,22 +397,25 @@ struct main_type
CORE_ADDR physaddr; CORE_ADDR physaddr;
char *physname; char *physname;
/* For a function or member type, this is 1 if the argument is marked
artificial. Artificial arguments should not be shown to the
user. */
int artificial;
} }
loc; loc;
/* For a function or member type, this is 1 if the argument is marked
artificial. Artificial arguments should not be shown to the
user. */
unsigned int artificial : 1;
/* This flag is zero for non-static fields, 1 for fields whose location
is specified by the label loc.physname, and 2 for fields whose location
is specified by loc.physaddr. */
unsigned int static_kind : 2;
/* Size of this field, in bits, or zero if not packed. /* Size of this field, in bits, or zero if not packed.
For an unpacked field, the field's type's length For an unpacked field, the field's type's length
says how many bytes the field occupies. says how many bytes the field occupies. */
A value of -1 or -2 indicates a static field; -1 means the location
is specified by the label loc.physname; -2 means that loc.physaddr
specifies the actual address. */
int bitsize; unsigned int bitsize : 29;
/* In a struct or union type, type of this field. /* In a struct or union type, type of this field.
In a function or member type, type of this argument. In a function or member type, type of this argument.
@ -809,14 +812,15 @@ extern void allocate_cplus_struct_type (struct type *);
#define FIELD_TYPE(thisfld) ((thisfld).type) #define FIELD_TYPE(thisfld) ((thisfld).type)
#define FIELD_NAME(thisfld) ((thisfld).name) #define FIELD_NAME(thisfld) ((thisfld).name)
#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos) #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
#define FIELD_ARTIFICIAL(thisfld) ((thisfld).loc.artificial) #define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize) #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
#define FIELD_STATIC_KIND(thisfld) ((thisfld).static_kind)
#define FIELD_PHYSNAME(thisfld) ((thisfld).loc.physname) #define FIELD_PHYSNAME(thisfld) ((thisfld).loc.physname)
#define FIELD_PHYSADDR(thisfld) ((thisfld).loc.physaddr) #define FIELD_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
#define SET_FIELD_PHYSNAME(thisfld, name) \ #define SET_FIELD_PHYSNAME(thisfld, name) \
((thisfld).bitsize = -1, FIELD_PHYSNAME(thisfld) = (name)) ((thisfld).static_kind = 1, FIELD_PHYSNAME(thisfld) = (name))
#define SET_FIELD_PHYSADDR(thisfld, name) \ #define SET_FIELD_PHYSADDR(thisfld, name) \
((thisfld).bitsize = -2, FIELD_PHYSADDR(thisfld) = (name)) ((thisfld).static_kind = 2, FIELD_PHYSADDR(thisfld) = (name))
#define TYPE_FIELD(thistype, n) TYPE_MAIN_TYPE(thistype)->fields[n] #define TYPE_FIELD(thistype, n) TYPE_MAIN_TYPE(thistype)->fields[n]
#define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE(TYPE_FIELD(thistype, n)) #define TYPE_FIELD_TYPE(thistype, n) FIELD_TYPE(TYPE_FIELD(thistype, n))
#define TYPE_FIELD_NAME(thistype, n) FIELD_NAME(TYPE_FIELD(thistype, n)) #define TYPE_FIELD_NAME(thistype, n) FIELD_NAME(TYPE_FIELD(thistype, n))
@ -856,8 +860,9 @@ extern void allocate_cplus_struct_type (struct type *);
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \ (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n))) : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n)))
#define TYPE_FIELD_STATIC(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].bitsize < 0) #define TYPE_FIELD_STATIC(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].static_kind != 0)
#define TYPE_FIELD_STATIC_HAS_ADDR(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].bitsize == -2) #define TYPE_FIELD_STATIC_KIND(thistype, n) TYPE_MAIN_TYPE (thistype)->fields[n].static_kind
#define TYPE_FIELD_STATIC_HAS_ADDR(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].static_kind == 2)
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_PHYSNAME(TYPE_FIELD(thistype, n)) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_PHYSNAME(TYPE_FIELD(thistype, n))
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_PHYSADDR(TYPE_FIELD(thistype, n)) #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_PHYSADDR(TYPE_FIELD(thistype, n))

View file

@ -3186,6 +3186,7 @@ hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp,
TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym); TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym);
TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym); TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym);
TYPE_FIELD_BITSIZE (type, n) = 0; TYPE_FIELD_BITSIZE (type, n) = 0;
TYPE_FIELD_STATIC_KIND (type, n) = 0;
} }
if (syms == osyms) if (syms == osyms)
break; break;
@ -3347,6 +3348,7 @@ hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym); TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym);
TYPE_FIELD_ARTIFICIAL (type, n) = 0; TYPE_FIELD_ARTIFICIAL (type, n) = 0;
TYPE_FIELD_BITSIZE (type, n) = 0; TYPE_FIELD_BITSIZE (type, n) = 0;
TYPE_FIELD_STATIC_KIND (type, n) = 0;
} }
} }
/* Mark it as having been processed */ /* Mark it as having been processed */
@ -3520,6 +3522,7 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym); TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym);
TYPE_FIELD_ARTIFICIAL (type, n) = 0; TYPE_FIELD_ARTIFICIAL (type, n) = 0;
TYPE_FIELD_BITSIZE (type, n) = 0; TYPE_FIELD_BITSIZE (type, n) = 0;
TYPE_FIELD_STATIC_KIND (type, n) = 0;
} }
} }
@ -3704,6 +3707,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
list = new; list = new;
FIELD_BITSIZE (list->field) = 0; FIELD_BITSIZE (list->field) = 0;
FIELD_STATIC_KIND (list->field) = 0;
/* The "classname" field is actually a DNTT pointer to the base class */ /* The "classname" field is actually a DNTT pointer to the base class */
baseclass = hpread_type_lookup (parentp->dinheritance.classname, baseclass = hpread_type_lookup (parentp->dinheritance.classname,
@ -4101,6 +4105,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
list->field.name = VT (objfile) + fn_fieldp->dsvar.name; list->field.name = VT (objfile) + fn_fieldp->dsvar.name;
FIELD_BITPOS (list->field) = 0; /* FIXME is this always true? */ FIELD_BITPOS (list->field) = 0; /* FIXME is this always true? */
FIELD_BITSIZE (list->field) = 0; /* use length from type */ FIELD_BITSIZE (list->field) = 0; /* use length from type */
FIELD_STATIC_KIND (list->field) = 0;
memtype = hpread_type_lookup (fn_fieldp->dsvar.type, objfile); memtype = hpread_type_lookup (fn_fieldp->dsvar.type, objfile);
list->field.type = memtype; list->field.type = memtype;
list->attributes = 0; list->attributes = 0;
@ -4120,6 +4125,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
list->field.name = VT (objfile) + fn_fieldp->ddvar.name; list->field.name = VT (objfile) + fn_fieldp->ddvar.name;
FIELD_BITPOS (list->field) = 0; /* FIXME is this always true? */ FIELD_BITPOS (list->field) = 0; /* FIXME is this always true? */
FIELD_BITSIZE (list->field) = 0; /* use length from type */ FIELD_BITSIZE (list->field) = 0; /* use length from type */
FIELD_STATIC_KIND (list->field) = 0;
memtype = hpread_type_lookup (fn_fieldp->ddvar.type, objfile); memtype = hpread_type_lookup (fn_fieldp->ddvar.type, objfile);
list->field.type = memtype; list->field.type = memtype;
list->attributes = 0; list->attributes = 0;
@ -4168,6 +4174,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
/* A FIELD by itself (without a GENFIELD) can also be a static member */ /* A FIELD by itself (without a GENFIELD) can also be a static member */
FIELD_STATIC_KIND (list->field) = 0;
if (fieldp->dfield.staticmem) if (fieldp->dfield.staticmem)
{ {
FIELD_BITPOS (list->field) = -1; FIELD_BITPOS (list->field) = -1;

View file

@ -1092,6 +1092,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
FIELD_TYPE (*f) = t; FIELD_TYPE (*f) = t;
FIELD_NAME (*f) = debug_info->ss + cur_fdr->issBase + tsym.iss; FIELD_NAME (*f) = debug_info->ss + cur_fdr->issBase + tsym.iss;
FIELD_BITSIZE (*f) = 0; FIELD_BITSIZE (*f) = 0;
FIELD_STATIC_KIND (*f) = 0;
enum_sym = ((struct symbol *) enum_sym = ((struct symbol *)
obstack_alloc (&current_objfile->symbol_obstack, obstack_alloc (&current_objfile->symbol_obstack,
@ -1284,6 +1285,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
bitsize = 0; bitsize = 0;
FIELD_TYPE (*f) = parse_type (cur_fd, ax, sh->index, &bitsize, bigend, name); FIELD_TYPE (*f) = parse_type (cur_fd, ax, sh->index, &bitsize, bigend, name);
FIELD_BITSIZE (*f) = bitsize; FIELD_BITSIZE (*f) = bitsize;
FIELD_STATIC_KIND (*f) = 0;
break; break;
case stIndirect: /* forward declaration on Irix5 */ case stIndirect: /* forward declaration on Irix5 */