Re: [patch] static_kind -> bit0, bit1 [Re: [gdb] Fortran dynamic arrays]

Jan Kratochvil
2008-10-07T23:18:15Z

[-- Attachment #1: Type: text/plain, Size: 1532 bytes --]

On Mon, 06 Oct 2008 22:00:01 +0200, Joel Brobecker wrote:
> > +enum field_loc_kind
> > + {
> > + FIELD_LOC_KIND_BITPOS, /* bitpos */
>
> Is it worth forcing the value of FIELD_LOC_KIND_BITPOS to zero?
>
> FIELD_LOC_KIND_BITPOS = 0,
>
> (this is where my lack of knowledge of C shows up)

No, according to ISO C99 enums with no assignments get values 0, 1, 2...

> int
> field_is_static (struct field *f)
> {
> /* "static" fields are the fields whose location is not relative
> to the address of the enclosing struct. It would be nice to
> have a dedicated flag that would be set for static fields when
> the type is being created. But in practice, checking the field
> loc_kind should give us an accurate answer (at least as long as
> we assume that DWARF block locations are not going to be used
> for static fields). FIXME? */
> return (FIELD_LOC_KIND (*f) == FIELD_LOC_KIND_PHYSNAME
> || FIELD_LOC_KIND (*f) == FIELD_LOC_KIND_PHYSADDR);
> }

Included. FIELD_LOC_KIND_DWARF_BLOCK could be even asserted-out as the
current patchset uses FIELD_LOC_KIND_DWARF_BLOCK only for TYPE_CODE_RANGE
fields (low/high/stride) upon whose field_is_static() is never called.

> Can we replace the "FIELD_STATIC_KIND = 0" line by "SET_FIELD_BITPOS
> (*fp, 0);" and then remove the "else" part below?

Done.

Included you as a co-author of this patch. OK to apply?
Regression-tested only on x86_64-unknown-linux-gnu.

Thanks,
Jan

[-- Attachment #2: fortran9-bit01.patch --]
[-- Type: text/plain, Size: 23278 bytes --]

2008-10-08 Jan Kratochvil <jan.kratochvil@redhat.com>
Joel Brobecker <brobecker@adacore.com>

Convert static_kind into loc_kind enum.
* gdbtypes.h (enum field_loc_kind): New.
(union field_location): New field dwarf_block.
(struct field): Rename static_kind as loc_kind.
(FIELD_STATIC_KIND): Rename to ...
(FIELD_LOC_KIND): ... here.
(TYPE_FIELD_STATIC_KIND): Rename to ...
(TYPE_FIELD_LOC_KIND): ... here and use there now new FIELD_LOC_KIND.
(TYPE_FIELD_STATIC_HAS_ADDR): Remove.
(TYPE_FIELD_STATIC): Remove.
(TYPE_FIELD_BITPOS): Reformat.
(SET_FIELD_BITPOS): New.
(FIELD_PHYSADDR): Rename to ...
(FIELD_STATIC_PHYSADDR): ... here.
(TYPE_FIELD_STATIC_PHYSADDR): Follow the FIELD_PHYSADDR rename.
(SET_FIELD_PHYSADDR): Use new FIELD_LOC_KIND.
(FIELD_PHYSNAME): Rename to ...
(FIELD_STATIC_PHYSNAME): ... here.
(TYPE_FIELD_STATIC_PHYSNAME): Follow the FIELD_PHYSNAME rename.
(SET_FIELD_PHYSNAME): Use new FIELD_LOC_KIND.
(FIELD_DWARF_BLOCK, TYPE_FIELD_DWARF_BLOCK, SET_FIELD_DWARF_BLOCK): New.
(field_is_static): New declaration.
* gdbtypes.c (field_is_static): New function.
(copy_type_recursive): Update throughout.
* amd64-tdep.c, c-typeprint.c, coffread.c, cp-valprint.c, dwarf2read.c,
eval.c, jv-typeprint.c, jv-valprint.c, mdebugread.c, p-typeprint.c,
p-valprint.c, valops.c, value.c, varobj.c: Update throughout.

--- gdb/amd64-tdep.c 11 Sep 2008 14:23:15 -0000 1.54
+++ gdb/amd64-tdep.c 7 Oct 2008 22:25:44 -0000
@@ -316,7 +316,7 @@ amd64_classify_aggregate (struct type *t
enum amd64_reg_class subclass[2];

/* Ignore static fields. */
- if (TYPE_FIELD_STATIC (type, i))
+ if (field_is_static (&TYPE_FIELD (type, i)))
continue;

gdb_assert (pos == 0 || pos == 1);
--- gdb/c-typeprint.c 2 Oct 2008 22:06:07 -0000 1.44
+++ gdb/c-typeprint.c 7 Oct 2008 22:25:46 -0000
@@ -890,14 +890,12 @@ c_type_print_base (struct type *type, st
}

print_spaces_filtered (level + 4, stream);
- if (TYPE_FIELD_STATIC (type, i))
- {
- fprintf_filtered (stream, "static ");
- }
+ if (field_is_static (&TYPE_FIELD (type, i)))
+ fprintf_filtered (stream, "static ");
c_print_type (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
stream, show - 1, level + 4);
- if (!TYPE_FIELD_STATIC (type, i)
+ if (!field_is_static (&TYPE_FIELD (type, i))
&& TYPE_FIELD_PACKED (type, i))
{
/* It is a bitfield. This code does not attempt
--- gdb/coffread.c 1 Oct 2008 16:41:27 -0000 1.86
+++ gdb/coffread.c 7 Oct 2008 22:25:47 -0000
@@ -1943,9 +1943,8 @@ coff_read_struct_type (int index, int le
obsavestring (name, strlen (name), &objfile->objfile_obstack);
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux,
objfile);
- FIELD_BITPOS (list->field) = 8 * ms->c_value;
+ SET_FIELD_BITPOS (list->field, 8 * ms->c_value);
FIELD_BITSIZE (list->field) = 0;
- FIELD_STATIC_KIND (list->field) = 0;
nfields++;
break;

@@ -1961,9 +1960,8 @@ coff_read_struct_type (int index, int le
obsavestring (name, strlen (name), &objfile->objfile_obstack);
FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux,
objfile);
- FIELD_BITPOS (list->field) = ms->c_value;
+ SET_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;

@@ -2080,11 +2078,10 @@ coff_read_enum_type (int index, int leng
struct symbol *xsym = syms->symbol[j];
SYMBOL_TYPE (xsym) = type;
TYPE_FIELD_NAME (type, n) = SYMBOL_LINKAGE_NAME (xsym);
- TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym);
+ SET_FIELD_BITPOS (TYPE_FIELD (type, n), SYMBOL_VALUE (xsym));
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;
--- gdb/cp-valprint.c 11 Sep 2008 14:24:27 -0000 1.54
+++ gdb/cp-valprint.c 7 Oct 2008 22:25:47 -0000
@@ -192,7 +192,8 @@ cp_print_value_fields (struct type *type
for (i = n_baseclasses; i < len; i++)
{
/* If requested, skip printing of static fields. */
- if (!static_field_print && TYPE_FIELD_STATIC (type, i))
+ if (!static_field_print
+ && field_is_static (&TYPE_FIELD (type, i)))
continue;

if (fields_seen)
@@ -225,7 +226,7 @@ cp_print_value_fields (struct type *type
fputs_filtered ("\"( ptr \"", stream);
else
fputs_filtered ("\"( nodef \"", stream);
- if (TYPE_FIELD_STATIC (type, i))
+ if (field_is_static (&TYPE_FIELD (type, i)))
fputs_filtered ("static ", stream);
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
current_language->la_language,
@@ -240,7 +241,7 @@ cp_print_value_fields (struct type *type
{
annotate_field_begin (TYPE_FIELD_TYPE (type, i));

- if (TYPE_FIELD_STATIC (type, i))
+ if (field_is_static (&TYPE_FIELD (type, i)))
fputs_filtered ("static ", stream);
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
current_language->la_language,
@@ -252,7 +253,8 @@ cp_print_value_fields (struct type *type
annotate_field_value ();
}

- if (!TYPE_FIELD_STATIC (type, i) && TYPE_FIELD_PACKED (type, i))
+ if (!field_is_static (&TYPE_FIELD (type, i))
+ && TYPE_FIELD_PACKED (type, i))
{
struct value *v;

@@ -278,7 +280,7 @@ cp_print_value_fields (struct type *type
{
fputs_filtered ("<optimized out or zero length>", stream);
}
- else if (TYPE_FIELD_STATIC (type, i))
+ else if (field_is_static (&TYPE_FIELD (type, i)))
{
struct value *v = value_static_field (type, i);
if (v == NULL)
--- gdb/dwarf2read.c 6 Oct 2008 22:23:17 -0000 1.287
+++ gdb/dwarf2read.c 7 Oct 2008 22:25:55 -0000
@@ -3588,7 +3588,7 @@ dwarf2_add_field (struct field_info *fip
/* Get type of field. */
fp->type = die_type (die, cu);

- FIELD_STATIC_KIND (*fp) = 0;
+ SET_FIELD_BITPOS (*fp, 0);

/* Get bit size of field (zero if none). */
attr = dwarf2_attr (die, DW_AT_bit_size, cu);
@@ -3617,10 +3617,8 @@ dwarf2_add_field (struct field_info *fip
else
byte_offset = decode_locdesc (DW_BLOCK (attr), cu);

- FIELD_BITPOS (*fp) = byte_offset * bits_per_byte;
+ SET_FIELD_BITPOS (*fp, byte_offset * bits_per_byte);
}
- else
- FIELD_BITPOS (*fp) = 0;
attr = dwarf2_attr (die, DW_AT_bit_offset, cu);
if (attr)
{
@@ -3712,10 +3710,9 @@ dwarf2_add_field (struct field_info *fip
/* C++ base class field. */
attr = dwarf2_attr (die, DW_AT_data_member_location, cu);
if (attr)
- FIELD_BITPOS (*fp) = (decode_locdesc (DW_BLOCK (attr), cu)
- * bits_per_byte);
+ SET_FIELD_BITPOS (*fp, decode_locdesc (DW_BLOCK (attr), cu)
+ * bits_per_byte);
FIELD_BITSIZE (*fp) = 0;
- FIELD_STATIC_KIND (*fp) = 0;
FIELD_TYPE (*fp) = die_type (die, cu);
FIELD_NAME (*fp) = type_name_no_tag (fp->type);
fip->nbaseclasses++;
@@ -4433,9 +4430,8 @@ process_enumeration_scope (struct die_in

FIELD_NAME (fields[num_fields]) = SYMBOL_LINKAGE_NAME (sym);
FIELD_TYPE (fields[num_fields]) = NULL;
- FIELD_BITPOS (fields[num_fields]) = SYMBOL_VALUE (sym);
+ SET_FIELD_BITPOS (fields[num_fields], SYMBOL_VALUE (sym));
FIELD_BITSIZE (fields[num_fields]) = 0;
- FIELD_STATIC_KIND (fields[num_fields]) = 0;

num_fields++;
}
--- gdb/eval.c 2 Oct 2008 22:06:07 -0000 1.99
+++ gdb/eval.c 7 Oct 2008 22:25:56 -0000
@@ -319,7 +319,8 @@ evaluate_struct_tuple (struct value *str
fieldno++;
/* Skip static fields. */
while (fieldno < TYPE_NFIELDS (struct_type)
- && TYPE_FIELD_STATIC_KIND (struct_type, fieldno))
+ && field_is_static (&TYPE_FIELD (struct_type,
+ fieldno)))
fieldno++;
subfieldno = fieldno;
if (fieldno >= TYPE_NFIELDS (struct_type))
--- gdb/gdbtypes.c 3 Oct 2008 22:00:46 -0000 1.152
+++ gdb/gdbtypes.c 7 Oct 2008 22:26:00 -0000
@@ -2434,6 +2434,20 @@ print_arg_types (struct field *args, int
}
}

+int
+field_is_static (struct field *f)
+{
+ /* "static" fields are the fields whose location is not relative
+ to the address of the enclosing struct. It would be nice to
+ have a dedicated flag that would be set for static fields when
+ the type is being created. But in practice, checking the field
+ loc_kind should give us an accurate answer (at least as long as
+ we assume that DWARF block locations are not going to be used
+ for static fields). FIXME? */
+ return (FIELD_LOC_KIND (*f) == FIELD_LOC_KIND_PHYSNAME
+ || FIELD_LOC_KIND (*f) == FIELD_LOC_KIND_PHYSADDR);
+}
+
static void
dump_fn_fieldlists (struct type *type, int spaces)
{
@@ -2975,18 +2989,23 @@ copy_type_recursive (struct objfile *obj
if (TYPE_FIELD_NAME (type, i))
TYPE_FIELD_NAME (new_type, i) =
xstrdup (TYPE_FIELD_NAME (type, i));
- if (TYPE_FIELD_STATIC_HAS_ADDR (type, i))
- SET_FIELD_PHYSADDR (TYPE_FIELD (new_type, i),
- TYPE_FIELD_STATIC_PHYSADDR (type, i));
- else if (TYPE_FIELD_STATIC (type, i))
- SET_FIELD_PHYSNAME (TYPE_FIELD (new_type, i),
- xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type,
- i)));
- else
+ switch (TYPE_FIELD_LOC_KIND (type, i))
{
- TYPE_FIELD_BITPOS (new_type, i) =
- TYPE_FIELD_BITPOS (type, i);
- TYPE_FIELD_STATIC_KIND (new_type, i) = 0;
+ case FIELD_LOC_KIND_BITPOS:
+ SET_FIELD_BITPOS (TYPE_FIELD (new_type, i),
+ TYPE_FIELD_BITPOS (type, i));
+ break;
+ case FIELD_LOC_KIND_PHYSADDR:
+ SET_FIELD_PHYSADDR (TYPE_FIELD (new_type, i),
+ TYPE_FIELD_STATIC_PHYSADDR (type, i));
+ break;
+ case FIELD_LOC_KIND_PHYSNAME:
+ SET_FIELD_PHYSNAME (TYPE_FIELD (new_type, i),
+ xstrdup (TYPE_FIELD_STATIC_PHYSNAME (type,
+ i)));
+ break;
+ default:
+ gdb_assert (0);
}
}
}
--- gdb/gdbtypes.h 2 Oct 2008 22:06:07 -0000 1.92
+++ gdb/gdbtypes.h 7 Oct 2008 22:26:00 -0000
@@ -316,6 +316,16 @@ enum type_instance_flag_value
#define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \
& TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)

+/* Determine which field of the union main_type.fields[x].loc is used. */
+
+enum field_loc_kind
+ {
+ FIELD_LOC_KIND_BITPOS, /* bitpos */
+ FIELD_LOC_KIND_PHYSADDR, /* physaddr */
+ FIELD_LOC_KIND_PHYSNAME, /* physname */
+ FIELD_LOC_KIND_DWARF_BLOCK /* dwarf_block */
+ };
+
/* This structure is space-critical.
Its layout has been tweaked to reduce the space used. */

@@ -437,6 +447,12 @@ struct main_type

CORE_ADDR physaddr;
char *physname;
+
+ /* The field location can be computed by evaluating the following DWARF
+ block. This can be used in Fortran variable-length arrays, for
+ instance. */
+
+ struct dwarf2_locexpr_baton *dwarf_block;
}
loc;

@@ -446,11 +462,8 @@ struct main_type
defined. */
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;
+ /* Discriminant for union field_location. */
+ ENUM_BITFIELD(field_loc_kind) loc_kind : 2;

/* Size of this field, in bits, or zero if not packed.
For an unpacked field, the field's type's length
@@ -838,20 +851,34 @@ extern void allocate_cplus_struct_type (

#define FIELD_TYPE(thisfld) ((thisfld).type)
#define FIELD_NAME(thisfld) ((thisfld).name)
+#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
+#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
+#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
+#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
+#define SET_FIELD_BITPOS(thisfld, bitpos) \
+ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \
+ FIELD_BITPOS (thisfld) = (bitpos))
+#define SET_FIELD_PHYSNAME(thisfld, name) \
+ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
+ FIELD_STATIC_PHYSNAME (thisfld) = (name))
+#define SET_FIELD_PHYSADDR(thisfld, addr) \
+ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
+ FIELD_STATIC_PHYSADDR (thisfld) = (addr))
+#define SET_FIELD_DWARF_BLOCK(thisfld, addr) \
+ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_DWARF_BLOCK, \
+ FIELD_DWARF_BLOCK (thisfld) = (addr))
#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).static_kind = 1, FIELD_PHYSNAME(thisfld) = (name))
-#define SET_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))
-#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS(TYPE_FIELD(thistype,n))
+#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
+#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
+#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
+#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
+#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE(TYPE_FIELD(thistype,n))!=0)
@@ -886,12 +913,6 @@ extern void allocate_cplus_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].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))
-
#define TYPE_FN_FIELDLISTS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists
#define TYPE_FN_FIELDLIST(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n]
#define TYPE_FN_FIELDLIST1(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].fn_fields
@@ -1221,6 +1242,8 @@ extern int rank_one_type (struct type *,

extern void recursive_dump_type (struct type *, int);

+extern int field_is_static (struct field *);
+
/* printcmd.c */

extern void print_scalar_formatted (const void *, struct type *, int, int,
--- gdb/jv-typeprint.c 1 Jan 2008 22:53:11 -0000 1.14
+++ gdb/jv-typeprint.c 7 Oct 2008 22:26:00 -0000
@@ -185,7 +185,7 @@ java_type_print_base (struct type *type,
fprintf_filtered (stream, "public ");
}

- if (TYPE_FIELD_STATIC (type, i))
+ if (field_is_static (&TYPE_FIELD (type, i)))
fprintf_filtered (stream, "static ");

java_print_type (TYPE_FIELD_TYPE (type, i),
--- gdb/jv-valprint.c 6 May 2008 21:34:59 -0000 1.32
+++ gdb/jv-valprint.c 7 Oct 2008 22:26:01 -0000
@@ -304,7 +304,7 @@ java_print_value_fields (struct type *ty
for (i = n_baseclasses; i < len; i++)
{
/* If requested, skip printing of static fields. */
- if (TYPE_FIELD_STATIC (type, i))
+ if (field_is_static (&TYPE_FIELD (type, i)))
{
char *name = TYPE_FIELD_NAME (type, i);
if (!static_field_print)
@@ -342,7 +342,7 @@ java_print_value_fields (struct type *ty
fputs_filtered ("\"( ptr \"", stream);
else
fputs_filtered ("\"( nodef \"", stream);
- if (TYPE_FIELD_STATIC (type, i))
+ if (field_is_static (&TYPE_FIELD (type, i)))
fputs_filtered ("static ", stream);
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
language_cplus,
@@ -357,7 +357,7 @@ java_print_value_fields (struct type *ty
{
annotate_field_begin (TYPE_FIELD_TYPE (type, i));

- if (TYPE_FIELD_STATIC (type, i))
+ if (field_is_static (&TYPE_FIELD (type, i)))
fputs_filtered ("static ", stream);
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
language_cplus,
@@ -367,7 +367,8 @@ java_print_value_fields (struct type *ty
annotate_field_value ();
}

- if (!TYPE_FIELD_STATIC (type, i) && TYPE_FIELD_PACKED (type, i))
+ if (!field_is_static (&TYPE_FIELD (type, i))
+ && TYPE_FIELD_PACKED (type, i))
{
struct value *v;

@@ -392,7 +393,7 @@ java_print_value_fields (struct type *ty
{
fputs_filtered ("<optimized out or zero length>", stream);
}
- else if (TYPE_FIELD_STATIC (type, i))
+ else if (field_is_static (&TYPE_FIELD (type, i)))
{
struct value *v = value_static_field (type, i);
if (v == NULL)
--- gdb/mdebugread.c 1 Oct 2008 16:41:27 -0000 1.95
+++ gdb/mdebugread.c 7 Oct 2008 22:26:05 -0000
@@ -1054,11 +1054,10 @@ parse_symbol (SYMR *sh, union aux_ext *a
if (tsym.st != stMember)
break;

- FIELD_BITPOS (*f) = tsym.value;
+ SET_FIELD_BITPOS (*f, tsym.value);
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 (&current_objfile->objfile_obstack,
@@ -1241,11 +1240,10 @@ parse_symbol (SYMR *sh, union aux_ext *a
case stMember: /* member of struct or union */
f = &TYPE_FIELDS (top_stack->cur_type)[top_stack->cur_field++];
FIELD_NAME (*f) = name;
- FIELD_BITPOS (*f) = sh->value;
+ SET_FIELD_BITPOS (*f, sh->value);
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 */
@@ -1777,12 +1775,9 @@ upgrade_type (int fd, struct type **tpp,
ignore the erroneous bitsize from the auxiliary entry safely.
dbx seems to ignore it too. */

- /* TYPE_FLAG_TARGET_STUB now takes care of the zero TYPE_LENGTH
- problem. */
+ /* TYPE_TARGET_STUB now takes care of the zero TYPE_LENGTH problem. */
if (TYPE_LENGTH (*tpp) == 0)
- {
- TYPE_TARGET_STUB (t) = 1;
- }
+ TYPE_TARGET_STUB (t) = 1;

*tpp = t;
return 4 + off;
--- gdb/p-typeprint.c 2 Oct 2008 22:06:07 -0000 1.24
+++ gdb/p-typeprint.c 7 Oct 2008 22:26:07 -0000
@@ -590,14 +590,12 @@ pascal_type_print_base (struct type *typ
}

print_spaces_filtered (level + 4, stream);
- if (TYPE_FIELD_STATIC (type, i))
- {
- fprintf_filtered (stream, "static ");
- }
+ if (field_is_static (&TYPE_FIELD (type, i)))
+ fprintf_filtered (stream, "static ");
pascal_print_type (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
stream, show - 1, level + 4);
- if (!TYPE_FIELD_STATIC (type, i)
+ if (!field_is_static (&TYPE_FIELD (type, i))
&& TYPE_FIELD_PACKED (type, i))
{
/* It is a bitfield. This code does not attempt
--- gdb/p-valprint.c 11 Sep 2008 14:17:24 -0000 1.56
+++ gdb/p-valprint.c 7 Oct 2008 22:26:07 -0000
@@ -671,7 +671,8 @@ pascal_object_print_value_fields (struct
for (i = n_baseclasses; i < len; i++)
{
/* If requested, skip printing of static fields. */
- if (!pascal_static_field_print && TYPE_FIELD_STATIC (type, i))
+ if (!pascal_static_field_print
+ && field_is_static (&TYPE_FIELD (type, i)))
continue;
if (fields_seen)
fprintf_filtered (stream, ", ");
@@ -703,7 +704,7 @@ pascal_object_print_value_fields (struct
fputs_filtered ("\"( ptr \"", stream);
else
fputs_filtered ("\"( nodef \"", stream);
- if (TYPE_FIELD_STATIC (type, i))
+ if (field_is_static (&TYPE_FIELD (type, i)))
fputs_filtered ("static ", stream);
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
language_cplus,
@@ -718,7 +719,7 @@ pascal_object_print_value_fields (struct
{
annotate_field_begin (TYPE_FIELD_TYPE (type, i));

- if (TYPE_FIELD_STATIC (type, i))
+ if (field_is_static (&TYPE_FIELD (type, i)))
fputs_filtered ("static ", stream);
fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
language_cplus,
@@ -728,7 +729,8 @@ pascal_object_print_value_fields (struct
annotate_field_value ();
}

- if (!TYPE_FIELD_STATIC (type, i) && TYPE_FIELD_PACKED (type, i))
+ if (!field_is_static (&TYPE_FIELD (type, i))
+ && TYPE_FIELD_PACKED (type, i))
{
struct value *v;

@@ -753,7 +755,7 @@ pascal_object_print_value_fields (struct
{
fputs_filtered ("<optimized out or zero length>", stream);
}
- else if (TYPE_FIELD_STATIC (type, i))
+ else if (field_is_static (&TYPE_FIELD (type, i)))
{
/* struct value *v = value_static_field (type, i); v4.17 specific */
struct value *v;
--- gdb/valops.c 2 Oct 2008 22:06:07 -0000 1.201
+++ gdb/valops.c 7 Oct 2008 22:26:10 -0000
@@ -1459,7 +1459,7 @@ search_struct_field (char *name, struct
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
{
struct value *v;
- if (TYPE_FIELD_STATIC (type, i))
+ if (field_is_static (&TYPE_FIELD (type, i)))
{
v = value_static_field (type, i);
if (v == 0)
@@ -2540,7 +2540,7 @@ value_struct_elt_for_reference (struct t

if (t_field_name && strcmp (t_field_name, name) == 0)
{
- if (TYPE_FIELD_STATIC (t, i))
+ if (field_is_static (&TYPE_FIELD (t, i)))
{
v = value_static_field (t, i);
if (v == NULL)
--- gdb/value.c 11 Sep 2008 14:22:33 -0000 1.66
+++ gdb/value.c 7 Oct 2008 22:26:12 -0000
@@ -1236,7 +1236,7 @@ value_static_field (struct type *type, i
{
struct value *retval;

- if (TYPE_FIELD_STATIC_HAS_ADDR (type, fieldno))
+ if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR)
{
retval = value_at (TYPE_FIELD_TYPE (type, fieldno),
TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
--- gdb/varobj.c 2 Oct 2008 22:06:07 -0000 1.118
+++ gdb/varobj.c 7 Oct 2008 22:26:13 -0000
@@ -2013,7 +2013,7 @@ value_struct_element_index (struct value

TRY_CATCH (e, RETURN_MASK_ERROR)
{
- if (TYPE_FIELD_STATIC (type, type_index))
+ if (field_is_static (&TYPE_FIELD (type, type_index)))
result = value_static_field (type, type_index);
else
result = value_primitive_field (value, 0, type_index, type);