From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 6717F3858C36; Sat, 18 Mar 2023 17:19:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6717F3858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679159991; bh=UQUoFYpeW2q1QIDDcPvBEyu5wr01BNQ7QjEpU/7lTo4=; h=From:To:Subject:Date:From; b=nvOinTrxb3Pr3vKTM2M5SSPyNQwgKM/Ohz2zFJdFKqVE107Jijhgt9t2WrZ9Yuook 7gzLhLWtB0yqV4RMIz4IqaG3AQui148o8LQgWdtdnzzKFUpw9Z0wbYgaVX/+t66Pif CNJHmS5MLK0DcdSFn7eFmYUJxopAHRYj2DIO5Yj4= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Unify arch_integer_type and init_integer_type X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 333859402c7968dc718dae73ca0fbddbe096fc51 X-Git-Newrev: 2d39ccd3d1773b26ed8178bcd77375175c48ee62 Message-Id: <20230318171951.6717F3858C36@sourceware.org> Date: Sat, 18 Mar 2023 17:19:51 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D2d39ccd3d177= 3b26ed8178bcd77375175c48ee62 commit 2d39ccd3d1773b26ed8178bcd77375175c48ee62 Author: Tom Tromey Date: Mon Mar 13 10:31:06 2023 -0600 Unify arch_integer_type and init_integer_type =20 This unifies arch_integer_type and init_integer_type by using a type allocator. =20 Reviewed-By: Simon Marchi Diff: --- gdb/ada-lang.c | 14 ++++---- gdb/ctfread.c | 2 +- gdb/d-lang.c | 21 +++++------ gdb/dwarf2/expr.c | 9 +++-- gdb/dwarf2/read.c | 5 ++- gdb/f-lang.c | 8 ++--- gdb/fbsd-tdep.c | 10 +++--- gdb/gdbtypes.c | 103 ++++++++++++++++++++++---------------------------= ---- gdb/gdbtypes.h | 10 +++--- gdb/gnu-v3-abi.c | 2 +- gdb/go-lang.c | 23 ++++++------ gdb/linux-tdep.c | 11 +++--- gdb/m2-lang.c | 6 ++-- gdb/m32c-tdep.c | 12 +++---- gdb/mdebugread.c | 30 ++++++++-------- gdb/opencl-lang.c | 33 ++++++++--------- gdb/rl78-tdep.c | 12 +++---- gdb/rust-lang.c | 23 ++++++------ gdb/stabsread.c | 56 ++++++++++++++--------------- gdb/windows-tdep.c | 13 +++---- gdb/xtensa-tdep.c | 3 +- 21 files changed, 201 insertions(+), 205 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 2e99dfa0c6f..a3ceb3ae838 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13557,11 +13557,11 @@ public: }; =20 type_allocator alloc (gdbarch); - add (arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), + add (init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "integer")); - add (arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), + add (init_integer_type (alloc, gdbarch_long_bit (gdbarch), 0, "long_integer")); - add (arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), + add (init_integer_type (alloc, gdbarch_short_bit (gdbarch), 0, "short_integer")); struct type *char_type =3D arch_character_type (gdbarch, TARGET_CHAR_B= IT, 1, "character"); @@ -13573,14 +13573,14 @@ public: "float", gdbarch_float_format (gdbarch))); add (arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), "long_float", gdbarch_double_format (gdbarch))); - add (arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), + add (init_integer_type (alloc, gdbarch_long_long_bit (gdbarch), 0, "long_long_integer")); add (arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), "long_long_float", gdbarch_long_double_format (gdbarch))); - add (arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), + add (init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "natural")); - add (arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), + add (init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "positive")); add (builtin->builtin_void); =20 @@ -13594,7 +13594,7 @@ public: type. This is a signed integral type whose size is the same as the size of addresses. */ unsigned int addr_length =3D system_addr_ptr->length (); - add (arch_integer_type (gdbarch, addr_length * HOST_CHAR_BIT, 0, + add (init_integer_type (alloc, addr_length * HOST_CHAR_BIT, 0, "storage_offset")); =20 lai->set_bool_type (builtin->builtin_bool); diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 82c2cdb3abb..879fdeb74d6 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -577,7 +577,7 @@ read_base_type (struct ctf_context *ccp, ctf_id_t tid) bits =3D cet.cte_bits; else bits =3D gdbarch_int_bit (gdbarch); - type =3D init_integer_type (of, bits, !issigned, name); + type =3D init_integer_type (alloc, bits, !issigned, name); } } else if (kind =3D=3D CTF_K_FLOAT) diff --git a/gdb/d-lang.c b/gdb/d-lang.c index 457e367fd51..af9a81d1b1b 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -201,29 +201,30 @@ build_d_types (struct gdbarch *gdbarch) struct builtin_d_type *builtin_d_type =3D new struct builtin_d_type; =20 /* Basic types. */ + type_allocator alloc (gdbarch); builtin_d_type->builtin_void =3D builtin_type (gdbarch)->builtin_void; builtin_d_type->builtin_bool =3D arch_boolean_type (gdbarch, 8, 1, "bool"); builtin_d_type->builtin_byte - =3D arch_integer_type (gdbarch, 8, 0, "byte"); + =3D init_integer_type (alloc, 8, 0, "byte"); builtin_d_type->builtin_ubyte - =3D arch_integer_type (gdbarch, 8, 1, "ubyte"); + =3D init_integer_type (alloc, 8, 1, "ubyte"); builtin_d_type->builtin_short - =3D arch_integer_type (gdbarch, 16, 0, "short"); + =3D init_integer_type (alloc, 16, 0, "short"); builtin_d_type->builtin_ushort - =3D arch_integer_type (gdbarch, 16, 1, "ushort"); + =3D init_integer_type (alloc, 16, 1, "ushort"); builtin_d_type->builtin_int - =3D arch_integer_type (gdbarch, 32, 0, "int"); + =3D init_integer_type (alloc, 32, 0, "int"); builtin_d_type->builtin_uint - =3D arch_integer_type (gdbarch, 32, 1, "uint"); + =3D init_integer_type (alloc, 32, 1, "uint"); builtin_d_type->builtin_long - =3D arch_integer_type (gdbarch, 64, 0, "long"); + =3D init_integer_type (alloc, 64, 0, "long"); builtin_d_type->builtin_ulong - =3D arch_integer_type (gdbarch, 64, 1, "ulong"); + =3D init_integer_type (alloc, 64, 1, "ulong"); builtin_d_type->builtin_cent - =3D arch_integer_type (gdbarch, 128, 0, "cent"); + =3D init_integer_type (alloc, 128, 0, "cent"); builtin_d_type->builtin_ucent - =3D arch_integer_type (gdbarch, 128, 1, "ucent"); + =3D init_integer_type (alloc, 128, 1, "ucent"); builtin_d_type->builtin_float =3D arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "float", gdbarch_float_format (gdbarch)); diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 2b41372be8a..d245bc65ef2 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -700,9 +700,12 @@ dwarf_expr_context::address_type () const 8 * this->m_addr_size); =20 if (types->dw_types[ndx] =3D=3D NULL) - types->dw_types[ndx] - =3D arch_integer_type (arch, 8 * this->m_addr_size, - 0, ""); + { + type_allocator alloc (arch); + types->dw_types[ndx] + =3D init_integer_type (alloc, 8 * this->m_addr_size, + 0, ""); + } =20 return types->dw_types[ndx]; } diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 2501007b87a..d676f003cf5 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -15036,7 +15036,10 @@ dwarf2_init_integer_type (struct dwarf2_cu *cu, st= ruct objfile *objfile, && strcmp (name, "void") =3D=3D 0) type =3D objfile_type (objfile)->builtin_void; else - type =3D init_integer_type (objfile, bits, unsigned_p, name); + { + type_allocator alloc (objfile); + type =3D init_integer_type (alloc, bits, unsigned_p, name); + } =20 return type; } diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 3bf33d020c6..cb63c3704c1 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -1746,16 +1746,16 @@ build_fortran_types (struct gdbarch *gdbarch) "logical*8"); =20 builtin_f_type->builtin_integer_s1 - =3D arch_integer_type (gdbarch, TARGET_CHAR_BIT, 0, "integer*1"); + =3D init_integer_type (alloc, TARGET_CHAR_BIT, 0, "integer*1"); =20 builtin_f_type->builtin_integer_s2 - =3D arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), 0, "integ= er*2"); + =3D init_integer_type (alloc, gdbarch_short_bit (gdbarch), 0, "integer= *2"); =20 builtin_f_type->builtin_integer - =3D arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "integer= *4"); + =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "integer*4= "); =20 builtin_f_type->builtin_integer_s8 - =3D arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), 0, + =3D init_integer_type (alloc, gdbarch_long_long_bit (gdbarch), 0, "integer*8"); =20 builtin_f_type->builtin_real diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index 236a9f4d615..dc5020d92d2 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -1594,11 +1594,12 @@ fbsd_get_siginfo_type (struct gdbarch *gdbarch) if (fbsd_gdbarch_data->siginfo_type !=3D NULL) return fbsd_gdbarch_data->siginfo_type; =20 - int_type =3D arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), + type_allocator alloc (gdbarch); + int_type =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "int"); - int32_type =3D arch_integer_type (gdbarch, 32, 0, "int32_t"); - uint32_type =3D arch_integer_type (gdbarch, 32, 1, "uint32_t"); - long_type =3D arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), + int32_type =3D init_integer_type (alloc, 32, 0, "int32_t"); + uint32_type =3D init_integer_type (alloc, 32, 1, "uint32_t"); + long_type =3D init_integer_type (alloc, gdbarch_long_bit (gdbarch), 0, "long"); void_ptr_type =3D lookup_pointer_type (builtin_type (gdbarch)->builtin_v= oid); =20 @@ -1609,7 +1610,6 @@ fbsd_get_siginfo_type (struct gdbarch *gdbarch) append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type); =20 /* __pid_t */ - type_allocator alloc (gdbarch); pid_type =3D alloc.new_type (TYPE_CODE_TYPEDEF, int32_type->length () * TARGET_CHAR_BIT, "__pid_t"); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index c16651534ed..f5ddc869ebf 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3398,17 +3398,15 @@ floatformat_from_type (const struct type *type) return TYPE_FLOATFORMAT (type); } =20 -/* Allocate a TYPE_CODE_INT type structure associated with OBJFILE. - 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. */ +/* See gdbtypes.h. */ =20 struct type * -init_integer_type (struct objfile *objfile, +init_integer_type (type_allocator &alloc, int bit, int unsigned_p, const char *name) { struct type *t; =20 - t =3D type_allocator (objfile).new_type (TYPE_CODE_INT, bit, name); + t =3D alloc.new_type (TYPE_CODE_INT, bit, name); if (unsigned_p) t->set_is_unsigned (true); =20 @@ -5752,23 +5750,6 @@ copy_type (const struct type *type) =0C /* Helper functions to initialize architecture-specific types. */ =20 -/* 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. */ - -struct type * -arch_integer_type (struct gdbarch *gdbarch, - int bit, int unsigned_p, const char *name) -{ - struct type *t; - - t =3D type_allocator (gdbarch).new_type (TYPE_CODE_INT, bit, name); - if (unsigned_p) - t->set_is_unsigned (true); - - return t; -} - /* Allocate a TYPE_CODE_CHAR 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. */ @@ -6086,38 +6067,38 @@ create_gdbtypes_data (struct gdbarch *gdbarch) builtin_type->builtin_void =3D alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); builtin_type->builtin_char - =3D arch_integer_type (gdbarch, TARGET_CHAR_BIT, + =3D init_integer_type (alloc, TARGET_CHAR_BIT, !gdbarch_char_signed (gdbarch), "char"); builtin_type->builtin_char->set_has_no_signedness (true); builtin_type->builtin_signed_char - =3D arch_integer_type (gdbarch, TARGET_CHAR_BIT, + =3D init_integer_type (alloc, TARGET_CHAR_BIT, 0, "signed char"); builtin_type->builtin_unsigned_char - =3D arch_integer_type (gdbarch, TARGET_CHAR_BIT, + =3D init_integer_type (alloc, TARGET_CHAR_BIT, 1, "unsigned char"); builtin_type->builtin_short - =3D arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_short_bit (gdbarch), 0, "short"); builtin_type->builtin_unsigned_short - =3D arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_short_bit (gdbarch), 1, "unsigned short"); builtin_type->builtin_int - =3D arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "int"); builtin_type->builtin_unsigned_int - =3D arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 1, "unsigned int"); builtin_type->builtin_long - =3D arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_long_bit (gdbarch), 0, "long"); builtin_type->builtin_unsigned_long - =3D arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_long_bit (gdbarch), 1, "unsigned long"); builtin_type->builtin_long_long - =3D arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_long_long_bit (gdbarch), 0, "long long"); builtin_type->builtin_unsigned_long_long - =3D arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_long_long_bit (gdbarch), 1, "unsigned long long"); builtin_type->builtin_half =3D arch_float_type (gdbarch, gdbarch_half_bit (gdbarch), @@ -6160,31 +6141,31 @@ create_gdbtypes_data (struct gdbarch *gdbarch) =20 /* Fixed-size integer types. */ builtin_type->builtin_int0 - =3D arch_integer_type (gdbarch, 0, 0, "int0_t"); + =3D init_integer_type (alloc, 0, 0, "int0_t"); builtin_type->builtin_int8 - =3D arch_integer_type (gdbarch, 8, 0, "int8_t"); + =3D init_integer_type (alloc, 8, 0, "int8_t"); builtin_type->builtin_uint8 - =3D arch_integer_type (gdbarch, 8, 1, "uint8_t"); + =3D init_integer_type (alloc, 8, 1, "uint8_t"); builtin_type->builtin_int16 - =3D arch_integer_type (gdbarch, 16, 0, "int16_t"); + =3D init_integer_type (alloc, 16, 0, "int16_t"); builtin_type->builtin_uint16 - =3D arch_integer_type (gdbarch, 16, 1, "uint16_t"); + =3D init_integer_type (alloc, 16, 1, "uint16_t"); builtin_type->builtin_int24 - =3D arch_integer_type (gdbarch, 24, 0, "int24_t"); + =3D init_integer_type (alloc, 24, 0, "int24_t"); builtin_type->builtin_uint24 - =3D arch_integer_type (gdbarch, 24, 1, "uint24_t"); + =3D init_integer_type (alloc, 24, 1, "uint24_t"); builtin_type->builtin_int32 - =3D arch_integer_type (gdbarch, 32, 0, "int32_t"); + =3D init_integer_type (alloc, 32, 0, "int32_t"); builtin_type->builtin_uint32 - =3D arch_integer_type (gdbarch, 32, 1, "uint32_t"); + =3D init_integer_type (alloc, 32, 1, "uint32_t"); builtin_type->builtin_int64 - =3D arch_integer_type (gdbarch, 64, 0, "int64_t"); + =3D init_integer_type (alloc, 64, 0, "int64_t"); builtin_type->builtin_uint64 - =3D arch_integer_type (gdbarch, 64, 1, "uint64_t"); + =3D init_integer_type (alloc, 64, 1, "uint64_t"); builtin_type->builtin_int128 - =3D arch_integer_type (gdbarch, 128, 0, "int128_t"); + =3D init_integer_type (alloc, 128, 0, "int128_t"); builtin_type->builtin_uint128 - =3D arch_integer_type (gdbarch, 128, 1, "uint128_t"); + =3D init_integer_type (alloc, 128, 1, "uint128_t"); =20 builtin_type->builtin_int8->set_instance_flags (builtin_type->builtin_int8->instance_flags () @@ -6196,11 +6177,11 @@ create_gdbtypes_data (struct gdbarch *gdbarch) =20 /* Wide character types. */ builtin_type->builtin_char16 - =3D arch_integer_type (gdbarch, 16, 1, "char16_t"); + =3D init_integer_type (alloc, 16, 1, "char16_t"); builtin_type->builtin_char32 - =3D arch_integer_type (gdbarch, 32, 1, "char32_t"); + =3D init_integer_type (alloc, 32, 1, "char32_t"); builtin_type->builtin_wchar - =3D arch_integer_type (gdbarch, gdbarch_wchar_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_wchar_bit (gdbarch), !gdbarch_wchar_signed (gdbarch), "wchar_t"); =20 /* Default data/code pointer types. */ @@ -6263,38 +6244,38 @@ objfile_type (struct objfile *objfile) objfile_type->builtin_void =3D alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); objfile_type->builtin_char - =3D init_integer_type (objfile, TARGET_CHAR_BIT, + =3D init_integer_type (alloc, TARGET_CHAR_BIT, !gdbarch_char_signed (gdbarch), "char"); objfile_type->builtin_char->set_has_no_signedness (true); objfile_type->builtin_signed_char - =3D init_integer_type (objfile, TARGET_CHAR_BIT, + =3D init_integer_type (alloc, TARGET_CHAR_BIT, 0, "signed char"); objfile_type->builtin_unsigned_char - =3D init_integer_type (objfile, TARGET_CHAR_BIT, + =3D init_integer_type (alloc, TARGET_CHAR_BIT, 1, "unsigned char"); objfile_type->builtin_short - =3D init_integer_type (objfile, gdbarch_short_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_short_bit (gdbarch), 0, "short"); objfile_type->builtin_unsigned_short - =3D init_integer_type (objfile, gdbarch_short_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_short_bit (gdbarch), 1, "unsigned short"); objfile_type->builtin_int - =3D init_integer_type (objfile, gdbarch_int_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "int"); objfile_type->builtin_unsigned_int - =3D init_integer_type (objfile, gdbarch_int_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 1, "unsigned int"); objfile_type->builtin_long - =3D init_integer_type (objfile, gdbarch_long_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_long_bit (gdbarch), 0, "long"); objfile_type->builtin_unsigned_long - =3D init_integer_type (objfile, gdbarch_long_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_long_bit (gdbarch), 1, "unsigned long"); objfile_type->builtin_long_long - =3D init_integer_type (objfile, gdbarch_long_long_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_long_long_bit (gdbarch), 0, "long long"); objfile_type->builtin_unsigned_long_long - =3D init_integer_type (objfile, gdbarch_long_long_bit (gdbarch), + =3D init_integer_type (alloc, gdbarch_long_long_bit (gdbarch), 1, "unsigned long long"); objfile_type->builtin_float =3D init_float_type (objfile, gdbarch_float_bit (gdbarch), @@ -6354,7 +6335,7 @@ objfile_type (struct objfile *objfile) are indeed in the unified virtual address space. */ =20 objfile_type->builtin_core_addr - =3D init_integer_type (objfile, gdbarch_addr_bit (gdbarch), 1, + =3D init_integer_type (alloc, gdbarch_addr_bit (gdbarch), 1, "__CORE_ADDR"); =20 objfile_type_data.set (objfile, objfile_type); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 4a1d2027568..c1afbc04a08 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -2294,10 +2294,12 @@ private: bool m_smash =3D false; }; =20 -/* * Helper function to construct objfile-owned types. */ +/* Allocate a TYPE_CODE_INT type structure using ALLOC. 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. */ =20 -extern struct type *init_integer_type (struct objfile *, int, int, - const char *); +extern struct type *init_integer_type (type_allocator &alloc, int bit, + int unsigned_p, const char *name); extern struct type *init_character_type (struct objfile *, int, int, const char *); extern struct type *init_boolean_type (struct objfile *, int, int, @@ -2314,8 +2316,6 @@ extern struct type *init_fixed_point_type (struct obj= file *, int, int, const char *); =20 /* Helper functions to construct architecture-owned types. */ -extern struct type *arch_integer_type (struct gdbarch *, int, int, - const char *); extern struct type *arch_character_type (struct gdbarch *, int, int, const char *); extern struct type *arch_boolean_type (struct gdbarch *, int, int, diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index a3e2d73f10a..12bc5b09a93 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -129,7 +129,7 @@ get_gdb_vtable_type (struct gdbarch *arch) =20 /* ARCH can't give us the true ptrdiff_t type, so we guess. */ struct type *ptrdiff_type - =3D arch_integer_type (arch, gdbarch_ptr_bit (arch), 0, "ptrdiff_t"); + =3D init_integer_type (alloc, gdbarch_ptr_bit (arch), 0, "ptrdiff_t"); =20 /* We assume no padding is necessary, since GDB doesn't know anything about alignment at the moment. If this assumption bites diff --git a/gdb/go-lang.c b/gdb/go-lang.c index 456b74d80df..8cdd6b124c4 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -483,33 +483,34 @@ build_go_types (struct gdbarch *gdbarch) { struct builtin_go_type *builtin_go_type =3D new struct builtin_go_type; =20 + type_allocator alloc (gdbarch); builtin_go_type->builtin_void =3D builtin_type (gdbarch)->builtin_void; builtin_go_type->builtin_char =3D arch_character_type (gdbarch, 8, 1, "char"); builtin_go_type->builtin_bool =3D arch_boolean_type (gdbarch, 8, 0, "bool"); builtin_go_type->builtin_int - =3D arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "int"); + =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "int"); builtin_go_type->builtin_uint - =3D arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "uint"); + =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 1, "uint"); builtin_go_type->builtin_uintptr - =3D arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "uintptr= "); + =3D init_integer_type (alloc, gdbarch_ptr_bit (gdbarch), 1, "uintptr"); builtin_go_type->builtin_int8 - =3D arch_integer_type (gdbarch, 8, 0, "int8"); + =3D init_integer_type (alloc, 8, 0, "int8"); builtin_go_type->builtin_int16 - =3D arch_integer_type (gdbarch, 16, 0, "int16"); + =3D init_integer_type (alloc, 16, 0, "int16"); builtin_go_type->builtin_int32 - =3D arch_integer_type (gdbarch, 32, 0, "int32"); + =3D init_integer_type (alloc, 32, 0, "int32"); builtin_go_type->builtin_int64 - =3D arch_integer_type (gdbarch, 64, 0, "int64"); + =3D init_integer_type (alloc, 64, 0, "int64"); builtin_go_type->builtin_uint8 - =3D arch_integer_type (gdbarch, 8, 1, "uint8"); + =3D init_integer_type (alloc, 8, 1, "uint8"); builtin_go_type->builtin_uint16 - =3D arch_integer_type (gdbarch, 16, 1, "uint16"); + =3D init_integer_type (alloc, 16, 1, "uint16"); builtin_go_type->builtin_uint32 - =3D arch_integer_type (gdbarch, 32, 1, "uint32"); + =3D init_integer_type (alloc, 32, 1, "uint32"); builtin_go_type->builtin_uint64 - =3D arch_integer_type (gdbarch, 64, 1, "uint64"); + =3D init_integer_type (alloc, 64, 1, "uint64"); builtin_go_type->builtin_float32 =3D arch_float_type (gdbarch, 32, "float32", floatformats_ieee_single); builtin_go_type->builtin_float64 diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 67adf123090..d0bda5ad9c4 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -277,13 +277,13 @@ linux_get_siginfo_type_with_fields (struct gdbarch *g= dbarch, =20 type_allocator alloc (gdbarch); =20 - int_type =3D arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), + int_type =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "int"); - uint_type =3D arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), + uint_type =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 1, "unsigned int"); - long_type =3D arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), + long_type =3D init_integer_type (alloc, gdbarch_long_bit (gdbarch), 0, "long"); - short_type =3D arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), + short_type =3D init_integer_type (alloc, gdbarch_long_bit (gdbarch), 0, "short"); void_ptr_type =3D lookup_pointer_type (builtin_type (gdbarch)->builtin_v= oid); =20 @@ -1742,8 +1742,9 @@ linux_make_mappings_corefile_notes (struct gdbarch *g= dbarch, bfd *obfd, int *note_size) { struct linux_make_mappings_data mapping_data; + type_allocator alloc (gdbarch); struct type *long_type - =3D arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), 0, "long"); + =3D init_integer_type (alloc, gdbarch_long_bit (gdbarch), 0, "long"); gdb_byte buf[sizeof (ULONGEST)]; =20 auto_obstack data_obstack, filename_obstack; diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 72d0b58d675..218867d408e 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -281,11 +281,13 @@ build_m2_types (struct gdbarch *gdbarch) { struct builtin_m2_type *builtin_m2_type =3D new struct builtin_m2_type; =20 + type_allocator alloc (gdbarch); + /* Modula-2 "pervasive" types. NOTE: these can be redefined!!! */ builtin_m2_type->builtin_int - =3D arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "INTEGER= "); + =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "INTEGER"); builtin_m2_type->builtin_card - =3D arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "CARDINA= L"); + =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 1, "CARDINAL"= ); builtin_m2_type->builtin_real =3D arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "REAL", gdbarch_float_format (gdbarch)); diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index e500ba88a42..65d5df330b1 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -201,12 +201,12 @@ make_types (struct gdbarch *arch) tdep->code_addr_reg_type =3D arch_pointer_type (arch, code_addr_reg_bits, type_name, tdep->func= _voyd); =20 - tdep->uint8 =3D arch_integer_type (arch, 8, 1, "uint8_t"); - tdep->uint16 =3D arch_integer_type (arch, 16, 1, "uint16_t"); - tdep->int8 =3D arch_integer_type (arch, 8, 0, "int8_t"); - tdep->int16 =3D arch_integer_type (arch, 16, 0, "int16_t"); - tdep->int32 =3D arch_integer_type (arch, 32, 0, "int32_t"); - tdep->int64 =3D arch_integer_type (arch, 64, 0, "int64_t"); + tdep->uint8 =3D init_integer_type (alloc, 8, 1, "uint8_t"); + tdep->uint16 =3D init_integer_type (alloc, 16, 1, "uint16_t"); + tdep->int8 =3D init_integer_type (alloc, 8, 0, "int8_t"); + tdep->int16 =3D init_integer_type (alloc, 16, 0, "int16_t"); + tdep->int32 =3D init_integer_type (alloc, 32, 0, "int32_t"); + tdep->int64 =3D init_integer_type (alloc, 64, 0, "int64_t"); } =20 =20 diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 209040bd7cf..14f7d30e3d7 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1400,36 +1400,36 @@ basic_type (int bt, struct objfile *objfile) break; =20 case btChar: - tp =3D init_integer_type (objfile, 8, 0, "char"); + tp =3D init_integer_type (alloc, 8, 0, "char"); tp->set_has_no_signedness (true); break; =20 case btUChar: - tp =3D init_integer_type (objfile, 8, 1, "unsigned char"); + tp =3D init_integer_type (alloc, 8, 1, "unsigned char"); break; =20 case btShort: - tp =3D init_integer_type (objfile, 16, 0, "short"); + tp =3D init_integer_type (alloc, 16, 0, "short"); break; =20 case btUShort: - tp =3D init_integer_type (objfile, 16, 1, "unsigned short"); + tp =3D init_integer_type (alloc, 16, 1, "unsigned short"); break; =20 case btInt: - tp =3D init_integer_type (objfile, 32, 0, "int"); + tp =3D init_integer_type (alloc, 32, 0, "int"); break; =20 case btUInt: - tp =3D init_integer_type (objfile, 32, 1, "unsigned int"); + tp =3D init_integer_type (alloc, 32, 1, "unsigned int"); break; =20 case btLong: - tp =3D init_integer_type (objfile, 32, 0, "long"); + tp =3D init_integer_type (alloc, 32, 0, "long"); break; =20 case btULong: - tp =3D init_integer_type (objfile, 32, 1, "unsigned long"); + tp =3D init_integer_type (alloc, 32, 1, "unsigned long"); break; =20 case btFloat: @@ -1454,7 +1454,7 @@ basic_type (int bt, struct objfile *objfile) /* We use TYPE_CODE_INT to print these as integers. Does this do any good? Would we be better off with TYPE_CODE_ERROR? Should TYPE_CODE_ERROR print things in hex if it knows the size? */ - tp =3D init_integer_type (objfile, gdbarch_int_bit (gdbarch), 0, + tp =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 0, "fixed decimal"); break; =20 @@ -1474,19 +1474,19 @@ basic_type (int bt, struct objfile *objfile) break; =20 case btLong64: - tp =3D init_integer_type (objfile, 64, 0, "long"); + tp =3D init_integer_type (alloc, 64, 0, "long"); break; =20 case btULong64: - tp =3D init_integer_type (objfile, 64, 1, "unsigned long"); + tp =3D init_integer_type (alloc, 64, 1, "unsigned long"); break; =20 case btLongLong64: - tp =3D init_integer_type (objfile, 64, 0, "long long"); + tp =3D init_integer_type (alloc, 64, 0, "long long"); break; =20 case btULongLong64: - tp =3D init_integer_type (objfile, 64, 1, "unsigned long long"); + tp =3D init_integer_type (alloc, 64, 1, "unsigned long long"); break; =20 case btAdr64: @@ -1495,11 +1495,11 @@ basic_type (int bt, struct objfile *objfile) break; =20 case btInt64: - tp =3D init_integer_type (objfile, 64, 0, "int"); + tp =3D init_integer_type (alloc, 64, 0, "int"); break; =20 case btUInt64: - tp =3D init_integer_type (objfile, 64, 1, "unsigned int"); + tp =3D init_integer_type (alloc, 64, 1, "unsigned int"); break; =20 default: diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 9b5304f588f..94f865e5ad5 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -909,21 +909,22 @@ public: =20 struct type *el_type, *char_type, *int_type; =20 - char_type =3D el_type =3D add (arch_integer_type (gdbarch, 8, 0, "char= ")); + type_allocator alloc (gdbarch); + char_type =3D el_type =3D add (init_integer_type (alloc, 8, 0, "char")= ); BUILD_OCL_VTYPES (char, el_type); - el_type =3D add (arch_integer_type (gdbarch, 8, 1, "uchar")); + el_type =3D add (init_integer_type (alloc, 8, 1, "uchar")); BUILD_OCL_VTYPES (uchar, el_type); - el_type =3D add (arch_integer_type (gdbarch, 16, 0, "short")); + el_type =3D add (init_integer_type (alloc, 16, 0, "short")); BUILD_OCL_VTYPES (short, el_type); - el_type =3D add (arch_integer_type (gdbarch, 16, 1, "ushort")); + el_type =3D add (init_integer_type (alloc, 16, 1, "ushort")); BUILD_OCL_VTYPES (ushort, el_type); - int_type =3D el_type =3D add (arch_integer_type (gdbarch, 32, 0, "int"= )); + int_type =3D el_type =3D add (init_integer_type (alloc, 32, 0, "int")); BUILD_OCL_VTYPES (int, el_type); - el_type =3D add (arch_integer_type (gdbarch, 32, 1, "uint")); + el_type =3D add (init_integer_type (alloc, 32, 1, "uint")); BUILD_OCL_VTYPES (uint, el_type); - el_type =3D add (arch_integer_type (gdbarch, 64, 0, "long")); + el_type =3D add (init_integer_type (alloc, 64, 0, "long")); BUILD_OCL_VTYPES (long, el_type); - el_type =3D add (arch_integer_type (gdbarch, 64, 1, "ulong")); + el_type =3D add (init_integer_type (alloc, 64, 1, "ulong")); BUILD_OCL_VTYPES (ulong, el_type); el_type =3D add (arch_float_type (gdbarch, 16, "half", floatformats_ie= ee_half)); BUILD_OCL_VTYPES (half, el_type); @@ -933,14 +934,14 @@ public: BUILD_OCL_VTYPES (double, el_type); =20 add (arch_boolean_type (gdbarch, 8, 1, "bool")); - add (arch_integer_type (gdbarch, 8, 1, "unsigned char")); - add (arch_integer_type (gdbarch, 16, 1, "unsigned short")); - add (arch_integer_type (gdbarch, 32, 1, "unsigned int")); - add (arch_integer_type (gdbarch, 64, 1, "unsigned long")); - add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "size_t= ")); - add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0, "ptrdif= f_t")); - add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0, "intptr= _t")); - add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "uintpt= r_t")); + add (init_integer_type (alloc, 8, 1, "unsigned char")); + add (init_integer_type (alloc, 16, 1, "unsigned short")); + add (init_integer_type (alloc, 32, 1, "unsigned int")); + add (init_integer_type (alloc, 64, 1, "unsigned long")); + add (init_integer_type (alloc, gdbarch_ptr_bit (gdbarch), 1, "size_t")= ); + add (init_integer_type (alloc, gdbarch_ptr_bit (gdbarch), 0, "ptrdiff_= t")); + add (init_integer_type (alloc, gdbarch_ptr_bit (gdbarch), 0, "intptr_t= ")); + add (init_integer_type (alloc, gdbarch_ptr_bit (gdbarch), 1, "uintptr_= t")); add (builtin_type (gdbarch)->builtin_void); =20 /* Type of elements of strings. */ diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c index 1177215490f..ccb031bbfde 100644 --- a/gdb/rl78-tdep.c +++ b/gdb/rl78-tdep.c @@ -1411,12 +1411,12 @@ rl78_gdbarch_init (struct gdbarch_info info, struct= gdbarch_list *arches) /* Initialize types. */ type_allocator alloc (gdbarch); tdep->rl78_void =3D alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "vo= id"); - tdep->rl78_uint8 =3D arch_integer_type (gdbarch, 8, 1, "uint8_t"); - tdep->rl78_int8 =3D arch_integer_type (gdbarch, 8, 0, "int8_t"); - tdep->rl78_uint16 =3D arch_integer_type (gdbarch, 16, 1, "uint16_t"); - tdep->rl78_int16 =3D arch_integer_type (gdbarch, 16, 0, "int16_t"); - tdep->rl78_uint32 =3D arch_integer_type (gdbarch, 32, 1, "uint32_t"); - tdep->rl78_int32 =3D arch_integer_type (gdbarch, 32, 0, "int32_t"); + tdep->rl78_uint8 =3D init_integer_type (alloc, 8, 1, "uint8_t"); + tdep->rl78_int8 =3D init_integer_type (alloc, 8, 0, "int8_t"); + tdep->rl78_uint16 =3D init_integer_type (alloc, 16, 1, "uint16_t"); + tdep->rl78_int16 =3D init_integer_type (alloc, 16, 0, "int16_t"); + tdep->rl78_uint32 =3D init_integer_type (alloc, 32, 1, "uint32_t"); + tdep->rl78_int32 =3D init_integer_type (alloc, 32, 0, "int32_t"); =20 tdep->rl78_data_pointer =3D arch_pointer_type (gdbarch, 16, "rl78_data_addr_t", tdep->rl78_voi= d); diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 82004da53d4..608799cc662 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -1594,27 +1594,28 @@ rust_language::language_arch_info (struct gdbarch *= gdbarch, return t; }; =20 + type_allocator alloc (gdbarch); struct type *bool_type =3D add (arch_boolean_type (gdbarch, 8, 1, "bool")); add (arch_character_type (gdbarch, 32, 1, "char")); - add (arch_integer_type (gdbarch, 8, 0, "i8")); + add (init_integer_type (alloc, 8, 0, "i8")); struct type *u8_type - =3D add (arch_integer_type (gdbarch, 8, 1, "u8")); - add (arch_integer_type (gdbarch, 16, 0, "i16")); - add (arch_integer_type (gdbarch, 16, 1, "u16")); - add (arch_integer_type (gdbarch, 32, 0, "i32")); - add (arch_integer_type (gdbarch, 32, 1, "u32")); - add (arch_integer_type (gdbarch, 64, 0, "i64")); - add (arch_integer_type (gdbarch, 64, 1, "u64")); + =3D add (init_integer_type (alloc, 8, 1, "u8")); + add (init_integer_type (alloc, 16, 0, "i16")); + add (init_integer_type (alloc, 16, 1, "u16")); + add (init_integer_type (alloc, 32, 0, "i32")); + add (init_integer_type (alloc, 32, 1, "u32")); + add (init_integer_type (alloc, 64, 0, "i64")); + add (init_integer_type (alloc, 64, 1, "u64")); =20 unsigned int length =3D 8 * builtin->builtin_data_ptr->length (); - add (arch_integer_type (gdbarch, length, 0, "isize")); + add (init_integer_type (alloc, length, 0, "isize")); struct type *usize_type - =3D add (arch_integer_type (gdbarch, length, 1, "usize")); + =3D add (init_integer_type (alloc, length, 1, "usize")); =20 add (arch_float_type (gdbarch, 32, "f32", floatformats_ieee_single)); add (arch_float_type (gdbarch, 64, "f64", floatformats_ieee_double)); - add (arch_integer_type (gdbarch, 0, 1, "()")); + add (init_integer_type (alloc, 0, 1, "()")); =20 struct type *tem =3D make_cv_type (1, 0, u8_type, NULL); add (rust_slice_type ("&str", tem, usize_type)); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 7a31d559831..6270f48bebb 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -2090,35 +2090,35 @@ rs6000_builtin_type (int typenum, struct objfile *o= bjfile) is other than 32 bits, then it should use a new negative type number (or avoid negative type numbers for that case). See stabs.texinfo. */ - rettype =3D init_integer_type (objfile, 32, 0, "int"); + rettype =3D init_integer_type (alloc, 32, 0, "int"); break; case 2: - rettype =3D init_integer_type (objfile, 8, 0, "char"); + rettype =3D init_integer_type (alloc, 8, 0, "char"); rettype->set_has_no_signedness (true); break; case 3: - rettype =3D init_integer_type (objfile, 16, 0, "short"); + rettype =3D init_integer_type (alloc, 16, 0, "short"); break; case 4: - rettype =3D init_integer_type (objfile, 32, 0, "long"); + rettype =3D init_integer_type (alloc, 32, 0, "long"); break; case 5: - rettype =3D init_integer_type (objfile, 8, 1, "unsigned char"); + rettype =3D init_integer_type (alloc, 8, 1, "unsigned char"); break; case 6: - rettype =3D init_integer_type (objfile, 8, 0, "signed char"); + rettype =3D init_integer_type (alloc, 8, 0, "signed char"); break; case 7: - rettype =3D init_integer_type (objfile, 16, 1, "unsigned short"); + rettype =3D init_integer_type (alloc, 16, 1, "unsigned short"); break; case 8: - rettype =3D init_integer_type (objfile, 32, 1, "unsigned int"); + rettype =3D init_integer_type (alloc, 32, 1, "unsigned int"); break; case 9: - rettype =3D init_integer_type (objfile, 32, 1, "unsigned"); + rettype =3D init_integer_type (alloc, 32, 1, "unsigned"); break; case 10: - rettype =3D init_integer_type (objfile, 32, 1, "unsigned long"); + rettype =3D init_integer_type (alloc, 32, 1, "unsigned long"); break; case 11: rettype =3D alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); @@ -2141,7 +2141,7 @@ rs6000_builtin_type (int typenum, struct objfile *obj= file) floatformats_ieee_double); break; case 15: - rettype =3D init_integer_type (objfile, 32, 0, "integer"); + rettype =3D init_integer_type (alloc, 32, 0, "integer"); break; case 16: rettype =3D init_boolean_type (objfile, 32, 1, "boolean"); @@ -2183,28 +2183,28 @@ rs6000_builtin_type (int typenum, struct objfile *o= bjfile) rs6000_builtin_type (13, objfile)); break; case 27: - rettype =3D init_integer_type (objfile, 8, 0, "integer*1"); + rettype =3D init_integer_type (alloc, 8, 0, "integer*1"); break; case 28: - rettype =3D init_integer_type (objfile, 16, 0, "integer*2"); + rettype =3D init_integer_type (alloc, 16, 0, "integer*2"); break; case 29: - rettype =3D init_integer_type (objfile, 32, 0, "integer*4"); + rettype =3D init_integer_type (alloc, 32, 0, "integer*4"); break; case 30: rettype =3D init_character_type (objfile, 16, 0, "wchar"); break; case 31: - rettype =3D init_integer_type (objfile, 64, 0, "long long"); + rettype =3D init_integer_type (alloc, 64, 0, "long long"); break; case 32: - rettype =3D init_integer_type (objfile, 64, 1, "unsigned long long"); + rettype =3D init_integer_type (alloc, 64, 1, "unsigned long long"); break; case 33: - rettype =3D init_integer_type (objfile, 64, 1, "logical*8"); + rettype =3D init_integer_type (alloc, 64, 1, "logical*8"); break; case 34: - rettype =3D init_integer_type (objfile, 64, 0, "integer*8"); + rettype =3D init_integer_type (alloc, 64, 0, "integer*8"); break; } negative_types[-typenum] =3D rettype; @@ -3761,7 +3761,7 @@ read_sun_builtin_type (const char **pp, int typenums[= 2], struct objfile *objfile if (boolean_type) return init_boolean_type (objfile, type_bits, unsigned_type, NULL); else - return init_integer_type (objfile, type_bits, unsigned_type, NULL); + return init_integer_type (alloc, type_bits, unsigned_type, NULL); } =20 static struct type * @@ -4059,7 +4059,7 @@ read_range_type (const char **pp, int typenums[2], in= t type_size, } =20 if (got_signed || got_unsigned) - return init_integer_type (objfile, nbits, got_unsigned, NULL); + return init_integer_type (alloc, nbits, got_unsigned, NULL); else return error_type (pp, objfile); } @@ -4105,14 +4105,14 @@ read_range_type (const char **pp, int typenums[2], = int type_size, bits =3D gdbarch_int_bit (gdbarch); } =20 - return init_integer_type (objfile, bits, 1, NULL); + return init_integer_type (alloc, bits, 1, NULL); } =20 /* Special case: char is defined (Who knows why) as a subrange of itself with range 0-127. */ else if (self_subrange && n2 =3D=3D 0 && n3 =3D=3D 127) { - struct type *type =3D init_integer_type (objfile, TARGET_CHAR_BIT, + struct type *type =3D init_integer_type (alloc, TARGET_CHAR_BIT, 0, NULL); type->set_has_no_signedness (true); return type; @@ -4126,7 +4126,7 @@ read_range_type (const char **pp, int typenums[2], in= t type_size, =20 if (n3 < 0) /* n3 actually gives the size. */ - return init_integer_type (objfile, -n3 * TARGET_CHAR_BIT, 1, NULL); + return init_integer_type (alloc, -n3 * TARGET_CHAR_BIT, 1, NULL); =20 /* Is n3 =3D=3D 2**(8n)-1 for some integer n? Then it's an unsigned n-byte integer. But do require n to be a power of @@ -4140,7 +4140,7 @@ read_range_type (const char **pp, int typenums[2], in= t type_size, bits >>=3D 8; if (bits =3D=3D 0 && ((bytes - 1) & bytes) =3D=3D 0) /* "bytes is a power of two" */ - return init_integer_type (objfile, bytes * TARGET_CHAR_BIT, 1, NULL); + return init_integer_type (alloc, bytes * TARGET_CHAR_BIT, 1, NULL); } } /* I think this is for Convex "long long". Since I don't know whether @@ -4150,15 +4150,15 @@ read_range_type (const char **pp, int typenums[2], = int type_size, && (self_subrange || n2 =3D=3D -gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT)) - return init_integer_type (objfile, -n2 * TARGET_CHAR_BIT, 0, NULL); + return init_integer_type (alloc, -n2 * TARGET_CHAR_BIT, 0, NULL); else if (n2 =3D=3D -n3 - 1) { if (n3 =3D=3D 0x7f) - return init_integer_type (objfile, 8, 0, NULL); + return init_integer_type (alloc, 8, 0, NULL); if (n3 =3D=3D 0x7fff) - return init_integer_type (objfile, 16, 0, NULL); + return init_integer_type (alloc, 16, 0, NULL); if (n3 =3D=3D 0x7fffffff) - return init_integer_type (objfile, 32, 0, NULL); + return init_integer_type (alloc, 32, 0, NULL); } =20 /* We have a real range type on our hands. Allocate space and diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 5a58aa37953..4a08dd48c65 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -216,13 +216,13 @@ windows_get_tlb_type (struct gdbarch *gdbarch) =20 type_allocator alloc (gdbarch); =20 - dword_ptr_type =3D arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), + dword_ptr_type =3D init_integer_type (alloc, gdbarch_ptr_bit (gdbarch), 1, "DWORD_PTR"); - dword32_type =3D arch_integer_type (gdbarch, 32, + dword32_type =3D init_integer_type (alloc, 32, 1, "DWORD32"); - word_type =3D arch_integer_type (gdbarch, 16, + word_type =3D init_integer_type (alloc, 16, 1, "WORD"); - wchar_type =3D arch_integer_type (gdbarch, 16, + wchar_type =3D init_integer_type (alloc, 16, 1, "wchar_t"); void_ptr_type =3D lookup_pointer_type (builtin_type (gdbarch)->builtin_v= oid); wchar_ptr_type =3D arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch), @@ -810,11 +810,12 @@ windows_get_siginfo_type (struct gdbarch *gdbarch) if (windows_gdbarch_data->siginfo_type !=3D NULL) return windows_gdbarch_data->siginfo_type; =20 - dword_type =3D arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), + type_allocator alloc (gdbarch); + dword_type =3D init_integer_type (alloc, gdbarch_int_bit (gdbarch), 1, "DWORD"); pvoid_type =3D arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch), "P= VOID", builtin_type (gdbarch)->builtin_void); - ulongptr_type =3D arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), + ulongptr_type =3D init_integer_type (alloc, gdbarch_ptr_bit (gdbarch), 1, "ULONG_PTR"); =20 /* ExceptionCode value names */ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 092ae088932..a47a2987499 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -312,8 +312,9 @@ xtensa_register_type (struct gdbarch *gdbarch, int regn= um) tp->next =3D tdep->type_entries; tdep->type_entries =3D tp; tp->size =3D size; + type_allocator alloc (gdbarch); tp->virtual_type - =3D arch_integer_type (gdbarch, size * 8, 1, name.c_str ()); + =3D init_integer_type (alloc, size * 8, 1, name.c_str ()); } =20 reg->ctype =3D tp->virtual_type;