Convert static_kind into loc_kind enum.
authorJan Kratochvil <jan.kratochvil@redhat.com>
Wed, 8 Oct 2008 12:49:13 +0000 (12:49 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Wed, 8 Oct 2008 12:49:13 +0000 (12:49 +0000)
* 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.

17 files changed:
gdb/ChangeLog
gdb/amd64-tdep.c
gdb/c-typeprint.c
gdb/coffread.c
gdb/cp-valprint.c
gdb/dwarf2read.c
gdb/eval.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/jv-typeprint.c
gdb/jv-valprint.c
gdb/mdebugread.c
gdb/p-typeprint.c
gdb/p-valprint.c
gdb/valops.c
gdb/value.c
gdb/varobj.c

index 0df59e51a64b0e7832a52727869c14d43478e0d0..9d14ac67504b45ad4e7730af17ab2f2322bfcd24 100644 (file)
@@ -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>
 
index 9b7c8a4c583076d268b793a7333e8689c94717fc..891c4d4a35e5c851671358aa2c9a3d6f17b67f51 100644 (file)
@@ -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);
index 26c8951bdb3488feaf17a7cbc60a180f9b22a216..b18e437147bf1fb465cbc76bbe718ba123814577 100644 (file)
@@ -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
index 4d8ef8a0eebdaa3833bc53e5651cb4178fdbc7fa..add6cddbde589a15acbf9e6d0eef861754feb6c4 100644 (file)
@@ -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;
index 4d9131921adab7577c253c0d6e4d6dc4fa6e06d8..61559af5808246189938ae66f083aec56fceec7a 100644 (file)
@@ -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)
index 6dba82e111e14eb8c1cf684c2acd7e30353fa076..d894696f23a3a998792e7aa33caf7915dd20692e 100644 (file)
@@ -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++;
                }
index f42ccefe3795620e3571f9501add87dd0a7952be..cf3e8765d38b11d16ec930c4dce59c5c7dabb764 100644 (file)
@@ -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))
index 6b405f4bc9206cfcc4eb7931a4c58860fca957fb..2029d5d20aa90ce862ee748bfa0048fee6c4ad33 100644 (file)
@@ -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));
            }
        }
     }
index 0b52f10902dda7224eb2e455382cd3d9c0b7bee5..0a48db2b5e6e272a287557c6a443c9b211ffcb67 100644 (file)
@@ -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,
index 404d02b044beeeb926b10a2f48dbead7ccfb9cc9..13fc958d2a4590f5c031ba7351d2cb095bee7381 100644 (file)
@@ -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),
index 68dbdf8074b5b7ddc84fe623d084434d96a42b9f..9e36aa4893a2e6b94c08927db7b2b724559cf76a 100644 (file)
@@ -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)
index 280700835bffee99c1175f5db083147915f7fd2d..3fa06e5c06bab48df89a4cba2a8ba0b4312ab055 100644 (file)
@@ -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;
index 5c482e6a5fec8b4404f24dc748818ad4b535a278..328ac8446416b9599d8755adc77a0c4e2f9189bd 100644 (file)
@@ -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
index f76bf566a1449c7b8eedfa11af870310a1fdc3ed..bc4fbe106f2fcdc230086211c14c87ae4cac0f77 100644 (file)
@@ -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;
index 2dc237a7740bea9db154d9cf716f4329cf668f92..0c539c159b0c72e46ef2a089c3fd1ec17cbc0951 100644 (file)
@@ -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)
index f3f2c72dab634b3f034be09e059eba77586a82f1..06b0d1e769c60d457b948077d34da0acba96e7e8 100644 (file)
@@ -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));
index 50b424ce89ee3a547edf324b866c90d6084be2d2..15cbd451bdc36a0eaeb7f86576c875b61f49a3a7 100644 (file)
@@ -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);