diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/aarch64-tdep.c | 4 | ||||
-rw-r--r-- | gdb/amd64-tdep.c | 4 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 2 | ||||
-rw-r--r-- | gdb/ax-gdb.c | 6 | ||||
-rw-r--r-- | gdb/c-typeprint.c | 2 | ||||
-rw-r--r-- | gdb/c-varobj.c | 2 | ||||
-rw-r--r-- | gdb/compile/compile-c-symbols.c | 2 | ||||
-rw-r--r-- | gdb/compile/compile-cplus-types.c | 2 | ||||
-rw-r--r-- | gdb/cp-valprint.c | 10 | ||||
-rw-r--r-- | gdb/eval.c | 2 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 20 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 14 | ||||
-rw-r--r-- | gdb/gnu-v3-abi.c | 2 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 2 | ||||
-rw-r--r-- | gdb/loongarch-tdep.c | 2 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 2 | ||||
-rw-r--r-- | gdb/p-typeprint.c | 4 | ||||
-rw-r--r-- | gdb/p-valprint.c | 8 | ||||
-rw-r--r-- | gdb/ppc-sysv-tdep.c | 2 | ||||
-rw-r--r-- | gdb/python/py-type.c | 2 | ||||
-rw-r--r-- | gdb/rust-lang.c | 8 | ||||
-rw-r--r-- | gdb/s390-tdep.c | 2 | ||||
-rw-r--r-- | gdb/typeprint.c | 2 | ||||
-rw-r--r-- | gdb/valops.c | 6 |
24 files changed, 55 insertions, 57 deletions
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index ec0e51b..6402b28 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -1537,7 +1537,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type, for (int i = 0; i < type->num_fields (); i++) { /* Ignore any static fields. */ - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) continue; struct type *member = check_typedef (type->field (i).type ()); @@ -1813,7 +1813,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache, for (int i = 0; i < arg_type->num_fields (); i++) { /* Don't include static fields. */ - if (field_is_static (&arg_type->field (i))) + if (arg_type->field (i).is_static ()) continue; struct value *field = arg->primitive_field (0, i, arg_type); diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 8d34525..d37497a 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -557,7 +557,7 @@ amd64_has_unaligned_fields (struct type *type) /* Ignore static fields, empty fields (for example nested empty structures), and bitfields (these are handled by the caller). */ - if (field_is_static (&type->field (i)) + if (type->field (i).is_static () || (TYPE_FIELD_BITSIZE (type, i) == 0 && subtype->length () == 0) || TYPE_FIELD_PACKED (type, i)) @@ -601,7 +601,7 @@ amd64_classify_aggregate_field (struct type *type, int i, /* Ignore static fields, or empty fields, for example nested empty structures.*/ - if (field_is_static (&type->field (i)) || bitsize == 0) + if (type->field (i).is_static () || bitsize == 0) return; int bitpos = bitoffset + type->field (i).loc_bitpos (); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index bfe7d63..a49a8b7 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -4524,7 +4524,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, { int sub_count = 0; - if (!field_is_static (&t->field (i))) + if (!t->field (i).is_static ()) sub_count = arm_vfp_cprc_sub_candidate (t->field (i).type (), base_type); if (sub_count == -1) diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 9dda7fe..528f45e 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -210,7 +210,7 @@ gen_trace_static_fields (struct agent_expr *ax, for (i = type->num_fields () - 1; i >= nbases; i--) { - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) { gen_static_field (ax, &value, type, i); if (value.optimized_out) @@ -1359,7 +1359,7 @@ gen_struct_ref_recursive (struct agent_expr *ax, struct axs_value *value, "this") will have been generated already, which will be unnecessary but not harmful if the static field is being handled as a global. */ - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) { gen_static_field (ax, value, type, i); if (value->optimized_out) @@ -1495,7 +1495,7 @@ gen_struct_elt_for_reference (struct agent_expr *ax, struct axs_value *value, if (t_field_name && strcmp (t_field_name, fieldname) == 0) { - if (field_is_static (&t->field (i))) + if (t->field (i).is_static ()) { gen_static_field (ax, value, t, i); if (value->optimized_out) diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 7e9d941..416f63b 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -1113,7 +1113,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream, TYPE_FIELD_PRIVATE (type, i), flags); } - bool is_static = field_is_static (&type->field (i)); + bool is_static = type->field (i).is_static (); if (flags->print_offsets) podata->update (type, i, stream); diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c index ef4d0bd..d2a415e 100644 --- a/gdb/c-varobj.c +++ b/gdb/c-varobj.c @@ -254,7 +254,7 @@ value_struct_element_index (struct value *value, int type_index) try { - if (field_is_static (&type->field (type_index))) + if (type->field (type_index).is_static ()) result = value_static_field (type, type_index); else result = value->primitive_field (0, type_index, type); diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index e21689d..617297c 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -528,7 +528,7 @@ generate_vla_size (compile_instance *compiler, int i; for (i = 0; i < type->num_fields (); ++i) - if (!field_is_static (&type->field (i))) + if (!type->field (i).is_static ()) generate_vla_size (compiler, stream, gdbarch, registers_used, pc, type->field (i).type (), sym); } diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index 02cd381..2f87ad8 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -594,7 +594,7 @@ compile_cplus_convert_struct_or_union_members gcc_type field_type = instance->convert_type (type->field (i).type ()); - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) { CORE_ADDR physaddr; diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 167cf03..8fad952 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -193,7 +193,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream, /* If requested, skip printing of static fields. */ if (!options->static_field_print - && field_is_static (&type->field (i))) + && type->field (i).is_static ()) continue; if (fields_seen) @@ -227,7 +227,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream, annotate_field_begin (type->field (i).type ()); - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) { gdb_puts ("static ", stream); fprintf_symbol (stream, @@ -258,7 +258,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream, } annotate_field_value (); - if (!field_is_static (&type->field (i)) + if (!type->field (i).is_static () && TYPE_FIELD_PACKED (type, i)) { struct value *v; @@ -295,7 +295,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream, fputs_styled ("<optimized out or zero length>", metadata_style.style (), stream); } - else if (field_is_static (&type->field (i))) + else if (type->field (i).is_static ()) { try { @@ -637,7 +637,7 @@ cp_find_class_member (struct type **self_p, int *fieldno, for (i = TYPE_N_BASECLASSES (self); i < len; i++) { field &f = self->field (i); - if (field_is_static (&f)) + if (f.is_static ()) continue; LONGEST bitpos = f.loc_bitpos (); @@ -2366,7 +2366,7 @@ array_operation::evaluate_struct_tuple (struct value *struct_val, fieldno++; /* Skip static fields. */ while (fieldno < struct_type->num_fields () - && field_is_static (&struct_type->field (fieldno))) + && struct_type->field (fieldno).is_static ()) fieldno++; if (fieldno >= struct_type->num_fields ()) error (_("too many initializers")); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index c8d5314..75fd4bf 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -2113,7 +2113,7 @@ is_dynamic_type_internal (struct type *type, int top_level) for (i = 0; i < type->num_fields (); ++i) { /* Static fields can be ignored here. */ - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) continue; /* If the field has dynamic type, then so does TYPE. */ if (is_dynamic_type_internal (type->field (i).type (), 0)) @@ -2461,7 +2461,7 @@ resolve_dynamic_union (struct type *type, { struct type *t; - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) continue; t = resolve_dynamic_type_internal (resolved_type->field (i).type (), @@ -2677,7 +2677,7 @@ resolve_dynamic_struct (struct type *type, unsigned new_bit_length; struct property_addr_info pinfo; - if (field_is_static (&resolved_type->field (i))) + if (resolved_type->field (i).is_static ()) continue; if (resolved_type->field (i).loc_kind () == FIELD_LOC_KIND_DWARF_BLOCK) @@ -3582,7 +3582,7 @@ type_align (struct type *type) int number_of_non_static_fields = 0; for (unsigned i = 0; i < type->num_fields (); ++i) { - if (!field_is_static (&type->field (i))) + if (!type->field (i).is_static ()) { number_of_non_static_fields++; ULONGEST f_align = type_align (type->field (i).type ()); @@ -4941,18 +4941,6 @@ print_args (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. */ - return (f->loc_kind () == FIELD_LOC_KIND_PHYSNAME - || f->loc_kind () == FIELD_LOC_KIND_PHYSADDR); -} - static void dump_fn_fieldlists (struct type *type, int spaces) { diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index b5cccb7..9254ec9 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -559,6 +559,18 @@ struct field m_name = name; } + /* Return true if this field is static; false if not. */ + bool is_static () const + { + /* "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. */ + return (m_loc_kind == FIELD_LOC_KIND_PHYSNAME + || m_loc_kind == FIELD_LOC_KIND_PHYSADDR); + } + /* Location getters / setters. */ field_loc_kind loc_kind () const @@ -2686,8 +2698,6 @@ extern struct rank 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 gdb_byte *, struct type *, diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 12bc5b0..4d1aa12 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -1536,7 +1536,7 @@ gnuv3_pass_by_reference (struct type *type) about recursive loops here, since we are only looking at members of complete class type. Also ignore any static members. */ for (fieldnum = 0; fieldnum < type->num_fields (); fieldnum++) - if (!field_is_static (&type->field (fieldnum))) + if (!type->field (fieldnum).is_static ()) { struct type *field_type = type->field (fieldnum).type (); diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 1ab9fc0..2c73c12 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -2698,7 +2698,7 @@ i386_16_byte_align_p (struct type *type) int i; for (i = 0; i < type->num_fields (); i++) { - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) continue; if (i386_16_byte_align_p (type->field (i).type ())) return 1; diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c index 74f14c4..5739af6 100644 --- a/gdb/loongarch-tdep.c +++ b/gdb/loongarch-tdep.c @@ -521,7 +521,7 @@ compute_struct_member (struct type *type, for (int i = 0; i < type->num_fields (); i++) { /* Ignore any static fields. */ - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) continue; struct type *field_type = check_typedef (type->field (i).type ()); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 7092b26..6bbee05 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -4886,7 +4886,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type, struct type *field_type; /* We're only looking at normal fields. */ - if (field_is_static (&arg_type->field (i)) + if (arg_type->field (i).is_static () || (arg_type->field (i).loc_bitpos () % 8) != 0) continue; diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index 7458aa6..563f619 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -516,12 +516,12 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int } print_spaces (level + 4, stream); - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) gdb_printf (stream, "static "); print_type (type->field (i).type (), type->field (i).name (), stream, show - 1, level + 4, flags); - if (!field_is_static (&type->field (i)) + if (!type->field (i).is_static () && 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 d74c738..2136a192 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -553,7 +553,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream, { /* If requested, skip printing of static fields. */ if (!options->pascal_static_field_print - && field_is_static (&type->field (i))) + && type->field (i).is_static ()) continue; if (fields_seen) gdb_printf (stream, ", "); @@ -582,7 +582,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream, annotate_field_begin (type->field (i).type ()); - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) { gdb_puts ("static ", stream); fprintf_symbol (stream, @@ -597,7 +597,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream, gdb_puts (" = ", stream); annotate_field_value (); - if (!field_is_static (&type->field (i)) + if (!type->field (i).is_static () && TYPE_FIELD_PACKED (type, i)) { struct value *v; @@ -634,7 +634,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream, fputs_styled ("<optimized out or zero length>", metadata_style.style (), stream); } - else if (field_is_static (&type->field (i))) + else if (type->field (i).is_static ()) { /* struct value *v = value_static_field (type, i); v4.17 specific. */ diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 6663079..20e732f 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -1149,7 +1149,7 @@ ppc64_aggregate_candidate (struct type *type, { LONGEST sub_count; - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) continue; sub_count = ppc64_aggregate_candidate diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index b68ec8d..feb94ef 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -154,7 +154,7 @@ convert_field (struct type *type, int field) if (PyObject_SetAttrString (result.get (), "parent_type", arg.get ()) < 0) return NULL; - if (!field_is_static (&type->field (field))) + if (!type->field (field).is_static ()) { const char *attrstring; diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 3ef8fca..a060720 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -130,7 +130,7 @@ rust_underscore_fields (struct type *type) return false; for (i = 0; i < type->num_fields (); ++i) { - if (!field_is_static (&type->field (i))) + if (!type->field (i).is_static ()) { char buf[20]; @@ -403,7 +403,7 @@ rust_language::val_print_struct first_field = 1; for (i = 0; i < type->num_fields (); ++i) { - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) continue; if (!first_field) @@ -723,7 +723,7 @@ rust_print_struct_def (struct type *type, const char *varstring, std::vector<int> fields; for (int i = 0; i < type->num_fields (); ++i) { - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) continue; if (is_enum && TYPE_FIELD_ARTIFICIAL (type, i)) continue; @@ -741,7 +741,7 @@ rust_print_struct_def (struct type *type, const char *varstring, { QUIT; - gdb_assert (!field_is_static (&type->field (i))); + gdb_assert (!type->field (i).is_static ()); gdb_assert (! (is_enum && TYPE_FIELD_ARTIFICIAL (type, i))); if (flags->print_offsets) diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 047ee08..54b5c89 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -1648,7 +1648,7 @@ s390_effective_inner_type (struct type *type, unsigned int min_size) { struct field f = type->field (i); - if (field_is_static (&f)) + if (f.is_static ()) continue; if (inner != NULL) return type; diff --git a/gdb/typeprint.c b/gdb/typeprint.c index 06ecd2c..bfe851f 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -125,7 +125,7 @@ void print_offset_data::update (struct type *type, unsigned int field_idx, struct ui_file *stream) { - if (field_is_static (&type->field (field_idx))) + if (type->field (field_idx).is_static ()) { print_spaces (indentation, stream); return; diff --git a/gdb/valops.c b/gdb/valops.c index d002c9d..22be480 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -2017,7 +2017,7 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset, { struct value *v; - if (field_is_static (&type->field (i))) + if (type->field (i).is_static ()) v = value_static_field (type, i); else v = arg1->primitive_field (offset, i, type); @@ -2462,7 +2462,7 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype, for (i = TYPE_N_BASECLASSES (t); i < t->num_fields (); i++) { - if (!field_is_static (&t->field (i)) + if (!t->field (i).is_static () && bitpos == t->field (i).loc_bitpos () && types_equal (ftype, t->field (i).type ())) return (*argp)->primitive_field (0, i, t); @@ -3581,7 +3581,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, if (t_field_name && strcmp (t_field_name, name) == 0) { - if (field_is_static (&t->field (i))) + if (t->field (i).is_static ()) { struct value *v = value_static_field (t, i); if (want_address) |