aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog30
-rw-r--r--gdb/amd64-tdep.c2
-rw-r--r--gdb/c-typeprint.c8
-rw-r--r--gdb/coffread.c9
-rw-r--r--gdb/cp-valprint.c12
-rw-r--r--gdb/dwarf2read.c14
-rw-r--r--gdb/eval.c3
-rw-r--r--gdb/gdbtypes.c43
-rw-r--r--gdb/gdbtypes.h61
-rw-r--r--gdb/jv-typeprint.c2
-rw-r--r--gdb/jv-valprint.c11
-rw-r--r--gdb/mdebugread.c13
-rw-r--r--gdb/p-typeprint.c8
-rw-r--r--gdb/p-valprint.c12
-rw-r--r--gdb/valops.c4
-rw-r--r--gdb/value.c2
-rw-r--r--gdb/varobj.c2
17 files changed, 150 insertions, 86 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0df59e5..9d14ac6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,33 @@
+2008-10-08 Jan Kratochvil <jan.kratochvil@redhat.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.
+
2008-10-07 Thomas Schwinge <tschwinge@gnu.org>
Pedro Alves <pedro@codesourcery.com>
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 9b7c8a4..891c4d4 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -316,7 +316,7 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2])
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);
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 26c8951..b18e437 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -890,14 +890,12 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
}
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
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 4d8ef8a..add6cdd 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1943,9 +1943,8 @@ coff_read_struct_type (int index, int length, int lastsym,
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 length, int lastsym,
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 length, int lastsym,
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;
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 4d91319..61559af 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -192,7 +192,8 @@ cp_print_value_fields (struct type *type, struct type *real_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, struct type *real_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, struct type *real_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, struct type *real_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, struct type *real_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)
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 6dba82e..d894696 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3588,7 +3588,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
/* 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, struct die_info *die,
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, struct die_info *die,
/* 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_info *die, struct dwarf2_cu *cu)
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++;
}
diff --git a/gdb/eval.c b/gdb/eval.c
index f42ccef..cf3e876 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -319,7 +319,8 @@ evaluate_struct_tuple (struct value *struct_val,
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))
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 6b405f4..2029d5d 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2434,6 +2434,20 @@ print_arg_types (struct field *args, int nargs, int spaces)
}
}
+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,25 @@ copy_type_recursive (struct objfile *objfile,
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:
+ internal_error (__FILE__, __LINE__,
+ _("Unexpected type field location kind: %d"),
+ TYPE_FIELD_LOC_KIND (type, i));
}
}
}
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 0b52f10..0a48db2 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -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 (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 (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 *, 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,
diff --git a/gdb/jv-typeprint.c b/gdb/jv-typeprint.c
index 404d02b..13fc958 100644
--- a/gdb/jv-typeprint.c
+++ b/gdb/jv-typeprint.c
@@ -185,7 +185,7 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
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),
diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
index 68dbdf8..9e36aa4 100644
--- a/gdb/jv-valprint.c
+++ b/gdb/jv-valprint.c
@@ -304,7 +304,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
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 *type, const gdb_byte *valaddr,
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 *type, const gdb_byte *valaddr,
{
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 *type, const gdb_byte *valaddr,
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 *type, const gdb_byte *valaddr,
{
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)
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 2807008..3fa06e5 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -1054,11 +1054,10 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
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 *ax, char *ext_sh, int bigend,
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, int tq, union aux_ext *ax, int bigend,
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;
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index 5c482e6..328ac84 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -590,14 +590,12 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
}
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
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index f76bf56..bc4fbe1 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -671,7 +671,8 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
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 type *type, const gdb_byte *valaddr,
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 type *type, const gdb_byte *valaddr,
{
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 type *type, const gdb_byte *valaddr,
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 type *type, const gdb_byte *valaddr,
{
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;
diff --git a/gdb/valops.c b/gdb/valops.c
index 2dc237a..0c539c1 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1459,7 +1459,7 @@ search_struct_field (char *name, struct value *arg1, int offset,
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 type *domain, int offset,
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)
diff --git a/gdb/value.c b/gdb/value.c
index f3f2c72..06b0d1e 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1236,7 +1236,7 @@ value_static_field (struct type *type, int fieldno)
{
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));
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 50b424c..15cbd45 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -2013,7 +2013,7 @@ value_struct_element_index (struct value *value, int type_index)
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);