From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alt-proxy28.mail.unifiedlayer.com (alt-proxy28.mail.unifiedlayer.com [74.220.216.123]) by sourceware.org (Postfix) with ESMTPS id EF9EA3858C5F for ; Mon, 13 Mar 2023 22:08:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EF9EA3858C5F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw11.mail.unifiedlayer.com (unknown [10.0.90.126]) by progateway1.mail.pro1.eigbox.com (Postfix) with ESMTP id 53B801003BDFB for ; Mon, 13 Mar 2023 22:08:07 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id bqKtpFhZZUEmJbqKtp3I7s; Mon, 13 Mar 2023 22:08:07 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=TLSA93pa c=1 sm=1 tr=0 ts=640f9ec7 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10:nop_charset_1 a=k__wU0fu6RkA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=LYk4rCbB9lQvAmMRl-gA:9 a=QEXdDO2ut3YA:10:nop_charset_2 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=I0KNQoFgCgVU7zWPZ6x0RSxX5X1RIouv7fCCNmvyJiQ=; b=pFzCjujd/Yj4+ukcUYyAlKVnGn 3isW1k/lWUV9c92lo6sWsHiX7HnhXhbvl4OR7DpcATWUeS0sXr3I3NXERlDXj1DReU019LLlhyn8F GSTmWM62NGG3Y6c/jNxigrncZ; Received: from 71-211-185-113.hlrn.qwest.net ([71.211.185.113]:52788 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pbqKt-000u2m-2h for gdb-patches@sourceware.org; Mon, 13 Mar 2023 16:08:07 -0600 From: Tom Tromey Date: Mon, 13 Mar 2023 16:08:06 -0600 Subject: [PATCH 06/20] Remove arch_type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230313-split-objfile-type-allocator-2-v1-6-69ba773ac17b@tromey.com> References: <20230313-split-objfile-type-allocator-2-v1-0-69ba773ac17b@tromey.com> In-Reply-To: <20230313-split-objfile-type-allocator-2-v1-0-69ba773ac17b@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.1 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 71.211.185.113 X-Source-L: No X-Exim-ID: 1pbqKt-000u2m-2h X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-185-113.hlrn.qwest.net ([192.168.0.21]) [71.211.185.113]:52788 X-Source-Auth: tom+tromey.com X-Email-Count: 7 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3026.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This removes arch_type, replacing all uses with the new type allocator. --- gdb/ada-lang.c | 5 +++-- gdb/amdgpu-tdep.c | 5 +++-- gdb/avr-tdep.c | 4 ++-- gdb/f-lang.c | 8 +++++--- gdb/fbsd-tdep.c | 12 +++++++----- gdb/ft32-tdep.c | 3 ++- gdb/gdbtypes.c | 48 +++++++++++++++-------------------------------- gdb/gdbtypes.h | 2 -- gdb/gnu-v3-abi.c | 7 +++++-- gdb/linux-tdep.c | 18 +++++++++++------- gdb/m32c-tdep.c | 3 ++- gdb/netbsd-tdep.c | 22 +++++++++++++--------- gdb/rl78-tdep.c | 4 ++-- gdb/target-descriptions.c | 5 +++-- gdb/windows-tdep.c | 28 ++++++++++++++------------- gdb/z80-tdep.c | 5 +++-- 16 files changed, 91 insertions(+), 88 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 624584e8ee5..2e99dfa0c6f 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13556,6 +13556,7 @@ class ada_language : public language_defn lai->add_primitive_type (t); }; + type_allocator alloc (gdbarch); add (arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "integer")); add (arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), @@ -13584,8 +13585,8 @@ class ada_language : public language_defn add (builtin->builtin_void); struct type *system_addr_ptr - = lookup_pointer_type (arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, - "void")); + = lookup_pointer_type (alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, + "void")); system_addr_ptr->set_name ("system__address"); add (system_addr_ptr); diff --git a/gdb/amdgpu-tdep.c b/gdb/amdgpu-tdep.c index d681d9d6a50..1077fab5c65 100644 --- a/gdb/amdgpu-tdep.c +++ b/gdb/amdgpu-tdep.c @@ -749,8 +749,9 @@ amd_dbgapi_register_type_to_gdb_type (const amd_dbgapi_register_type &type, const auto &enum_type = static_cast (type); struct type *gdb_type - = arch_type (gdbarch, TYPE_CODE_ENUM, enum_type.bit_size (), - enum_type.name ().c_str ()); + = (type_allocator (gdbarch) + .new_type (TYPE_CODE_ENUM, enum_type.bit_size (), + enum_type.name ().c_str ())); gdb_type->set_num_fields (enum_type.size ()); gdb_type->set_fields diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index ba98fbf6f82..f9f498bfed2 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -1473,8 +1473,8 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Create a type for PC. We can't use builtin types here, as they may not be defined. */ - tdep->void_type = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, - "void"); + type_allocator alloc (gdbarch); + tdep->void_type = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); tdep->func_void_type = make_function_type (tdep->void_type, NULL); tdep->pc_type = arch_pointer_type (gdbarch, 4 * TARGET_CHAR_BIT, NULL, tdep->func_void_type); diff --git a/gdb/f-lang.c b/gdb/f-lang.c index e1eb47577d6..3bf33d020c6 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -1727,8 +1727,10 @@ build_fortran_types (struct gdbarch *gdbarch) builtin_f_type->builtin_void = builtin_type (gdbarch)->builtin_void; + type_allocator alloc (gdbarch); + builtin_f_type->builtin_character - = arch_type (gdbarch, TYPE_CODE_CHAR, TARGET_CHAR_BIT, "character"); + = alloc.new_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT, "character"); builtin_f_type->builtin_logical_s1 = arch_boolean_type (gdbarch, TARGET_CHAR_BIT, 1, "logical*1"); @@ -1774,7 +1776,7 @@ build_fortran_types (struct gdbarch *gdbarch) "real*16", gdbarch_long_double_format (gdbarch)); else builtin_f_type->builtin_real_s16 - = arch_type (gdbarch, TYPE_CODE_ERROR, 128, "real*16"); + = alloc.new_type (TYPE_CODE_ERROR, 128, "real*16"); builtin_f_type->builtin_complex = init_complex_type ("complex*4", builtin_f_type->builtin_real); @@ -1784,7 +1786,7 @@ build_fortran_types (struct gdbarch *gdbarch) if (builtin_f_type->builtin_real_s16->code () == TYPE_CODE_ERROR) builtin_f_type->builtin_complex_s16 - = arch_type (gdbarch, TYPE_CODE_ERROR, 256, "complex*16"); + = alloc.new_type (TYPE_CODE_ERROR, 256, "complex*16"); else builtin_f_type->builtin_complex_s16 = init_complex_type ("complex*16", builtin_f_type->builtin_real_s16); diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index 3a7cb9b14ea..236a9f4d615 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -1609,15 +1609,17 @@ fbsd_get_siginfo_type (struct gdbarch *gdbarch) append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type); /* __pid_t */ - pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - int32_type->length () * TARGET_CHAR_BIT, "__pid_t"); + type_allocator alloc (gdbarch); + pid_type = alloc.new_type (TYPE_CODE_TYPEDEF, + int32_type->length () * TARGET_CHAR_BIT, + "__pid_t"); pid_type->set_target_type (int32_type); pid_type->set_target_is_stub (true); /* __uid_t */ - uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - uint32_type->length () * TARGET_CHAR_BIT, - "__uid_t"); + uid_type = alloc.new_type (TYPE_CODE_TYPEDEF, + uint32_type->length () * TARGET_CHAR_BIT, + "__uid_t"); uid_type->set_target_type (uint32_type); pid_type->set_target_is_stub (true); diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c index 7a69da61fdb..7182185313f 100644 --- a/gdb/ft32-tdep.c +++ b/gdb/ft32-tdep.c @@ -573,7 +573,8 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Create a type for PC. We can't use builtin types here, as they may not be defined. */ - void_type = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); + type_allocator alloc (gdbarch); + void_type = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); func_void_type = make_function_type (void_type, NULL); tdep->pc_type = arch_pointer_type (gdbarch, 4 * TARGET_CHAR_BIT, NULL, func_void_type); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 3d1d9239758..f52899e0a5e 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -5786,26 +5786,6 @@ copy_type (const struct type *type) /* Helper functions to initialize architecture-specific types. */ -/* Allocate a type structure associated with GDBARCH and set its - CODE, LENGTH, and NAME fields. */ - -struct type * -arch_type (struct gdbarch *gdbarch, - enum type_code code, int bit, const char *name) -{ - struct type *type; - - type = type_allocator (gdbarch).new_type (); - set_type_code (type, code); - gdb_assert ((bit % TARGET_CHAR_BIT) == 0); - type->set_length (bit / TARGET_CHAR_BIT); - - if (name) - type->set_name (gdbarch_obstack_strdup (gdbarch, name)); - - return type; -} - /* Allocate a TYPE_CODE_INT type structure associated with GDBARCH. BIT is the type size in bits. If UNSIGNED_P is non-zero, set the type's TYPE_UNSIGNED flag. NAME is the type name. */ @@ -5816,7 +5796,7 @@ arch_integer_type (struct gdbarch *gdbarch, { struct type *t; - t = arch_type (gdbarch, TYPE_CODE_INT, bit, name); + t = type_allocator (gdbarch).new_type (TYPE_CODE_INT, bit, name); if (unsigned_p) t->set_is_unsigned (true); @@ -5833,7 +5813,7 @@ arch_character_type (struct gdbarch *gdbarch, { struct type *t; - t = arch_type (gdbarch, TYPE_CODE_CHAR, bit, name); + t = type_allocator (gdbarch).new_type (TYPE_CODE_CHAR, bit, name); if (unsigned_p) t->set_is_unsigned (true); @@ -5850,7 +5830,7 @@ arch_boolean_type (struct gdbarch *gdbarch, { struct type *t; - t = arch_type (gdbarch, TYPE_CODE_BOOL, bit, name); + t = type_allocator (gdbarch).new_type (TYPE_CODE_BOOL, bit, name); if (unsigned_p) t->set_is_unsigned (true); @@ -5871,7 +5851,7 @@ arch_float_type (struct gdbarch *gdbarch, struct type *t; bit = verify_floatformat (bit, fmt); - t = arch_type (gdbarch, TYPE_CODE_FLT, bit, name); + t = type_allocator (gdbarch).new_type (TYPE_CODE_FLT, bit, name); TYPE_FLOATFORMAT (t) = fmt; return t; @@ -5885,7 +5865,7 @@ arch_decfloat_type (struct gdbarch *gdbarch, int bit, const char *name) { struct type *t; - t = arch_type (gdbarch, TYPE_CODE_DECFLOAT, bit, name); + t = type_allocator (gdbarch).new_type (TYPE_CODE_DECFLOAT, bit, name); return t; } @@ -5900,7 +5880,7 @@ arch_pointer_type (struct gdbarch *gdbarch, { struct type *t; - t = arch_type (gdbarch, TYPE_CODE_PTR, bit, name); + t = type_allocator (gdbarch).new_type (TYPE_CODE_PTR, bit, name); t->set_target_type (target_type); t->set_is_unsigned (true); return t; @@ -5914,7 +5894,7 @@ arch_flags_type (struct gdbarch *gdbarch, const char *name, int bit) { struct type *type; - type = arch_type (gdbarch, TYPE_CODE_FLAGS, bit, name); + type = type_allocator (gdbarch).new_type (TYPE_CODE_FLAGS, bit, name); type->set_is_unsigned (true); type->set_num_fields (0); /* Pre-allocate enough space assuming every field is one bit. */ @@ -5970,7 +5950,7 @@ arch_composite_type (struct gdbarch *gdbarch, const char *name, struct type *t; gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION); - t = arch_type (gdbarch, code, 0, NULL); + t = type_allocator (gdbarch).new_type (code, 0, NULL); t->set_name (name); INIT_CPLUS_SPECIFIC (t); return t; @@ -6134,9 +6114,11 @@ create_gdbtypes_data (struct gdbarch *gdbarch) { struct builtin_type *builtin_type = new struct builtin_type; + type_allocator alloc (gdbarch); + /* Basic types. */ builtin_type->builtin_void - = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); + = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); builtin_type->builtin_char = arch_integer_type (gdbarch, TARGET_CHAR_BIT, !gdbarch_char_signed (gdbarch), "char"); @@ -6191,7 +6173,7 @@ create_gdbtypes_data (struct gdbarch *gdbarch) builtin_type->builtin_double_complex = init_complex_type ("double complex", builtin_type->builtin_double); builtin_type->builtin_string - = arch_type (gdbarch, TYPE_CODE_STRING, TARGET_CHAR_BIT, "string"); + = alloc.new_type (TYPE_CODE_STRING, TARGET_CHAR_BIT, "string"); builtin_type->builtin_bool = arch_boolean_type (gdbarch, TARGET_CHAR_BIT, 1, "bool"); @@ -6265,12 +6247,12 @@ create_gdbtypes_data (struct gdbarch *gdbarch) /* This type represents a GDB internal function. */ builtin_type->internal_fn - = arch_type (gdbarch, TYPE_CODE_INTERNAL_FUNCTION, 0, - ""); + = alloc.new_type (TYPE_CODE_INTERNAL_FUNCTION, 0, + ""); /* This type represents an xmethod. */ builtin_type->xmethod - = arch_type (gdbarch, TYPE_CODE_XMETHOD, 0, ""); + = alloc.new_type (TYPE_CODE_XMETHOD, 0, ""); return builtin_type; } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index c052b74d1f3..657c04be56e 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -2316,8 +2316,6 @@ extern struct type *init_fixed_point_type (struct objfile *, int, int, const char *); /* Helper functions to construct architecture-owned types. */ -extern struct type *arch_type (struct gdbarch *, enum type_code, int, - const char *); extern struct type *arch_integer_type (struct gdbarch *, int, int, const char *); extern struct type *arch_character_type (struct gdbarch *, int, int, diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 6d1a36623f8..a3e2d73f10a 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -125,6 +125,8 @@ get_gdb_vtable_type (struct gdbarch *arch) struct type *ptr_to_void_fn_type = builtin_type (arch)->builtin_func_ptr; + type_allocator alloc (arch); + /* ARCH can't give us the true ptrdiff_t type, so we guess. */ struct type *ptrdiff_type = arch_integer_type (arch, gdbarch_ptr_bit (arch), 0, "ptrdiff_t"); @@ -170,7 +172,7 @@ get_gdb_vtable_type (struct gdbarch *arch) /* We assumed in the allocation above that there were four fields. */ gdb_assert (field == (field_list + 4)); - t = arch_type (arch, TYPE_CODE_STRUCT, offset * TARGET_CHAR_BIT, NULL); + t = alloc.new_type (TYPE_CODE_STRUCT, offset * TARGET_CHAR_BIT, NULL); t->set_num_fields (field - field_list); t->set_fields (field_list); t->set_name ("gdb_gnu_v3_abi_vtable"); @@ -1053,7 +1055,8 @@ build_std_type_info_type (struct gdbarch *arch) gdb_assert (field == (field_list + 2)); - t = arch_type (arch, TYPE_CODE_STRUCT, offset * TARGET_CHAR_BIT, NULL); + t = type_allocator (arch).new_type (TYPE_CODE_STRUCT, + offset * TARGET_CHAR_BIT, nullptr); t->set_num_fields (field - field_list); t->set_fields (field_list); t->set_name ("gdb_gnu_v3_type_info"); diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index e6ce13a1c67..9192fc99be3 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -275,6 +275,8 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch, if (linux_gdbarch_data->siginfo_type != NULL) return linux_gdbarch_data->siginfo_type; + type_allocator alloc (gdbarch); + int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "int"); uint_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), @@ -292,21 +294,23 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch, append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type); /* __pid_t */ - pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - int_type->length () * TARGET_CHAR_BIT, "__pid_t"); + pid_type = alloc.new_type (TYPE_CODE_TYPEDEF, + int_type->length () * TARGET_CHAR_BIT, + "__pid_t"); pid_type->set_target_type (int_type); pid_type->set_target_is_stub (true); /* __uid_t */ - uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - uint_type->length () * TARGET_CHAR_BIT, "__uid_t"); + uid_type = alloc.new_type (TYPE_CODE_TYPEDEF, + uint_type->length () * TARGET_CHAR_BIT, + "__uid_t"); uid_type->set_target_type (uint_type); uid_type->set_target_is_stub (true); /* __clock_t */ - clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - long_type->length () * TARGET_CHAR_BIT, - "__clock_t"); + clock_type = alloc.new_type (TYPE_CODE_TYPEDEF, + long_type->length () * TARGET_CHAR_BIT, + "__clock_t"); clock_type->set_target_type (long_type); clock_type->set_target_is_stub (true); diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 2899c9aef90..e500ba88a42 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -185,7 +185,8 @@ make_types (struct gdbarch *arch) /* The builtin_type_mumble variables are sometimes uninitialized when this is called, so we avoid using them. */ - tdep->voyd = arch_type (arch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); + type_allocator alloc (arch); + tdep->voyd = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); tdep->ptr_voyd = arch_pointer_type (arch, gdbarch_ptr_bit (arch), NULL, tdep->voyd); tdep->func_voyd = lookup_function_type (tdep->voyd); diff --git a/gdb/netbsd-tdep.c b/gdb/netbsd-tdep.c index 05f8d27f32d..ed60200f958 100644 --- a/gdb/netbsd-tdep.c +++ b/gdb/netbsd-tdep.c @@ -414,24 +414,28 @@ nbsd_get_siginfo_type (struct gdbarch *gdbarch) size_t char_bits = gdbarch_addressable_memory_unit_size (gdbarch) * 8; /* pid_t */ - type *pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - int32_type->length () * char_bits, "pid_t"); + type_allocator alloc (gdbarch); + type *pid_type = alloc.new_type (TYPE_CODE_TYPEDEF, + int32_type->length () * char_bits, + "pid_t"); pid_type->set_target_type (int32_type); /* uid_t */ - type *uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - uint32_type->length () * char_bits, "uid_t"); + type *uid_type = alloc.new_type (TYPE_CODE_TYPEDEF, + uint32_type->length () * char_bits, + "uid_t"); uid_type->set_target_type (uint32_type); /* clock_t */ - type *clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - int_type->length () * char_bits, "clock_t"); + type *clock_type = alloc.new_type (TYPE_CODE_TYPEDEF, + int_type->length () * char_bits, + "clock_t"); clock_type->set_target_type (int_type); /* lwpid_t */ - type *lwpid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - int32_type->length () * char_bits, - "lwpid_t"); + type *lwpid_type = alloc.new_type (TYPE_CODE_TYPEDEF, + int32_type->length () * char_bits, + "lwpid_t"); lwpid_type->set_target_type (int32_type); /* union sigval */ diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c index 1af78d9c652..1177215490f 100644 --- a/gdb/rl78-tdep.c +++ b/gdb/rl78-tdep.c @@ -1409,8 +1409,8 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->elf_flags = elf_flags; /* Initialize types. */ - tdep->rl78_void = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, - "void"); + type_allocator alloc (gdbarch); + tdep->rl78_void = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); tdep->rl78_uint8 = arch_integer_type (gdbarch, 8, 1, "uint8_t"); tdep->rl78_int8 = arch_integer_type (gdbarch, 8, 0, "int8_t"); tdep->rl78_uint16 = arch_integer_type (gdbarch, 16, 1, "uint16_t"); diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index c62d4368d6b..7af3875b48b 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -284,8 +284,9 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype) void make_gdb_type_enum (const tdesc_type_with_fields *e) { - m_type = arch_type (m_gdbarch, TYPE_CODE_ENUM, e->size * TARGET_CHAR_BIT, - e->name.c_str ()); + m_type = (type_allocator (m_gdbarch) + .new_type (TYPE_CODE_ENUM, e->size * TARGET_CHAR_BIT, + e->name.c_str ())); m_type->set_is_unsigned (true); diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 97199527c8b..5a58aa37953 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -214,6 +214,8 @@ windows_get_tlb_type (struct gdbarch *gdbarch) if (windows_gdbarch_data->tib_ptr_type != nullptr) return windows_gdbarch_data->tib_ptr_type; + type_allocator alloc (gdbarch); + dword_ptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "DWORD_PTR"); dword32_type = arch_integer_type (gdbarch, 32, @@ -243,9 +245,9 @@ windows_get_tlb_type (struct gdbarch *gdbarch) seh_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); seh_type->set_name (xstrdup ("seh")); - seh_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, - void_ptr_type->length () * TARGET_CHAR_BIT, - NULL); + seh_ptr_type = alloc.new_type (TYPE_CODE_PTR, + void_ptr_type->length () * TARGET_CHAR_BIT, + NULL); seh_ptr_type->set_target_type (seh_type); append_composite_type_field (seh_type, "next_seh", seh_ptr_type); @@ -264,9 +266,9 @@ windows_get_tlb_type (struct gdbarch *gdbarch) append_composite_type_field (peb_ldr_type, "in_init_order", list_type); append_composite_type_field (peb_ldr_type, "entry_in_progress", void_ptr_type); - peb_ldr_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, - void_ptr_type->length () * TARGET_CHAR_BIT, - NULL); + peb_ldr_ptr_type = alloc.new_type (TYPE_CODE_PTR, + void_ptr_type->length () * TARGET_CHAR_BIT, + NULL); peb_ldr_ptr_type->set_target_type (peb_ldr_type); /* struct UNICODE_STRING */ @@ -334,9 +336,9 @@ windows_get_tlb_type (struct gdbarch *gdbarch) append_composite_type_field (peb_type, "sub_system_data", void_ptr_type); append_composite_type_field (peb_type, "process_heap", void_ptr_type); append_composite_type_field (peb_type, "fast_peb_lock", void_ptr_type); - peb_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, - void_ptr_type->length () * TARGET_CHAR_BIT, - NULL); + peb_ptr_type = alloc.new_type (TYPE_CODE_PTR, + void_ptr_type->length () * TARGET_CHAR_BIT, + NULL); peb_ptr_type->set_target_type (peb_type); @@ -378,9 +380,9 @@ windows_get_tlb_type (struct gdbarch *gdbarch) /* uint32_t last_error_number; %fs:0x0034 */ append_composite_type_field (tib_type, "last_error_number", dword_ptr_type); - tib_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, - void_ptr_type->length () * TARGET_CHAR_BIT, - NULL); + tib_ptr_type = alloc.new_type (TYPE_CODE_PTR, + void_ptr_type->length () * TARGET_CHAR_BIT, + NULL); tib_ptr_type->set_target_type (tib_type); windows_gdbarch_data->tib_ptr_type = tib_ptr_type; @@ -742,7 +744,7 @@ create_enum (struct gdbarch *gdbarch, int bit, const char *name, struct type *type; int i; - type = arch_type (gdbarch, TYPE_CODE_ENUM, bit, name); + type = type_allocator (gdbarch).new_type (TYPE_CODE_ENUM, bit, name); type->set_num_fields (count); type->set_fields ((struct field *) TYPE_ZALLOC (type, sizeof (struct field) * count)); diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c index fb4077088eb..78b3827b54d 100644 --- a/gdb/z80-tdep.c +++ b/gdb/z80-tdep.c @@ -1139,8 +1139,9 @@ z80_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Create a type for PC. We can't use builtin types here, as they may not be defined. */ - tdep->void_type = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, - "void"); + type_allocator alloc (gdbarch); + tdep->void_type = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, + "void"); tdep->func_void_type = make_function_type (tdep->void_type, NULL); tdep->pc_type = arch_pointer_type (gdbarch, tdep->addr_length * TARGET_CHAR_BIT, -- 2.39.1