diff options
author | Daniel Jacobowitz <dan@debian.org> | 2002-11-11 00:55:34 +0000 |
---|---|---|
committer | Daniel Jacobowitz <dan@debian.org> | 2002-11-11 00:55:34 +0000 |
commit | 6e1f25137ad153f6275e27d8d16b9228a2882bce (patch) | |
tree | d6b88706cc655c23c6b1e7ab1bc8783a38931ea2 | |
parent | 1cb1086bc277ef2db96cc16147db4abaeb51996c (diff) | |
download | gdb-6e1f25137ad153f6275e27d8d16b9228a2882bce.tar.gz |
* 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.
-rw-r--r-- | gdb/ChangeLog | 21 | ||||
-rw-r--r-- | gdb/ada-lang.c | 5 | ||||
-rw-r--r-- | gdb/coffread.c | 3 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 4 | ||||
-rw-r--r-- | gdb/dwarfread.c | 2 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 35 | ||||
-rw-r--r-- | gdb/hpread.c | 7 | ||||
-rw-r--r-- | gdb/mdebugread.c | 2 |
8 files changed, 64 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ba4ed96646f..f0547244b45 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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> * breakpoint.h (deprecated_frame_in_dummy): Rename frame_in_dummy. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 25fb92d201c..1e526eb9378 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4189,6 +4189,7 @@ fill_in_ada_prototype (struct symbol *func) case LOC_REGPARM_ADDR: TYPE_FIELD_BITPOS (ftype, nargs) = nargs; TYPE_FIELD_BITSIZE (ftype, nargs) = 0; + TYPE_FIELD_STATIC_KIND (ftype, nargs) = 0; TYPE_FIELD_TYPE (ftype, nargs) = lookup_pointer_type (check_typedef (SYMBOL_TYPE (sym))); TYPE_FIELD_NAME (ftype, nargs) = SYMBOL_NAME (sym); @@ -4202,6 +4203,7 @@ fill_in_ada_prototype (struct symbol *func) case LOC_BASEREG_ARG: TYPE_FIELD_BITPOS (ftype, nargs) = nargs; 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_NAME (ftype, nargs) = SYMBOL_NAME (sym); 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. */ TYPE_FIELD_BITPOS (rtype, f) = off; TYPE_FIELD_BITSIZE (rtype, f) = 0; + TYPE_FIELD_STATIC_KIND (rtype, f) = 0; 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_BITSIZE (type, f) = 0; + TYPE_FIELD_STATIC_KIND (type, f) = 0; 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_NAME (rtype, nfields - 1) = "S"; TYPE_FIELD_BITSIZE (rtype, nfields - 1) = 0; + TYPE_FIELD_STATIC_KIND (rtype, nfields - 1) = 0; TYPE_LENGTH (rtype) += TYPE_LENGTH (branch_type); -TYPE_LENGTH (TYPE_FIELD_TYPE (type, nfields - 1)); } diff --git a/gdb/coffread.c b/gdb/coffread.c index e511a4ceab5..7872624b682 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -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_BITPOS (list->field) = 8 * ms->c_value; FIELD_BITSIZE (list->field) = 0; + FIELD_STATIC_KIND (list->field) = 0; nfields++; 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_BITPOS (list->field) = ms->c_value; FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size; + FIELD_STATIC_KIND (list->field) = 0; nfields++; break; @@ -2135,6 +2137,7 @@ coff_read_enum_type (int index, int length, int lastsym) if (SYMBOL_VALUE (xsym) < 0) unsigned_enum = 0; TYPE_FIELD_BITSIZE (type, n) = 0; + TYPE_FIELD_STATIC_KIND (type, n) = 0; } if (syms == osyms) break; diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 13ddaea6530..b5ba7dc713d 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2149,6 +2149,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, /* Get type of field. */ fp->type = die_type (die, objfile, cu_header); + FIELD_STATIC_KIND (*fp) = 0; + /* Get bit size of field (zero if none). */ attr = dwarf_attr (die, DW_AT_bit_size); 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) * bits_per_byte); FIELD_BITSIZE (*fp) = 0; + FIELD_STATIC_KIND (*fp) = 0; FIELD_TYPE (*fp) = die_type (die, objfile, cu_header); FIELD_NAME (*fp) = type_name_no_tag (fp->type); fip->nbaseclasses++; @@ -2761,6 +2764,7 @@ read_enumeration (struct die_info *die, struct objfile *objfile, FIELD_TYPE (fields[num_fields]) = NULL; FIELD_BITPOS (fields[num_fields]) = SYMBOL_VALUE (sym); FIELD_BITSIZE (fields[num_fields]) = 0; + FIELD_STATIC_KIND (fields[num_fields]) = 0; num_fields++; } diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index dc8be381f26..f8254c95068 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -1027,6 +1027,7 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie, &objfile->type_obstack); FIELD_TYPE (list->field) = decode_die_type (&mbr); FIELD_BITPOS (list->field) = 8 * locval (&mbr); + FIELD_STATIC_KIND (list->field) = 0; /* Handle bit fields. */ FIELD_BITSIZE (list->field) = mbr.at_bit_size; if (BITS_BIG_ENDIAN) @@ -1694,6 +1695,7 @@ enum_type (struct dieinfo *dip, struct objfile *objfile) list = new; FIELD_TYPE (list->field) = NULL; FIELD_BITSIZE (list->field) = 0; + FIELD_STATIC_KIND (list->field) = 0; FIELD_BITPOS (list->field) = target_to_host (scan, TARGET_FT_LONG_SIZE (objfile), GET_SIGNED, objfile); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index d4d9afedec6..fe4b0f12bdc 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -397,22 +397,25 @@ struct main_type CORE_ADDR physaddr; 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; + /* 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. For an unpacked field, the field's type's length - 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. */ + says how many bytes the field occupies. */ - int bitsize; + unsigned int bitsize : 29; /* In a struct or union type, type of this field. 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_NAME(thisfld) ((thisfld).name) #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_STATIC_KIND(thisfld) ((thisfld).static_kind) #define FIELD_PHYSNAME(thisfld) ((thisfld).loc.physname) #define FIELD_PHYSADDR(thisfld) ((thisfld).loc.physaddr) #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) \ - ((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_TYPE(thistype, n) FIELD_TYPE(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 \ : 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_HAS_ADDR(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].bitsize == -2) +#define TYPE_FIELD_STATIC(thistype, n) (TYPE_MAIN_TYPE (thistype)->fields[n].static_kind != 0) +#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_PHYSADDR(thistype, n) FIELD_PHYSADDR(TYPE_FIELD(thistype, n)) diff --git a/gdb/hpread.c b/gdb/hpread.c index 08aa426270e..0011c31d7a6 100644 --- a/gdb/hpread.c +++ b/gdb/hpread.c @@ -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_BITPOS (type, n) = SYMBOL_VALUE (xsym); TYPE_FIELD_BITSIZE (type, n) = 0; + TYPE_FIELD_STATIC_KIND (type, n) = 0; } if (syms == osyms) 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_ARTIFICIAL (type, n) = 0; TYPE_FIELD_BITSIZE (type, n) = 0; + TYPE_FIELD_STATIC_KIND (type, n) = 0; } } /* 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_ARTIFICIAL (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; FIELD_BITSIZE (list->field) = 0; + FIELD_STATIC_KIND (list->field) = 0; /* The "classname" field is actually a DNTT pointer to the base class */ 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; FIELD_BITPOS (list->field) = 0; /* FIXME is this always true? */ FIELD_BITSIZE (list->field) = 0; /* use length from type */ + FIELD_STATIC_KIND (list->field) = 0; memtype = hpread_type_lookup (fn_fieldp->dsvar.type, objfile); list->field.type = memtype; 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; FIELD_BITPOS (list->field) = 0; /* FIXME is this always true? */ FIELD_BITSIZE (list->field) = 0; /* use length from type */ + FIELD_STATIC_KIND (list->field) = 0; memtype = hpread_type_lookup (fn_fieldp->ddvar.type, objfile); list->field.type = memtype; 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 */ + FIELD_STATIC_KIND (list->field) = 0; if (fieldp->dfield.staticmem) { FIELD_BITPOS (list->field) = -1; diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index cdf800d67b8..ed13fa3364a 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1092,6 +1092,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, FIELD_TYPE (*f) = t; FIELD_NAME (*f) = debug_info->ss + cur_fdr->issBase + tsym.iss; FIELD_BITSIZE (*f) = 0; + FIELD_STATIC_KIND (*f) = 0; enum_sym = ((struct symbol *) obstack_alloc (¤t_objfile->symbol_obstack, @@ -1284,6 +1285,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, bitsize = 0; FIELD_TYPE (*f) = parse_type (cur_fd, ax, sh->index, &bitsize, bigend, name); FIELD_BITSIZE (*f) = bitsize; + FIELD_STATIC_KIND (*f) = 0; break; case stIndirect: /* forward declaration on Irix5 */ |