diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ada-lang.c | 9 | ||||
-rw-r--r-- | gdb/ctfread.c | 13 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 13 | ||||
-rw-r--r-- | gdb/fbsd-tdep.c | 4 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 54 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 14 | ||||
-rw-r--r-- | gdb/linux-tdep.c | 6 | ||||
-rw-r--r-- | gdb/netbsd-tdep.c | 8 | ||||
-rw-r--r-- | gdb/stabsread.c | 2 | ||||
-rw-r--r-- | gdb/windows-tdep.c | 8 |
10 files changed, 70 insertions, 61 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index d49baf9..c5657d9 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -8114,7 +8114,7 @@ template_to_static_fixed_type (struct type *type0) /* Whether or not we cloned TYPE0, cache the result so that we don't do recompute all over next time. */ - TYPE_TARGET_TYPE (type0) = type; + type0->set_target_type (type); for (f = 0; f < nfields; f += 1) { @@ -8134,7 +8134,8 @@ template_to_static_fixed_type (struct type *type0) /* Clone TYPE0 only the first time we get a new field type. */ if (type == type0) { - TYPE_TARGET_TYPE (type0) = type = alloc_type_copy (type0); + type = alloc_type_copy (type0); + type0->set_target_type (type); type->set_code (type0->code ()); INIT_NONE_SPECIFIC (type); type->set_num_fields (nfields); @@ -10278,8 +10279,8 @@ ada_ternop_slice (struct expression *exp, the aligners. */ if (value_type (array)->code () == TYPE_CODE_REF && ada_is_aligner_type (TYPE_TARGET_TYPE (value_type (array)))) - TYPE_TARGET_TYPE (value_type (array)) = - ada_aligned_type (TYPE_TARGET_TYPE (value_type (array))); + value_type (array)->set_target_type + (ada_aligned_type (TYPE_TARGET_TYPE (value_type (array)))); if (ada_is_any_packed_array_type (value_type (array))) error (_("cannot slice a packed array")); diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 9436ce5..b37030b 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -698,7 +698,7 @@ read_func_kind_type (struct ctf_context *ccp, ctf_id_t tid) fname == nullptr ? "noname" : fname); } rettype = fetch_tid_type (ccp, cfi.ctc_return); - TYPE_TARGET_TYPE (type) = rettype; + type->set_target_type (rettype); set_type_align (type, ctf_type_align (fp, tid)); /* Set up function's arguments. */ @@ -749,7 +749,7 @@ read_enum_type (struct ctf_context *ccp, ctf_id_t tid) type->set_code (TYPE_CODE_ENUM); TYPE_LENGTH (type) = ctf_type_size (fp, tid); /* Set the underlying type based on its ctf_type_size bits. */ - TYPE_TARGET_TYPE (type) = objfile_int_type (of, TYPE_LENGTH (type), false); + type->set_target_type (objfile_int_type (of, TYPE_LENGTH (type), false)); set_type_align (type, ctf_type_align (fp, tid)); return set_tid_type (of, tid, type); @@ -791,15 +791,14 @@ add_array_cv_type (struct ctf_context *ccp, while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY) { - TYPE_TARGET_TYPE (inner_array) - = copy_type (TYPE_TARGET_TYPE (inner_array)); + inner_array->set_target_type (copy_type (TYPE_TARGET_TYPE (inner_array))); inner_array = TYPE_TARGET_TYPE (inner_array); } el_type = TYPE_TARGET_TYPE (inner_array); cnst |= TYPE_CONST (el_type); voltl |= TYPE_VOLATILE (el_type); - TYPE_TARGET_TYPE (inner_array) = make_cv_type (cnst, voltl, el_type, nullptr); + inner_array->set_target_type (make_cv_type (cnst, voltl, el_type, nullptr)); return set_tid_type (ccp->of, tid, base_type); } @@ -933,9 +932,9 @@ read_typedef_type (struct ctf_context *ccp, ctf_id_t tid, set_tid_type (objfile, tid, this_type); target_type = fetch_tid_type (ccp, btid); if (target_type != this_type) - TYPE_TARGET_TYPE (this_type) = target_type; + this_type->set_target_type (target_type); else - TYPE_TARGET_TYPE (this_type) = nullptr; + this_type->set_target_type (nullptr); this_type->set_target_is_stub (TYPE_TARGET_TYPE (this_type) != nullptr); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index ceb1451..50c7946 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -14380,7 +14380,7 @@ rewrite_array_type (struct type *type) memcpy (new_fields, copy->fields (), nfields * sizeof (struct field)); copy->set_fields (new_fields); if (new_target != nullptr) - TYPE_TARGET_TYPE (copy) = new_target; + copy->set_target_type (new_target); struct type *index_copy = copy_type (index_type); range_bounds *bounds @@ -15196,7 +15196,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) { struct type *underlying_type = die_type (die, cu); - TYPE_TARGET_TYPE (type) = underlying_type; + type->set_target_type (underlying_type); } attr = dwarf2_attr (die, DW_AT_byte_size, cu); @@ -16286,15 +16286,14 @@ add_array_cv_type (struct die_info *die, struct dwarf2_cu *cu, while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY) { - TYPE_TARGET_TYPE (inner_array) = - copy_type (TYPE_TARGET_TYPE (inner_array)); + inner_array->set_target_type (copy_type (TYPE_TARGET_TYPE (inner_array))); inner_array = TYPE_TARGET_TYPE (inner_array); } el_type = TYPE_TARGET_TYPE (inner_array); cnst |= TYPE_CONST (el_type); voltl |= TYPE_VOLATILE (el_type); - TYPE_TARGET_TYPE (inner_array) = make_cv_type (cnst, voltl, el_type, NULL); + inner_array->set_target_type (make_cv_type (cnst, voltl, el_type, NULL)); return set_die_type (die, base_type, cu); } @@ -16675,7 +16674,7 @@ read_typedef (struct die_info *die, struct dwarf2_cu *cu) set_die_type (die, this_type, cu); target_type = die_type (die, cu); if (target_type != this_type) - TYPE_TARGET_TYPE (this_type) = target_type; + this_type->set_target_type (target_type); else { /* Self-referential typedefs are, it seems, not allowed by the DWARF @@ -16683,7 +16682,7 @@ read_typedef (struct die_info *die, struct dwarf2_cu *cu) complaint (_("Self-referential DW_TAG_typedef " "- DIE at %s [in module %s]"), sect_offset_str (die->sect_off), objfile_name (objfile)); - TYPE_TARGET_TYPE (this_type) = NULL; + this_type->set_target_type (nullptr); } if (name == NULL) { diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index 3a2dbbe..5eec49b 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -1609,14 +1609,14 @@ fbsd_get_siginfo_type (struct gdbarch *gdbarch) /* __pid_t */ pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (int32_type) * TARGET_CHAR_BIT, "__pid_t"); - TYPE_TARGET_TYPE (pid_type) = int32_type; + pid_type->set_target_type (int32_type); pid_type->set_target_is_stub (true); /* __uid_t */ uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (uint32_type) * TARGET_CHAR_BIT, "__uid_t"); - TYPE_TARGET_TYPE (uid_type) = uint32_type; + uid_type->set_target_type (uint32_type); pid_type->set_target_is_stub (true); /* _reason */ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index c458b20..12fc12d 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -371,7 +371,7 @@ make_pointer_type (struct type *type, struct type **typeptr) TYPE_CHAIN (ntype) = chain; } - TYPE_TARGET_TYPE (ntype) = type; + ntype->set_target_type (type); TYPE_POINTER_TYPE (type) = ntype; /* FIXME! Assumes the machine has only one representation for pointers! */ @@ -449,7 +449,7 @@ make_reference_type (struct type *type, struct type **typeptr, TYPE_CHAIN (ntype) = chain; } - TYPE_TARGET_TYPE (ntype) = type; + ntype->set_target_type (type); reftype = (refcode == TYPE_CODE_REF ? &TYPE_REFERENCE_TYPE (type) : &TYPE_RVALUE_REFERENCE_TYPE (type)); @@ -522,7 +522,7 @@ make_function_type (struct type *type, struct type **typeptr) smash_type (ntype); } - TYPE_TARGET_TYPE (ntype) = type; + ntype->set_target_type (type); TYPE_LENGTH (ntype) = 1; ntype->set_code (TYPE_CODE_FUNC); @@ -876,7 +876,7 @@ allocate_stub_method (struct type *type) mtype->set_code (TYPE_CODE_METHOD); TYPE_LENGTH (mtype) = 1; mtype->set_is_stub (true); - TYPE_TARGET_TYPE (mtype) = type; + mtype->set_target_type (type); /* TYPE_SELF_TYPE (mtype) = unknown yet */ return mtype; } @@ -941,7 +941,7 @@ create_range_type (struct type *result_type, struct type *index_type, if (result_type == NULL) result_type = alloc_type_copy (index_type); result_type->set_code (TYPE_CODE_RANGE); - TYPE_TARGET_TYPE (result_type) = index_type; + result_type->set_target_type (index_type); if (index_type->is_stub ()) result_type->set_target_is_stub (true); else @@ -1378,7 +1378,7 @@ create_array_type_with_stride (struct type *result_type, result_type = alloc_type_copy (range_type); result_type->set_code (TYPE_CODE_ARRAY); - TYPE_TARGET_TYPE (result_type) = element_type; + result_type->set_target_type (element_type); result_type->set_num_fields (1); result_type->set_fields @@ -1522,7 +1522,7 @@ make_vector_type (struct type *array_type) type_instance_flags flags = elt_type->instance_flags () | TYPE_INSTANCE_FLAG_NOTTEXT; elt_type = make_qualified_type (elt_type, flags, NULL); - TYPE_TARGET_TYPE (inner_array) = elt_type; + inner_array->set_target_type (elt_type); } array_type->set_is_vector (true); @@ -1610,7 +1610,7 @@ smash_to_memberptr_type (struct type *type, struct type *self_type, { smash_type (type); type->set_code (TYPE_CODE_MEMBERPTR); - TYPE_TARGET_TYPE (type) = to_type; + type->set_target_type (to_type); set_type_self_type (type, self_type); /* Assume that a data member pointer is the same size as a normal pointer. */ @@ -1628,7 +1628,7 @@ smash_to_methodptr_type (struct type *type, struct type *to_type) { smash_type (type); type->set_code (TYPE_CODE_METHODPTR); - TYPE_TARGET_TYPE (type) = to_type; + type->set_target_type (to_type); set_type_self_type (type, TYPE_SELF_TYPE (to_type)); TYPE_LENGTH (type) = cplus_method_ptr_size (to_type); } @@ -1647,7 +1647,7 @@ smash_to_method_type (struct type *type, struct type *self_type, { smash_type (type); type->set_code (TYPE_CODE_METHOD); - TYPE_TARGET_TYPE (type) = to_type; + type->set_target_type (to_type); set_type_self_type (type, self_type); type->set_fields (args); type->set_num_fields (nargs); @@ -2438,10 +2438,10 @@ resolve_dynamic_array_or_string (struct type *type, struct type *rank_type = type; for (int i = 1; i < rank; i++) { - TYPE_TARGET_TYPE (rank_type) = copy_type (rank_type); + rank_type->set_target_type (copy_type (rank_type)); rank_type = TYPE_TARGET_TYPE (rank_type); } - TYPE_TARGET_TYPE (rank_type) = element_type; + rank_type->set_target_type (element_type); } } else @@ -2782,7 +2782,7 @@ resolve_dynamic_struct (struct type *type, /* The Ada language uses this field as a cache for static fixed types: reset it as RESOLVED_TYPE must have its own static fixed type. */ - TYPE_TARGET_TYPE (resolved_type) = NULL; + resolved_type->set_target_type (nullptr); return resolved_type; } @@ -2811,11 +2811,11 @@ resolve_dynamic_type_internal (struct type *type, if (type->code () == TYPE_CODE_TYPEDEF) { resolved_type = copy_type (type); - TYPE_TARGET_TYPE (resolved_type) - = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), addr_stack, - top_level); + resolved_type->set_target_type + (resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), addr_stack, + top_level)); } - else + else { /* Before trying to resolve TYPE, make sure it is not a stub. */ type = real_type; @@ -2836,9 +2836,9 @@ resolve_dynamic_type_internal (struct type *type, pinfo.next = addr_stack; resolved_type = copy_type (type); - TYPE_TARGET_TYPE (resolved_type) - = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), - &pinfo, top_level); + resolved_type->set_target_type + (resolve_dynamic_type_internal (TYPE_TARGET_TYPE (type), + &pinfo, top_level)); break; } @@ -3034,9 +3034,9 @@ check_typedef (struct type *type) } sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0).symbol; if (sym) - TYPE_TARGET_TYPE (type) = sym->type (); + type->set_target_type (sym->type ()); else /* TYPE_CODE_UNDEF */ - TYPE_TARGET_TYPE (type) = alloc_type_arch (type->arch ()); + type->set_target_type (alloc_type_arch (type->arch ())); } type = TYPE_TARGET_TYPE (type); @@ -3582,7 +3582,7 @@ init_complex_type (const char *name, struct type *target_type) TYPE_LENGTH (t) = 2 * TYPE_LENGTH (target_type); t->set_name (name); - TYPE_TARGET_TYPE (t) = target_type; + t->set_target_type (target_type); TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type = t; } @@ -3601,7 +3601,7 @@ init_pointer_type (struct objfile *objfile, struct type *t; t = init_type (objfile, TYPE_CODE_PTR, bit, name); - TYPE_TARGET_TYPE (t) = target_type; + t->set_target_type (target_type); t->set_is_unsigned (true); return t; } @@ -5728,8 +5728,8 @@ copy_type_recursive (struct type *type, htab_t copied_types) /* Copy pointers to other types. */ if (TYPE_TARGET_TYPE (type)) - TYPE_TARGET_TYPE (new_type) = - copy_type_recursive (TYPE_TARGET_TYPE (type), copied_types); + new_type->set_target_type + (copy_type_recursive (TYPE_TARGET_TYPE (type), copied_types)); /* Maybe copy the type_specific bits. @@ -5919,7 +5919,7 @@ arch_pointer_type (struct gdbarch *gdbarch, struct type *t; t = arch_type (gdbarch, TYPE_CODE_PTR, bit, name); - TYPE_TARGET_TYPE (t) = target_type; + t->set_target_type (target_type); t->set_is_unsigned (true); return t; } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 8ffcafc..4807674 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -968,7 +968,7 @@ struct main_type the type. - Unused otherwise. */ - struct type *target_type; + struct type *m_target_type; /* * For structure and union types, a description of each field. For set and pascal array types, there is one "field", @@ -1081,6 +1081,16 @@ struct type return this->field (0).type (); } + struct type *target_type () const + { + return this->main_type->m_target_type; + } + + void set_target_type (struct type *target_type) + { + this->main_type->m_target_type = target_type; + } + void set_index_type (type *index_type) { this->field (0).set_type (index_type); @@ -2087,7 +2097,7 @@ extern void allocate_gnat_aux_type (struct type *); allocate_fixed_point_type_info (type)) #define TYPE_MAIN_TYPE(thistype) (thistype)->main_type -#define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type +#define TYPE_TARGET_TYPE(thistype) ((thistype)->target_type ()) #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type #define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 5fe6be1..590dd35 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -294,20 +294,20 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch, /* __pid_t */ pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (int_type) * TARGET_CHAR_BIT, "__pid_t"); - TYPE_TARGET_TYPE (pid_type) = int_type; + pid_type->set_target_type (int_type); pid_type->set_target_is_stub (true); /* __uid_t */ uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (uint_type) * TARGET_CHAR_BIT, "__uid_t"); - TYPE_TARGET_TYPE (uid_type) = uint_type; + uid_type->set_target_type (uint_type); uid_type->set_target_is_stub (true); /* __clock_t */ clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (long_type) * TARGET_CHAR_BIT, "__clock_t"); - TYPE_TARGET_TYPE (clock_type) = long_type; + clock_type->set_target_type (long_type); clock_type->set_target_is_stub (true); /* _sifields */ diff --git a/gdb/netbsd-tdep.c b/gdb/netbsd-tdep.c index 2e30aaf..49382ea 100644 --- a/gdb/netbsd-tdep.c +++ b/gdb/netbsd-tdep.c @@ -416,23 +416,23 @@ nbsd_get_siginfo_type (struct gdbarch *gdbarch) /* pid_t */ type *pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (int32_type) * char_bits, "pid_t"); - TYPE_TARGET_TYPE (pid_type) = int32_type; + pid_type->set_target_type (int32_type); /* uid_t */ type *uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (uint32_type) * char_bits, "uid_t"); - TYPE_TARGET_TYPE (uid_type) = uint32_type; + uid_type->set_target_type (uint32_type); /* clock_t */ type *clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (int_type) * char_bits, "clock_t"); - TYPE_TARGET_TYPE (clock_type) = int_type; + clock_type->set_target_type (int_type); /* lwpid_t */ type *lwpid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, TYPE_LENGTH (int32_type) * char_bits, "lwpid_t"); - TYPE_TARGET_TYPE (lwpid_type) = int32_type; + lwpid_type->set_target_type (int32_type); /* union sigval */ type *sigval_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index cd6e6a9..3c484ce 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1717,7 +1717,7 @@ again: else { type->set_target_is_stub (true); - TYPE_TARGET_TYPE (type) = xtype; + type->set_target_type (xtype); } } break; diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index e5e37fc..c4c76e3 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -246,7 +246,7 @@ windows_get_tlb_type (struct gdbarch *gdbarch) seh_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT, NULL); - TYPE_TARGET_TYPE (seh_ptr_type) = seh_type; + seh_ptr_type->set_target_type (seh_type); append_composite_type_field (seh_type, "next_seh", seh_ptr_type); append_composite_type_field (seh_type, "handler", @@ -267,7 +267,7 @@ windows_get_tlb_type (struct gdbarch *gdbarch) peb_ldr_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT, NULL); - TYPE_TARGET_TYPE (peb_ldr_ptr_type) = peb_ldr_type; + peb_ldr_ptr_type->set_target_type (peb_ldr_type); /* struct UNICODE_STRING */ uni_str_type = arch_composite_type (gdbarch, "unicode_string", @@ -337,7 +337,7 @@ windows_get_tlb_type (struct gdbarch *gdbarch) peb_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT, NULL); - TYPE_TARGET_TYPE (peb_ptr_type) = peb_type; + peb_ptr_type->set_target_type (peb_type); /* struct thread information block */ @@ -381,7 +381,7 @@ windows_get_tlb_type (struct gdbarch *gdbarch) tib_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT, NULL); - TYPE_TARGET_TYPE (tib_ptr_type) = tib_type; + tib_ptr_type->set_target_type (tib_type); windows_gdbarch_data->tib_ptr_type = tib_ptr_type; |