From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 78DA038582A1; Wed, 21 Sep 2022 15:05:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 78DA038582A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663772751; bh=3r2sxcwMaBhm2b50eP0TYLtDbnXLtKui37U0z2/ppwc=; h=From:To:Subject:Date:From; b=vz4qmLofDF5NKxh0TbuxkoUxG+cZsoJp1EzVUCLSNqHqD7LKhadHe+CxHM8knBlX3 RI1KaGGam0kjaVPDrMPPlBwGSlZ6/bFnXEccH9n95JLJROSsEt9HVz49tN0H5GGvnu hUfF00UnkZcSnpJmVd5Qbc3kzRSZjdUvs3cZHngY= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: remove TYPE_LENGTH X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: b6cdbc9a8173b9e6cc8cfc284caa0efa8129ca02 X-Git-Newrev: df86565b31bf12aab6fdceade49169bc6f378b13 Message-Id: <20220921150551.78DA038582A1@sourceware.org> Date: Wed, 21 Sep 2022 15:05:51 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Ddf86565b31bf= 12aab6fdceade49169bc6f378b13 commit df86565b31bf12aab6fdceade49169bc6f378b13 Author: Simon Marchi Date: Wed Sep 21 11:05:21 2022 -0400 gdb: remove TYPE_LENGTH =20 Remove the macro, replace all uses with calls to type::length. =20 Change-Id: Ib9bdc954576860b21190886534c99103d6a47afb Diff: --- gdb/aarch64-tdep.c | 60 ++++++------ gdb/ada-lang.c | 116 +++++++++++----------- gdb/ada-lex.l | 2 +- gdb/ada-tasks.c | 4 +- gdb/ada-typeprint.c | 4 +- gdb/ada-valprint.c | 24 ++--- gdb/alpha-tdep.c | 32 +++---- gdb/amd64-tdep.c | 26 ++--- gdb/amd64-windows-tdep.c | 26 ++--- gdb/arc-tdep.c | 12 +-- gdb/arm-tdep.c | 48 +++++----- gdb/auxv.c | 8 +- gdb/avr-tdep.c | 22 ++--- gdb/ax-gdb.c | 32 +++---- gdb/bfin-tdep.c | 10 +- gdb/bpf-tdep.c | 6 +- gdb/breakpoint.c | 4 +- gdb/c-exp.y | 2 +- gdb/c-lang.c | 18 ++-- gdb/c-typeprint.c | 2 +- gdb/c-valprint.c | 16 ++-- gdb/c-varobj.c | 4 +- gdb/cli/cli-dump.c | 4 +- gdb/coffread.c | 4 +- gdb/compile/compile-c-support.c | 4 +- gdb/compile/compile-c-types.c | 16 ++-- gdb/compile/compile-cplus-types.c | 12 +-- gdb/compile/compile-object-load.c | 14 +-- gdb/corefile.c | 4 +- gdb/cp-valprint.c | 12 +-- gdb/cris-tdep.c | 8 +- gdb/csky-tdep.c | 4 +- gdb/ctfread.c | 2 +- gdb/d-valprint.c | 2 +- gdb/dwarf2/cu.c | 2 +- gdb/dwarf2/expr.c | 40 ++++---- gdb/dwarf2/loc.c | 10 +- gdb/dwarf2/read.c | 44 ++++----- gdb/elfread.c | 4 +- gdb/eval.c | 54 +++++------ gdb/f-exp.y | 2 +- gdb/f-lang.c | 60 ++++++------ gdb/f-lang.h | 2 +- gdb/f-valprint.c | 12 +-- gdb/fbsd-tdep.c | 6 +- gdb/findcmd.c | 2 +- gdb/findvar.c | 20 ++-- gdb/frame.c | 4 +- gdb/frv-tdep.c | 8 +- gdb/ft32-tdep.c | 8 +- gdb/gdbarch-selftests.c | 14 +-- gdb/gdbtypes.c | 91 +++++++++--------- gdb/gdbtypes.h | 9 +- gdb/gnu-v2-abi.c | 4 +- gdb/gnu-v3-abi.c | 36 +++---- gdb/go-exp.y | 2 +- gdb/go-lang.c | 2 +- gdb/guile/scm-math.c | 6 +- gdb/guile/scm-pretty-print.c | 2 +- gdb/guile/scm-type.c | 2 +- gdb/guile/scm-value.c | 4 +- gdb/h8300-tdep.c | 39 ++++---- gdb/hppa-tdep.c | 34 +++---- gdb/i386-darwin-tdep.c | 8 +- gdb/i386-tdep.c | 48 +++++----- gdb/ia64-tdep.c | 42 ++++---- gdb/infcall.c | 20 ++-- gdb/infcmd.c | 2 +- gdb/infrun.c | 14 +-- gdb/iq2000-tdep.c | 18 ++-- gdb/jit.c | 4 +- gdb/linux-record.c | 2 +- gdb/linux-tdep.c | 24 ++--- gdb/lm32-tdep.c | 18 ++-- gdb/loongarch-tdep.c | 6 +- gdb/m2-exp.y | 2 +- gdb/m2-lang.h | 6 +- gdb/m2-typeprint.c | 10 +- gdb/m2-valprint.c | 14 +-- gdb/m32c-tdep.c | 38 ++++---- gdb/m32r-tdep.c | 10 +- gdb/m68hc11-tdep.c | 18 ++-- gdb/m68k-bsd-tdep.c | 2 +- gdb/m68k-tdep.c | 16 ++-- gdb/mdebugread.c | 6 +- gdb/mep-tdep.c | 30 +++--- gdb/mi/mi-cmd-stack.c | 2 +- gdb/microblaze-tdep.c | 8 +- gdb/mips-tdep.c | 114 +++++++++++----------- gdb/mn10300-tdep.c | 16 ++-- gdb/moxie-tdep.c | 6 +- gdb/msp430-tdep.c | 6 +- gdb/nds32-tdep.c | 10 +- gdb/netbsd-tdep.c | 10 +- gdb/nios2-tdep.c | 12 +-- gdb/objfiles.c | 2 +- gdb/opencl-lang.c | 40 ++++---- gdb/or1k-tdep.c | 8 +- gdb/p-exp.y | 2 +- gdb/p-lang.c | 6 +- gdb/p-typeprint.c | 2 +- gdb/p-valprint.c | 20 ++-- gdb/ppc-linux-nat.c | 4 +- gdb/ppc-linux-tdep.c | 2 +- gdb/ppc-netbsd-tdep.c | 10 +- gdb/ppc-sysv-tdep.c | 196 +++++++++++++++++++---------------= ---- gdb/printcmd.c | 38 ++++---- gdb/procfs.c | 4 +- gdb/python/py-inferior.c | 2 +- gdb/python/py-prettyprint.c | 2 +- gdb/python/py-type.c | 2 +- gdb/python/py-unwind.c | 6 +- gdb/python/py-value.c | 4 +- gdb/ravenscar-thread.c | 2 +- gdb/regcache.c | 6 +- gdb/riscv-tdep.c | 52 +++++----- gdb/rl78-tdep.c | 10 +- gdb/rs6000-aix-tdep.c | 16 ++-- gdb/rs6000-lynx178-tdep.c | 16 ++-- gdb/rs6000-tdep.c | 4 +- gdb/rust-lang.c | 20 ++-- gdb/rx-tdep.c | 14 +-- gdb/s12z-tdep.c | 4 +- gdb/s390-tdep.c | 28 +++--- gdb/sh-tdep.c | 24 ++--- gdb/solib-darwin.c | 12 +-- gdb/solib-svr4.c | 6 +- gdb/sparc-tdep.c | 32 +++---- gdb/sparc64-tdep.c | 28 +++--- gdb/stabsread.c | 10 +- gdb/stack.c | 6 +- gdb/stap-probe.c | 8 +- gdb/symmisc.c | 4 +- gdb/target-float.c | 24 ++--- gdb/tic6x-tdep.c | 12 +-- gdb/tilegx-tdep.c | 14 +-- gdb/tracepoint.c | 8 +- gdb/typeprint.c | 12 +-- gdb/v850-tdep.c | 26 ++--- gdb/valarith.c | 60 ++++++------ gdb/valops.c | 52 +++++----- gdb/valprint.c | 30 +++--- gdb/valprint.h | 2 +- gdb/value.c | 54 +++++------ gdb/value.h | 2 +- gdb/vax-tdep.c | 4 +- gdb/windows-tdep.c | 16 ++-- gdb/xstormy16-tdep.c | 16 ++-- gdb/xtensa-tdep.c | 28 +++--- gdb/z80-tdep.c | 2 +- 150 files changed, 1320 insertions(+), 1323 deletions(-) diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 744348cfcd4..d0387044934 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -1454,10 +1454,10 @@ aarch64_type_align (gdbarch *gdbarch, struct type *= t) { /* Use the natural alignment for vector types (the same for scalar type), but the maximum alignment is 128-bit. */ - if (TYPE_LENGTH (t) > 16) + if (t->length () > 16) return 16; else - return TYPE_LENGTH (t); + return t->length (); } =20 /* Allow the common code to calculate the alignment. */ @@ -1483,12 +1483,12 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct typ= e *type, { case TYPE_CODE_FLT: case TYPE_CODE_DECFLOAT: - if (TYPE_LENGTH (type) > 16) + if (type->length () > 16) return -1; =20 if (*fundamental_type =3D=3D nullptr) *fundamental_type =3D type; - else if (TYPE_LENGTH (type) !=3D TYPE_LENGTH (*fundamental_type) + else if (type->length () !=3D (*fundamental_type)->length () || type->code () !=3D (*fundamental_type)->code ()) return -1; =20 @@ -1497,12 +1497,12 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct typ= e *type, case TYPE_CODE_COMPLEX: { struct type *target_type =3D check_typedef (type->target_type ()); - if (TYPE_LENGTH (target_type) > 16) + if (target_type->length () > 16) return -1; =20 if (*fundamental_type =3D=3D nullptr) *fundamental_type =3D target_type; - else if (TYPE_LENGTH (target_type) !=3D TYPE_LENGTH (*fundamental_type) + else if (target_type->length () !=3D (*fundamental_type)->length () || target_type->code () !=3D (*fundamental_type)->code ()) return -1; =20 @@ -1513,12 +1513,12 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct typ= e *type, { if (type->is_vector ()) { - if (TYPE_LENGTH (type) !=3D 8 && TYPE_LENGTH (type) !=3D 16) + if (type->length () !=3D 8 && type->length () !=3D 16) return -1; =20 if (*fundamental_type =3D=3D nullptr) *fundamental_type =3D type; - else if (TYPE_LENGTH (type) !=3D TYPE_LENGTH (*fundamental_type) + else if (type->length () !=3D (*fundamental_type)->length () || type->code () !=3D (*fundamental_type)->code ()) return -1; =20 @@ -1533,7 +1533,7 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type = *type, if (count =3D=3D -1) return count; =20 - count *=3D (TYPE_LENGTH (type) / TYPE_LENGTH (target_type)); + count *=3D (type->length () / target_type->length ()); return count; } } @@ -1561,8 +1561,8 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type = *type, /* Ensure there is no padding between the fields (allowing for empty zero length structs) */ int ftype_length =3D (*fundamental_type =3D=3D nullptr) - ? 0 : TYPE_LENGTH (*fundamental_type); - if (count * ftype_length !=3D TYPE_LENGTH (type)) + ? 0 : (*fundamental_type)->length (); + if (count * ftype_length !=3D type->length ()) return -1; =20 return count; @@ -1645,7 +1645,7 @@ pass_in_x (struct gdbarch *gdbarch, struct regcache *= regcache, struct value *arg) { enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); enum type_code typecode =3D type->code (); int regnum =3D AARCH64_X0_REGNUM + info->ngrn; const bfd_byte *buf =3D value_contents (arg).data (); @@ -1719,7 +1719,7 @@ pass_on_stack (struct aarch64_call_info *info, struct= type *type, struct value *arg) { const bfd_byte *buf =3D value_contents (arg).data (); - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); int align; stack_item_t item; =20 @@ -1765,7 +1765,7 @@ pass_in_x_or_stack (struct gdbarch *gdbarch, struct r= egcache *regcache, struct aarch64_call_info *info, struct type *type, struct value *arg) { - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); int nregs =3D (len + X_REGISTER_SIZE - 1) / X_REGISTER_SIZE; =20 /* PCS C.13 - Pass in registers if we have enough spare */ @@ -1794,7 +1794,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, str= uct regcache *regcache, { case TYPE_CODE_FLT: case TYPE_CODE_DECFLOAT: - return pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (arg_type), + return pass_in_v (gdbarch, regcache, info, arg_type->length (), value_contents (arg).data ()); break; =20 @@ -1803,17 +1803,17 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, s= truct regcache *regcache, const bfd_byte *buf =3D value_contents (arg).data (); struct type *target_type =3D check_typedef (arg_type->target_type ()); =20 - if (!pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (target_type), + if (!pass_in_v (gdbarch, regcache, info, target_type->length (), buf)) return false; =20 - return pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (target_type), - buf + TYPE_LENGTH (target_type)); + return pass_in_v (gdbarch, regcache, info, target_type->length (), + buf + target_type->length ()); } =20 case TYPE_CODE_ARRAY: if (arg_type->is_vector ()) - return pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (arg_type), + return pass_in_v (gdbarch, regcache, info, arg_type->length (), value_contents (arg).data ()); /* fall through. */ =20 @@ -1902,7 +1902,7 @@ aarch64_push_dummy_call (struct gdbarch *gdbarch, str= uct value *function, int len, elements; =20 arg_type =3D check_typedef (value_type (arg)); - len =3D TYPE_LENGTH (arg_type); + len =3D arg_type->length (); =20 /* If arg can be passed in v registers as per the AAPCS64, then do s= o if if there are enough spare registers. */ @@ -2293,7 +2293,7 @@ aarch64_extract_return_value (struct type *type, stru= ct regcache *regs, if (aapcs_is_vfp_call_or_return_candidate (type, &elements, &fundamental_type)) { - int len =3D TYPE_LENGTH (fundamental_type); + int len =3D fundamental_type->length (); =20 for (int i =3D 0; i < elements; i++) { @@ -2322,7 +2322,7 @@ aarch64_extract_return_value (struct type *type, stru= ct regcache *regs, /* If the type is a plain integer, then the access is straight-forward. Otherwise we have to play around a bit more. */ - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); int regno =3D AARCH64_X0_REGNUM; ULONGEST tmp; =20 @@ -2343,7 +2343,7 @@ aarch64_extract_return_value (struct type *type, stru= ct regcache *regs, /* For a structure or union the behaviour is as if the value had been stored to word-aligned memory and then loaded into registers with 64-bit load instruction(s). */ - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); int regno =3D AARCH64_X0_REGNUM; bfd_byte buf[X_REGISTER_SIZE]; =20 @@ -2377,7 +2377,7 @@ aarch64_return_in_memory (struct gdbarch *gdbarch, st= ruct type *type) return 0; } =20 - if (TYPE_LENGTH (type) > 16 + if (type->length () > 16 || !language_pass_by_reference (type).trivially_copyable) { /* PCS B.6 Aggregates larger than 16 bytes are passed by @@ -2404,7 +2404,7 @@ aarch64_store_return_value (struct type *type, struct= regcache *regs, if (aapcs_is_vfp_call_or_return_candidate (type, &elements, &fundamental_type)) { - int len =3D TYPE_LENGTH (fundamental_type); + int len =3D fundamental_type->length (); =20 for (int i =3D 0; i < elements; i++) { @@ -2430,7 +2430,7 @@ aarch64_store_return_value (struct type *type, struct= regcache *regs, || TYPE_IS_REFERENCE (type) || type->code () =3D=3D TYPE_CODE_ENUM) { - if (TYPE_LENGTH (type) <=3D X_REGISTER_SIZE) + if (type->length () <=3D X_REGISTER_SIZE) { /* Values of one word or less are zero/sign-extended and returned in r0. */ @@ -2445,7 +2445,7 @@ aarch64_store_return_value (struct type *type, struct= regcache *regs, /* Integral values greater than one word are stored in consecutive registers starting with r0. This will always be a multiple of the regiser size. */ - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); int regno =3D AARCH64_X0_REGNUM; =20 while (len > 0) @@ -2461,7 +2461,7 @@ aarch64_store_return_value (struct type *type, struct= regcache *regs, /* For a structure or union the behaviour is as if the value had been stored to word-aligned memory and then loaded into registers with 64-bit load instruction(s). */ - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); int regno =3D AARCH64_X0_REGNUM; bfd_byte tmpbuf[X_REGISTER_SIZE]; =20 @@ -2504,7 +2504,7 @@ aarch64_return_value (struct gdbarch *gdbarch, struct= value *func_value, CORE_ADDR addr; =20 regcache->cooked_read (AARCH64_STRUCT_RETURN_REGNUM, &addr); - read_memory (addr, readbuf, TYPE_LENGTH (valtype)); + read_memory (addr, readbuf, valtype->length ()); } =20 return RETURN_VALUE_ABI_RETURNS_ADDRESS; @@ -2753,7 +2753,7 @@ aarch64_pseudo_read_value_1 (struct gdbarch *gdbarch, =20 if (regcache->raw_read (v_regnum, reg_buf) !=3D REG_VALID) mark_value_bytes_unavailable (result_value, 0, - TYPE_LENGTH (value_type (result_value))); + value_type (result_value)->length ()); else memcpy (value_contents_raw (result_value).data (), reg_buf, regsize); =20 diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 93425660053..d539c50602c 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -560,12 +560,12 @@ coerce_unspec_val_to_type (struct value *val, struct = type *type) else if (value_lazy (val) /* Be careful not to make a lazy not_lval value. */ || (VALUE_LVAL (val) !=3D not_lval - && TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))) + && type->length () > value_type (val)->length ())) result =3D allocate_value_lazy (type); else { result =3D allocate_value (type); - value_contents_copy (result, 0, val, 0, TYPE_LENGTH (type)); + value_contents_copy (result, 0, val, 0, type->length ()); } set_value_component_location (result, val); set_value_bitsize (result, value_bitsize (val)); @@ -646,9 +646,9 @@ static LONGEST max_of_type (struct type *t) { if (t->is_unsigned ()) - return (LONGEST) umax_of_size (TYPE_LENGTH (t)); + return (LONGEST) umax_of_size (t->length ()); else - return max_of_size (TYPE_LENGTH (t)); + return max_of_size (t->length ()); } =20 /* Minimum value of integral type T, as a signed quantity. */ @@ -658,7 +658,7 @@ min_of_type (struct type *t) if (t->is_unsigned ()) return 0; else - return min_of_size (TYPE_LENGTH (t)); + return min_of_size (t->length ()); } =20 /* The largest value in the domain of TYPE, a discrete type, as an integer= . */ @@ -1832,7 +1832,7 @@ desc_bounds (struct value *arr) =20 return value_from_longest (lookup_pointer_type (bounds_type), - addr - TYPE_LENGTH (bounds_type)); + addr - bounds_type->length ()); } =20 else if (is_thick_pntr (type)) @@ -1880,7 +1880,7 @@ fat_pntr_bounds_bitsize (struct type *type) if (TYPE_FIELD_BITSIZE (type, 1) > 0) return TYPE_FIELD_BITSIZE (type, 1); else - return 8 * TYPE_LENGTH (ada_check_typedef (type->field (1).type ())); + return 8 * ada_check_typedef (type->field (1).type ())->length (); } =20 /* If TYPE is the type of an array descriptor (fat or thin pointer) or a @@ -1946,7 +1946,7 @@ fat_pntr_data_bitsize (struct type *type) if (TYPE_FIELD_BITSIZE (type, 0) > 0) return TYPE_FIELD_BITSIZE (type, 0); else - return TARGET_CHAR_BIT * TYPE_LENGTH (type->field (0).type ()); + return TARGET_CHAR_BIT * type->field (0).type ()->length (); } =20 /* If BOUNDS is an array-bounds structure (or pointer to one), return @@ -1985,7 +1985,7 @@ desc_bound_bitsize (struct type *type, int i, int whi= ch) if (TYPE_FIELD_BITSIZE (type, 2 * i + which - 2) > 0) return TYPE_FIELD_BITSIZE (type, 2 * i + which - 2); else - return 8 * TYPE_LENGTH (type->field (2 * i + which - 2).type ()); + return 8 * type->field (2 * i + which - 2).type ()->length (); } =20 /* If TYPE is the type of an array-bounds structure, the type of its @@ -2517,7 +2517,7 @@ decode_constrained_packed_array (struct value *arr) const gdb_byte *valaddr =3D value_contents_for_printing (arr).data (); CORE_ADDR address =3D value_address (arr); gdb::array_view view - =3D gdb::make_array_view (valaddr, TYPE_LENGTH (type)); + =3D gdb::make_array_view (valaddr, type->length ()); type =3D resolve_dynamic_type (type, view, address); recursively_update_array_bitsize (type); =20 @@ -2538,7 +2538,7 @@ decode_constrained_packed_array (struct value *arr) bit_size +=3D 1; mod >>=3D 1; } - bit_pos =3D HOST_CHAR_BIT * TYPE_LENGTH (value_type (arr)) - bit_siz= e; + bit_pos =3D HOST_CHAR_BIT * value_type (arr)->length () - bit_size; arr =3D ada_value_primitive_packed_val (arr, NULL, bit_pos / HOST_CHAR_BIT, bit_pos % HOST_CHAR_BIT, @@ -2790,7 +2790,7 @@ ada_value_primitive_packed_val (struct value *obj, co= nst gdb_byte *valaddr, is_big_endian, has_negatives (type), is_scalar); type =3D resolve_dynamic_type (type, staging, 0); - if (TYPE_LENGTH (type) < (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_= BIT) + if (type->length () < (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT) { /* This happens when the length of the object is dynamic, and is actually smaller than the space reserved for it. @@ -2799,7 +2799,7 @@ ada_value_primitive_packed_val (struct value *obj, co= nst gdb_byte *valaddr, normally equal to the maximum size of its element. But, in reality, each element only actually spans a portion of that stride. */ - bit_size =3D TYPE_LENGTH (type) * HOST_CHAR_BIT; + bit_size =3D type->length () * HOST_CHAR_BIT; } } =20 @@ -2848,11 +2848,11 @@ ada_value_primitive_packed_val (struct value *obj, = const gdb_byte *valaddr, =20 if (bit_size =3D=3D 0) { - memset (unpacked, 0, TYPE_LENGTH (type)); + memset (unpacked, 0, type->length ()); return v; } =20 - if (staging.size () =3D=3D TYPE_LENGTH (type)) + if (staging.size () =3D=3D type->length ()) { /* Small short-cut: If we've unpacked the data into a buffer of the same size as TYPE's length, then we can reuse that, @@ -2861,7 +2861,7 @@ ada_value_primitive_packed_val (struct value *obj, co= nst gdb_byte *valaddr, } else ada_unpack_from_contents (src, bit_offset, bit_size, - unpacked, TYPE_LENGTH (type), + unpacked, type->length (), is_big_endian, has_negatives (type), is_scalar); =20 return v; @@ -2907,7 +2907,7 @@ ada_value_assign (struct value *toval, struct value *= fromval) read_memory (to_addr, buffer, len); from_size =3D value_bitsize (fromval); if (from_size =3D=3D 0) - from_size =3D TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT; + from_size =3D value_type (fromval)->length () * TARGET_CHAR_BIT; =20 const int is_big_endian =3D type_byte_order (type) =3D=3D BFD_ENDIAN= _BIG; ULONGEST from_offset =3D 0; @@ -2921,7 +2921,7 @@ ada_value_assign (struct value *toval, struct value *= fromval) val =3D value_copy (toval); memcpy (value_contents_raw (val).data (), value_contents (fromval).data (), - TYPE_LENGTH (type)); + type->length ()); deprecated_set_value_type (val, type); =20 return val; @@ -2955,7 +2955,7 @@ value_assign_to_component (struct value *container, s= truct value *component, val =3D value_cast (value_type (component), val); =20 if (value_bitsize (component) =3D=3D 0) - bits =3D TARGET_CHAR_BIT * TYPE_LENGTH (value_type (component)); + bits =3D TARGET_CHAR_BIT * value_type (component)->length (); else bits =3D value_bitsize (component); =20 @@ -2965,7 +2965,7 @@ value_assign_to_component (struct value *container, s= truct value *component, =20 if (is_scalar_type (check_typedef (value_type (component)))) src_offset - =3D TYPE_LENGTH (value_type (component)) * TARGET_CHAR_BIT - bits; + =3D value_type (component)->length () * TARGET_CHAR_BIT - bits; else src_offset =3D 0; copy_bitwise ((value_contents_writeable (container).data () @@ -3112,7 +3112,7 @@ ada_value_slice_from_ptr (struct value *array_ptr, st= ruct type *type, =20 ULONGEST stride =3D TYPE_FIELD_BITSIZE (slice_type, 0) / 8; if (stride =3D=3D 0) - stride =3D TYPE_LENGTH (type0->target_type ()); + stride =3D type0->target_type ()->length (); =20 base =3D value_as_address (array_ptr) + (*low_pos - *base_low_pos) * str= ide; return value_at_lazy (slice_type, base); @@ -3920,7 +3920,7 @@ ada_type_match (struct type *ftype, struct type *atyp= e) return 0; atype =3D atype->target_type (); /* This can only happen if the actual argument is 'null'. */ - if (atype->code () =3D=3D TYPE_CODE_INT && TYPE_LENGTH (atype) =3D= =3D 0) + if (atype->code () =3D=3D TYPE_CODE_INT && atype->length () =3D=3D 0) return 1; return ada_type_match (ftype->target_type (), atype); case TYPE_CODE_INT: @@ -4346,7 +4346,7 @@ ensure_lval (struct value *val) if (VALUE_LVAL (val) =3D=3D not_lval || VALUE_LVAL (val) =3D=3D lval_internalvar) { - int len =3D TYPE_LENGTH (ada_check_typedef (value_type (val))); + int len =3D ada_check_typedef (value_type (val))->length (); const CORE_ADDR addr =3D value_as_long (value_allocate_space_in_inferior (len)); =20 @@ -4556,7 +4556,7 @@ ada_convert_actual (struct value *actual, struct type= *formal_type0) static CORE_ADDR value_pointer (struct value *value, struct type *type) { - unsigned len =3D TYPE_LENGTH (type); + unsigned len =3D type->length (); gdb_byte *buf =3D (gdb_byte *) alloca (len); CORE_ADDR addr; =20 @@ -6399,7 +6399,7 @@ value_tag_from_contents_and_address (struct type *typ= e, =20 gdb::array_view contents; if (valaddr !=3D nullptr) - contents =3D gdb::make_array_view (valaddr, TYPE_LENGTH (type)); + contents =3D gdb::make_array_view (valaddr, type->length ()); struct type *resolved_type =3D resolve_dynamic_type (type, contents, add= ress); if (find_struct_field ("_tag", resolved_type, 0, &tag_type, &tag_byte_of= fset, NULL, NULL, NULL)) @@ -6493,7 +6493,7 @@ ada_tag_value_at_base_address (struct value *obj) /* Storage_Offset'Last is used to indicate that a dynamic offset to top is used. In this situation the offset is stored just after the tag, in the object itself. */ - ULONGEST last =3D (((ULONGEST) 1) << (8 * TYPE_LENGTH (offset_type) - 1)= ) - 1; + ULONGEST last =3D (((ULONGEST) 1) << (8 * offset_type->length () - 1)) -= 1; if (offset_to_top =3D=3D last) { struct value *tem =3D value_addr (tag); @@ -7960,8 +7960,7 @@ ada_template_to_fixed_record_type_1 (struct type *typ= e, an overflow should not happen in practice. So rather than adding overflow recovery code to this already complex code, we just assume that it's not going to happen. */ - fld_bit_len =3D - TYPE_LENGTH (rtype->field (f).type ()) * TARGET_CHAR_BIT; + fld_bit_len =3D rtype->field (f).type ()->length () * TARGET_CHAR_BIT; } else { @@ -7992,7 +7991,7 @@ ada_template_to_fixed_record_type_1 (struct type *typ= e, field_type =3D ada_typedef_target_type (field_type); =20 fld_bit_len =3D - TYPE_LENGTH (ada_check_typedef (field_type)) * TARGET_CHAR_BIT; + ada_check_typedef (field_type)->length () * TARGET_CHAR_BIT; } } if (off + fld_bit_len > bit_len) @@ -8039,8 +8038,7 @@ ada_template_to_fixed_record_type_1 (struct type *typ= e, rtype->field (variant_field).set_type (branch_type); rtype->field (variant_field).set_name ("S"); fld_bit_len =3D - TYPE_LENGTH (rtype->field (variant_field).type ()) * - TARGET_CHAR_BIT; + rtype->field (variant_field).type ()->length () * TARGET_CHAR_BIT; if (off + fld_bit_len > bit_len) bit_len =3D off + fld_bit_len; =20 @@ -8055,17 +8053,17 @@ ada_template_to_fixed_record_type_1 (struct type *t= ype, probably in the debug info. In that case, we don't round up the size of the resulting type. If this record is not part of another structu= re, the current RTYPE length might be good enough for our purposes. */ - if (TYPE_LENGTH (type) <=3D 0) + if (type->length () <=3D 0) { if (rtype->name ()) warning (_("Invalid type size for `%s' detected: %s."), - rtype->name (), pulongest (TYPE_LENGTH (type))); + rtype->name (), pulongest (type->length ())); else warning (_("Invalid type size for detected: %s."), - pulongest (TYPE_LENGTH (type))); + pulongest (type->length ())); } else - rtype->set_length (align_up (TYPE_LENGTH (rtype), TYPE_LENGTH (type))); + rtype->set_length (align_up (rtype->length (), type->length ())); =20 value_free_to_mark (mark); return rtype; @@ -8198,7 +8196,7 @@ to_record_with_fixed_variant_part (struct type *type,= const gdb_byte *valaddr, =20 rtype->set_name (ada_type_name (type)); rtype->set_is_fixed_instance (true); - rtype->set_length (TYPE_LENGTH (type)); + rtype->set_length (type->length ()); =20 branch_type =3D to_fixed_variant_branch_type (type->field (variant_field).type (), @@ -8221,11 +8219,11 @@ to_record_with_fixed_variant_part (struct type *typ= e, const gdb_byte *valaddr, rtype->field (variant_field).set_type (branch_type); rtype->field (variant_field).set_name ("S"); TYPE_FIELD_BITSIZE (rtype, variant_field) =3D 0; - rtype->set_length (TYPE_LENGTH (rtype) + TYPE_LENGTH (branch_type)); + rtype->set_length (rtype->length () + branch_type->length ()); } =20 - rtype->set_length (TYPE_LENGTH (rtype) - - TYPE_LENGTH (type->field (variant_field).type ())); + rtype->set_length (rtype->length () + - type->field (variant_field).type ()->length ()); =20 value_free_to_mark (mark); return rtype; @@ -8529,13 +8527,13 @@ to_fixed_array_type (struct type *type0, struct val= ue *dval, type was a regular (non-packed) array type. As a result, the bitsize of the array elements needs to be set again, and the array length needs to be recomputed based on that bitsize. */ - int len =3D TYPE_LENGTH (result) / TYPE_LENGTH (result->target_type = ()); + int len =3D result->length () / result->target_type ()->length (); int elt_bitsize =3D TYPE_FIELD_BITSIZE (type0, 0); =20 TYPE_FIELD_BITSIZE (result, 0) =3D TYPE_FIELD_BITSIZE (type0, 0); result->set_length (len * elt_bitsize / HOST_CHAR_BIT); - if (TYPE_LENGTH (result) * HOST_CHAR_BIT < len * elt_bitsize) - result->set_length (TYPE_LENGTH (result) + 1); + if (result->length () * HOST_CHAR_BIT < len * elt_bitsize) + result->set_length (result->length () + 1); } =20 result->set_is_fixed_instance (true); @@ -8628,7 +8626,7 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byt= e *valaddr, xvz_name, except.what ()); } =20 - if (xvz_found && TYPE_LENGTH (fixed_record_type) !=3D size) + if (xvz_found && fixed_record_type->length () !=3D size) { fixed_record_type =3D copy_type (fixed_record_type); fixed_record_type->set_length (size); @@ -9282,8 +9280,8 @@ ada_promote_array_of_integrals (struct type *type, st= ruct value *val) gdb_assert (is_integral_type (type->target_type ())); gdb_assert (value_type (val)->code () =3D=3D TYPE_CODE_ARRAY); gdb_assert (is_integral_type (value_type (val)->target_type ())); - gdb_assert (TYPE_LENGTH (type->target_type ()) - > TYPE_LENGTH (value_type (val)->target_type ())); + gdb_assert (type->target_type ()->length () + > value_type (val)->target_type ()->length ()); =20 if (!get_array_bounds (type, &lo, &hi)) error (_("unable to determine array bounds")); @@ -9295,7 +9293,7 @@ ada_promote_array_of_integrals (struct type *type, st= ruct value *val) for (i =3D 0; i < hi - lo + 1; i++) { struct value *elt =3D value_cast (elt_type, value_subscript (val, lo= + i)); - int elt_len =3D TYPE_LENGTH (elt_type); + int elt_len =3D elt_type->length (); =20 copy (value_contents_all (elt), res_contents.slice (elt_len * i, elt= _len)); } @@ -9332,16 +9330,14 @@ coerce_for_assign (struct type *type, struct value = *val) =20 if (is_integral_type (type->target_type ()) && is_integral_type (type2->target_type ()) - && TYPE_LENGTH (type2->target_type ()) - < TYPE_LENGTH (type->target_type ())) + && type2->target_type ()->length () < type->target_type ()->length ()) { /* Allow implicit promotion of the array elements to a wider type. */ return ada_promote_array_of_integrals (type, val); } =20 - if (TYPE_LENGTH (type2->target_type ()) - !=3D TYPE_LENGTH (type->target_type ())) + if (type2->target_type ()->length () !=3D type->target_type ()->leng= th ()) error (_("Incompatible types in assignment")); deprecated_set_value_type (val, type); } @@ -9414,7 +9410,7 @@ ada_value_binop (struct value *arg1, struct value *ar= g2, enum exp_opcode op) =20 val =3D allocate_value (type1); store_unsigned_integer (value_contents_raw (val).data (), - TYPE_LENGTH (value_type (val)), + value_type (val)->length (), type_byte_order (type1), v); return val; } @@ -9444,10 +9440,10 @@ ada_value_equal (struct value *arg1, struct value *= arg2) /* FIXME: The following works only for types whose representations use all bits (no padding or undefined bits) and do not have user-defined equality. */ - return (TYPE_LENGTH (arg1_type) =3D=3D TYPE_LENGTH (arg2_type) + return (arg1_type->length () =3D=3D arg2_type->length () && memcmp (value_contents (arg1).data (), value_contents (arg2).data (), - TYPE_LENGTH (arg1_type)) =3D=3D 0); + arg1_type->length ()) =3D=3D 0); } return value_equal (arg1, arg2); } @@ -10198,7 +10194,7 @@ ada_atr_size (struct type *expect_type, return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval); else return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, - TARGET_CHAR_BIT * TYPE_LENGTH (type)); + TARGET_CHAR_BIT * type->length ()); } =20 /* A helper function for UNOP_ABS. */ @@ -10667,7 +10663,7 @@ ada_string_operation::evaluate (struct type *expect= _type, =20 const std::string &str =3D std::get<0> (m_storage); const char *encoding; - switch (TYPE_LENGTH (char_type)) + switch (char_type->length ()) { case 1: { @@ -10698,7 +10694,7 @@ ada_string_operation::evaluate (struct type *expect= _type, =20 default: error (_("unexpected character type size %s"), - pulongest (TYPE_LENGTH (char_type))); + pulongest (char_type->length ())); } =20 auto_obstack converted; @@ -10710,7 +10706,7 @@ ada_string_operation::evaluate (struct type *expect= _type, struct type *stringtype =3D lookup_array_range_type (char_type, 1, obstack_object_size (&converted) - / TYPE_LENGTH (char_type)); + / char_type->length ()); struct value *val =3D allocate_value (stringtype); memcpy (value_contents_raw (val).data (), obstack_base (&converted), @@ -11529,7 +11525,7 @@ to_fixed_range_type (struct type *raw_type, struct = value *dval) /* create_static_range_type alters the resulting type's length to match the size of the base_type, which is not what we want. Set it back to the original range type's length. */ - type->set_length (TYPE_LENGTH (raw_type)); + type->set_length (raw_type->length ()); type->set_name (name); return type; } @@ -12034,7 +12030,7 @@ ada_exception_message_1 (void) =20 e_msg_val =3D ada_coerce_to_simple_array (e_msg_val); gdb_assert (e_msg_val !=3D NULL); - e_msg_len =3D TYPE_LENGTH (value_type (e_msg_val)); + e_msg_len =3D value_type (e_msg_val)->length (); =20 /* If the message string is empty, then treat it as if there was no exception message. */ @@ -13548,7 +13544,7 @@ public: /* Create the equivalent of the System.Storage_Elements.Storage_Offset type. This is a signed integral type whose size is the same as the size of addresses. */ - unsigned int addr_length =3D TYPE_LENGTH (system_addr_ptr); + unsigned int addr_length =3D system_addr_ptr->length (); add (arch_integer_type (gdbarch, addr_length * HOST_CHAR_BIT, 0, "storage_offset")); =20 diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l index ed88d502e9f..3a3647b5894 100644 --- a/gdb/ada-lex.l +++ b/gdb/ada-lex.l @@ -455,7 +455,7 @@ processInt (struct parser_state *par_state, const char = *base0, =20 yylval.typed_val_float.type =3D fp_type; result.write (gdb::make_array_view (yylval.typed_val_float.val, - TYPE_LENGTH (fp_type)), + fp_type->length ()), type_byte_order (fp_type), true); =20 diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 1e617a40158..85d1aaccb06 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -818,7 +818,7 @@ add_ada_task (CORE_ADDR task_id, struct inferior *inf) static bool read_known_tasks_array (struct ada_tasks_inferior_data *data) { - const int target_ptr_byte =3D TYPE_LENGTH (data->known_tasks_element); + const int target_ptr_byte =3D data->known_tasks_element->length (); const int known_tasks_size =3D target_ptr_byte * data->known_tasks_lengt= h; gdb_byte *known_tasks =3D (gdb_byte *) alloca (known_tasks_size); int i; @@ -845,7 +845,7 @@ read_known_tasks_array (struct ada_tasks_inferior_data = *data) static bool read_known_tasks_list (struct ada_tasks_inferior_data *data) { - const int target_ptr_byte =3D TYPE_LENGTH (data->known_tasks_element); + const int target_ptr_byte =3D data->known_tasks_element->length (); gdb_byte *known_tasks =3D (gdb_byte *) alloca (target_ptr_byte); CORE_ADDR task_id; const struct ada_tasks_pspace_data *pspace_data diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index d412c3b3181..c79226fcd7d 100644 --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c @@ -1019,7 +1019,7 @@ ada_print_type (struct type *type0, const char *varst= ring, if (!ada_is_range_type_name (name)) fprintf_styled (stream, metadata_style.style (), _("<%s-byte integer>"), - pulongest (TYPE_LENGTH (type))); + pulongest (type->length ())); else { gdb_printf (stream, "range "); @@ -1046,7 +1046,7 @@ ada_print_type (struct type *type0, const char *varst= ring, case TYPE_CODE_FLT: fprintf_styled (stream, metadata_style.style (), _("<%s-byte float>"), - pulongest (TYPE_LENGTH (type))); + pulongest (type->length ())); break; case TYPE_CODE_ENUM: if (show < 0) diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 938300b8eb7..59f0be480d4 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -195,12 +195,12 @@ val_print_packed_array_elements (struct type *type, c= onst gdb_byte *valaddr, (i * bitsize) / HOST_CHAR_BIT, (i * bitsize) % HOST_CHAR_BIT, bitsize, elttype); - if (TYPE_LENGTH (check_typedef (value_type (v0))) - !=3D TYPE_LENGTH (check_typedef (value_type (v1)))) + if (check_typedef (value_type (v0))->length () + !=3D check_typedef (value_type (v1))->length ()) break; if (!value_contents_eq (v0, value_embedded_offset (v0), v1, value_embedded_offset (v1), - TYPE_LENGTH (check_typedef (value_type (v0))))) + check_typedef (value_type (v0))->length ())) break; } =20 @@ -363,7 +363,7 @@ void ada_printchar (int c, struct type *type, struct ui_file *stream) { gdb_puts ("'", stream); - ada_emit_char (c, type, stream, '\'', TYPE_LENGTH (type)); + ada_emit_char (c, type, stream, '\'', type->length ()); gdb_puts ("'", stream); } =20 @@ -540,7 +540,7 @@ ada_printstr (struct ui_file *stream, struct type *type, const char *encoding, int force_ellipses, const struct value_print_options *options) { - printstr (stream, type, string, length, force_ellipses, TYPE_LENGTH (typ= e), + printstr (stream, type, string, length, force_ellipses, type->length (), options); } =20 @@ -697,10 +697,10 @@ ada_val_print_string (struct type *type, const gdb_by= te *valaddr, Similarly, the size of ELTTYPE should also be non-null, since it's a character-like type. */ gdb_assert (elttype !=3D NULL); - gdb_assert (TYPE_LENGTH (elttype) !=3D 0); + gdb_assert (elttype->length () !=3D 0); =20 - eltlen =3D TYPE_LENGTH (elttype); - len =3D TYPE_LENGTH (type) / eltlen; + eltlen =3D elttype->length (); + len =3D type->length () / eltlen; =20 /* If requested, look for the first null char and only print elements up to it. */ @@ -732,7 +732,7 @@ ada_value_print_ptr (struct value *val, { if (!options->format && value_type (val)->target_type ()->code () =3D=3D TYPE_CODE_INT - && TYPE_LENGTH (value_type (val)->target_type ()) =3D=3D 0) + && value_type (val)->target_type ()->length () =3D=3D 0) { gdb_puts ("null", stream); return; @@ -1023,7 +1023,7 @@ ada_value_print_inner (struct value *val, struct ui_f= ile *stream, int recurse, const gdb_byte *valaddr =3D value_contents_for_printing (val).data (); CORE_ADDR address =3D value_address (val); gdb::array_view view - =3D gdb::make_array_view (valaddr, TYPE_LENGTH (type)); + =3D gdb::make_array_view (valaddr, type->length ()); type =3D ada_check_typedef (resolve_dynamic_type (type, view, address)); if (type !=3D saved_type) { @@ -1094,11 +1094,11 @@ ada_value_print (struct value *val0, struct ui_file= *stream, "void *" pointers. */ if (type->code () =3D=3D TYPE_CODE_PTR && !(type->target_type ()->code () =3D=3D TYPE_CODE_INT - && TYPE_LENGTH (type->target_type ()) =3D=3D 0)) + && type->target_type ()->length () =3D=3D 0)) { /* Hack: don't print (char *) for char strings. Their type is indicated by the quoted string anyway. */ - if (TYPE_LENGTH (type->target_type ()) !=3D sizeof (char) + if (type->target_type ()->length () !=3D sizeof (char) || type->target_type ()->code () !=3D TYPE_CODE_INT || type->target_type ()->is_unsigned ()) { diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 44efc8e4bbb..1dc9b98c7c2 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -234,7 +234,7 @@ alpha_convert_register_p (struct gdbarch *gdbarch, int = regno, struct type *type) { return (regno >=3D ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 31 - && TYPE_LENGTH (type) =3D=3D 4); + && type->length () =3D=3D 4); } =20 static int @@ -257,7 +257,7 @@ alpha_register_to_value (struct frame_info *frame, int = regnum, =20 /* Convert to VALTYPE. */ =20 - gdb_assert (TYPE_LENGTH (valtype) =3D=3D 4); + gdb_assert (valtype->length () =3D=3D 4); alpha_sts (gdbarch, out, value_contents_all (value).data ()); =20 release_value (value); @@ -270,7 +270,7 @@ alpha_value_to_register (struct frame_info *frame, int = regnum, { gdb_byte out[ALPHA_REGISTER_SIZE]; =20 - gdb_assert (TYPE_LENGTH (valtype) =3D=3D 4); + gdb_assert (valtype->length () =3D=3D 4); gdb_assert (register_size (get_frame_arch (frame), regnum) <=3D ALPHA_REGISTER_SIZE); alpha_lds (get_frame_arch (frame), out, in); @@ -334,14 +334,14 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struc= t value *function, case TYPE_CODE_CHAR: case TYPE_CODE_RANGE: case TYPE_CODE_ENUM: - if (TYPE_LENGTH (arg_type) =3D=3D 4) + if (arg_type->length () =3D=3D 4) { /* 32-bit values must be sign-extended to 64 bits even if the base data type is unsigned. */ arg_type =3D builtin_type (gdbarch)->builtin_int32; arg =3D value_cast (arg_type, arg); } - if (TYPE_LENGTH (arg_type) < ALPHA_REGISTER_SIZE) + if (arg_type->length () < ALPHA_REGISTER_SIZE) { arg_type =3D builtin_type (gdbarch)->builtin_int64; arg =3D value_cast (arg_type, arg); @@ -352,14 +352,14 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struc= t value *function, /* "float" arguments loaded in registers must be passed in register format, aka "double". */ if (accumulate_size < sizeof (arg_reg_buffer) - && TYPE_LENGTH (arg_type) =3D=3D 4) + && arg_type->length () =3D=3D 4) { arg_type =3D builtin_type (gdbarch)->builtin_double; arg =3D value_cast (arg_type, arg); } /* Tru64 5.1 has a 128-bit long double, and passes this by invisible reference. No one else uses this data type. */ - else if (TYPE_LENGTH (arg_type) =3D=3D 16) + else if (arg_type->length () =3D=3D 16) { /* Allocate aligned storage. */ sp =3D (sp & -16) - 16; @@ -380,7 +380,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct = value *function, =20 /* Tru64 5.1 has a 128-bit long double, and passes this by invisible reference. */ - if (TYPE_LENGTH (arg_type) =3D=3D 32) + if (arg_type->length () =3D=3D 32) { /* Allocate aligned storage. */ sp =3D (sp & -16) - 16; @@ -397,7 +397,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct = value *function, default: break; } - m_arg->len =3D TYPE_LENGTH (arg_type); + m_arg->len =3D arg_type->length (); m_arg->offset =3D accumulate_size; accumulate_size =3D (accumulate_size + m_arg->len + 7) & ~7; m_arg->contents =3D value_contents (arg).data (); @@ -481,7 +481,7 @@ alpha_extract_return_value (struct type *valtype, struc= t regcache *regcache, switch (valtype->code ()) { case TYPE_CODE_FLT: - switch (TYPE_LENGTH (valtype)) + switch (valtype->length ()) { case 4: regcache->cooked_read (ALPHA_FP0_REGNUM, raw_buffer); @@ -504,7 +504,7 @@ alpha_extract_return_value (struct type *valtype, struc= t regcache *regcache, break; =20 case TYPE_CODE_COMPLEX: - switch (TYPE_LENGTH (valtype)) + switch (valtype->length ()) { case 8: /* ??? This isn't correct wrt the ABI, but it's what GCC does. */ @@ -530,7 +530,7 @@ alpha_extract_return_value (struct type *valtype, struc= t regcache *regcache, default: /* Assume everything else degenerates to an integer. */ regcache_cooked_read_unsigned (regcache, ALPHA_V0_REGNUM, &l); - store_unsigned_integer (valbuf, TYPE_LENGTH (valtype), byte_order, l= ); + store_unsigned_integer (valbuf, valtype->length (), byte_order, l); break; } } @@ -549,7 +549,7 @@ alpha_store_return_value (struct type *valtype, struct = regcache *regcache, switch (valtype->code ()) { case TYPE_CODE_FLT: - switch (TYPE_LENGTH (valtype)) + switch (valtype->length ()) { case 4: alpha_lds (gdbarch, raw_buffer, valbuf); @@ -573,7 +573,7 @@ alpha_store_return_value (struct type *valtype, struct = regcache *regcache, break; =20 case TYPE_CODE_COMPLEX: - switch (TYPE_LENGTH (valtype)) + switch (valtype->length ()) { case 8: /* ??? This isn't correct wrt the ABI, but it's what GCC does. */ @@ -601,7 +601,7 @@ alpha_store_return_value (struct type *valtype, struct = regcache *regcache, /* Assume everything else degenerates to an integer. */ /* 32-bit values must be sign-extended to 64 bits even if the base data type is unsigned. */ - if (TYPE_LENGTH (valtype) =3D=3D 4) + if (valtype->length () =3D=3D 4) valtype =3D builtin_type (gdbarch)->builtin_int32; l =3D unpack_long (valtype, valbuf); regcache_cooked_write_unsigned (regcache, ALPHA_V0_REGNUM, l); @@ -626,7 +626,7 @@ alpha_return_value (struct gdbarch *gdbarch, struct val= ue *function, { ULONGEST addr; regcache_raw_read_unsigned (regcache, ALPHA_V0_REGNUM, &addr); - read_memory (addr, readbuf, TYPE_LENGTH (type)); + read_memory (addr, readbuf, type->length ()); } =20 return RETURN_VALUE_ABI_RETURNS_ADDRESS; diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 4d416a44bf3..ea2b3b1ecc3 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -376,7 +376,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbar= ch, memcpy (buf, raw_buf + 1, 1); else mark_value_bytes_unavailable (result_value, 0, - TYPE_LENGTH (value_type (result_value))); + value_type (result_value)->length ()); } else { @@ -386,7 +386,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbar= ch, memcpy (buf, raw_buf, 1); else mark_value_bytes_unavailable (result_value, 0, - TYPE_LENGTH (value_type (result_value))); + value_type (result_value)->length ()); } } else if (i386_dword_regnum_p (gdbarch, regnum)) @@ -399,7 +399,7 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbar= ch, memcpy (buf, raw_buf, 4); else mark_value_bytes_unavailable (result_value, 0, - TYPE_LENGTH (value_type (result_value))); + value_type (result_value)->length ()); } else i386_pseudo_register_read_into_value (gdbarch, regcache, regnum, @@ -559,7 +559,7 @@ amd64_has_unaligned_fields (struct type *type) the caller). */ if (field_is_static (&type->field (i)) || (TYPE_FIELD_BITSIZE (type, i) =3D=3D 0 - && TYPE_LENGTH (subtype) =3D=3D 0) + && subtype->length () =3D=3D 0) || TYPE_FIELD_PACKED (type, i)) continue; =20 @@ -597,7 +597,7 @@ amd64_classify_aggregate_field (struct type *type, int = i, int bitsize =3D TYPE_FIELD_BITSIZE (type, i); =20 if (bitsize =3D=3D 0) - bitsize =3D TYPE_LENGTH (subtype) * 8; + bitsize =3D subtype->length () * 8; =20 /* Ignore static fields, or empty fields, for example nested empty structures.*/ @@ -666,7 +666,7 @@ amd64_classify_aggregate (struct type *type, enum amd64= _reg_class theclass[2]) loc_bitpos attributes, which will cause an assert to trigger within the unaligned field check. As classes with virtual bases are not trivially copyable, checking that first avoids this problem. */ - if (TYPE_LENGTH (type) > 16 + if (type->length () > 16 || !language_pass_by_reference (type).trivially_copyable || amd64_has_unaligned_fields (type)) { @@ -688,7 +688,7 @@ amd64_classify_aggregate (struct type *type, enum amd64= _reg_class theclass[2]) =20 /* All fields in an array have the same type. */ amd64_classify (subtype, theclass); - if (TYPE_LENGTH (type) > 8 && theclass[1] =3D=3D AMD64_NO_CLASS) + if (type->length () > 8 && theclass[1] =3D=3D AMD64_NO_CLASS) theclass[1] =3D theclass[0]; } else @@ -724,7 +724,7 @@ static void amd64_classify (struct type *type, enum amd64_reg_class theclass[2]) { enum type_code code =3D type->code (); - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); =20 theclass[0] =3D theclass[1] =3D AMD64_NO_CLASS; =20 @@ -791,7 +791,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct val= ue *function, gdb_byte *readbuf, const gdb_byte *writebuf) { enum amd64_reg_class theclass[2]; - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); static int integer_regnum[] =3D { AMD64_RAX_REGNUM, AMD64_RDX_REGNUM }; static int sse_regnum[] =3D { AMD64_XMM0_REGNUM, AMD64_XMM1_REGNUM }; int integer_reg =3D 0; @@ -821,7 +821,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct val= ue *function, ULONGEST addr; =20 regcache_raw_read_unsigned (regcache, AMD64_RAX_REGNUM, &addr); - read_memory (addr, readbuf, TYPE_LENGTH (type)); + read_memory (addr, readbuf, type->length ()); } =20 return RETURN_VALUE_ABI_RETURNS_ADDRESS; @@ -955,7 +955,7 @@ if (return_method =3D=3D return_method_struct) for (i =3D 0; i < nargs; i++) { struct type *type =3D value_type (args[i]); - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); enum amd64_reg_class theclass[2]; int needed_integer_regs =3D 0; int needed_sse_regs =3D 0; @@ -1040,7 +1040,7 @@ if (return_method =3D=3D return_method_struct) { struct type *type =3D value_type (stack_args[i]); const gdb_byte *valbuf =3D value_contents (stack_args[i]).data (); - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); =20 write_memory (sp + element * 8, valbuf, len); element +=3D ((len + 7) / 8); @@ -3071,7 +3071,7 @@ amd64_get_longjmp_target (struct frame_info *frame, C= ORE_ADDR *pc) struct gdbarch *gdbarch =3D get_frame_arch (frame); i386_gdbarch_tdep *tdep =3D gdbarch_tdep (gdbarch); int jb_pc_offset =3D tdep->jb_pc_offset; - int len =3D TYPE_LENGTH (builtin_type (gdbarch)->builtin_func_ptr); + int len =3D builtin_type (gdbarch)->builtin_func_ptr->length (); =20 /* If JB_PC_OFFSET is -1, we have no way to find out where the longjmp will land. */ diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c index 1f779fb9aa1..8573e4c0676 100644 --- a/gdb/amd64-windows-tdep.c +++ b/gdb/amd64-windows-tdep.c @@ -126,10 +126,10 @@ amd64_windows_passed_by_integer_register (struct type= *type) case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: case TYPE_CODE_COMPLEX: - return (TYPE_LENGTH (type) =3D=3D 1 - || TYPE_LENGTH (type) =3D=3D 2 - || TYPE_LENGTH (type) =3D=3D 4 - || TYPE_LENGTH (type) =3D=3D 8); + return (type->length () =3D=3D 1 + || type->length () =3D=3D 2 + || type->length () =3D=3D 4 + || type->length () =3D=3D 8); =20 default: return 0; @@ -144,7 +144,7 @@ amd64_windows_passed_by_xmm_register (struct type *type) { return ((type->code () =3D=3D TYPE_CODE_FLT || type->code () =3D=3D TYPE_CODE_DECFLOAT) - && (TYPE_LENGTH (type) =3D=3D 4 || TYPE_LENGTH (type) =3D=3D 8)); + && (type->length () =3D=3D 4 || type->length () =3D=3D 8)); } =20 /* Return non-zero iff an argument of the given TYPE should be passed @@ -180,7 +180,7 @@ amd64_windows_adjust_args_passed_by_pointer (struct val= ue **args, { struct type *type =3D value_type (args[i]); const gdb_byte *valbuf =3D value_contents (args[i]).data (); - const int len =3D TYPE_LENGTH (type); + const int len =3D type->length (); =20 /* Store a copy of that argument on the stack, aligned to a 16 bytes boundary, and then use the copy's address as @@ -208,9 +208,9 @@ amd64_windows_store_arg_in_reg (struct regcache *regcac= he, const gdb_byte *valbuf =3D value_contents (arg).data (); gdb_byte buf[8]; =20 - gdb_assert (TYPE_LENGTH (type) <=3D 8); + gdb_assert (type->length () <=3D 8); memset (buf, 0, sizeof buf); - memcpy (buf, valbuf, std::min (TYPE_LENGTH (type), (ULONGEST) 8)); + memcpy (buf, valbuf, std::min (type->length (), (ULONGEST) 8)); regcache->cooked_write (regno, buf); } =20 @@ -252,7 +252,7 @@ amd64_windows_push_arguments (struct regcache *regcache= , int nargs, for (i =3D 0; i < nargs; i++) { struct type *type =3D value_type (args[i]); - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); int on_stack_p =3D 1; =20 if (reg_idx < ARRAY_SIZE (amd64_windows_dummy_call_integer_regs)) @@ -297,8 +297,8 @@ amd64_windows_push_arguments (struct regcache *regcache= , int nargs, struct type *type =3D value_type (stack_args[i]); const gdb_byte *valbuf =3D value_contents (stack_args[i]).data (); =20 - write_memory (sp + element * 8, valbuf, TYPE_LENGTH (type)); - element +=3D ((TYPE_LENGTH (type) + 7) / 8); + write_memory (sp + element * 8, valbuf, type->length ()); + element +=3D ((type->length () + 7) / 8); } =20 return sp; @@ -357,7 +357,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, st= ruct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); int regnum =3D -1; =20 /* See if our value is returned through a register. If it is, then @@ -399,7 +399,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, st= ruct value *function, ULONGEST addr; =20 regcache_raw_read_unsigned (regcache, AMD64_RAX_REGNUM, &addr); - read_memory (addr, readbuf, TYPE_LENGTH (type)); + read_memory (addr, readbuf, type->length ()); } return RETURN_VALUE_ABI_RETURNS_ADDRESS; } diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c index 11e0551266e..ee5cd87407e 100644 --- a/gdb/arc-tdep.c +++ b/gdb/arc-tdep.c @@ -761,7 +761,7 @@ arc_push_dummy_call (struct gdbarch *gdbarch, struct va= lue *function, argument's size up to an integral number of words. */ for (int i =3D 0; i < nargs; i++) { - unsigned int len =3D TYPE_LENGTH (value_type (args[i])); + unsigned int len =3D value_type (args[i])->length (); unsigned int space =3D align_up (len, 4); =20 total_space +=3D space; @@ -776,7 +776,7 @@ arc_push_dummy_call (struct gdbarch *gdbarch, struct va= lue *function, gdb_byte *data =3D memory_image; for (int i =3D 0; i < nargs; i++) { - unsigned int len =3D TYPE_LENGTH (value_type (args[i])); + unsigned int len =3D value_type (args[i])->length (); unsigned int space =3D align_up (len, 4); =20 memcpy (data, value_contents (args[i]).data (), (size_t) len); @@ -906,7 +906,7 @@ static void arc_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, gdb_byte *valbuf) { - unsigned int len =3D TYPE_LENGTH (type); + unsigned int len =3D type->length (); =20 arc_debug_printf ("called"); =20 @@ -957,7 +957,7 @@ static void arc_store_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, const gdb_byte *valbuf) { - unsigned int len =3D TYPE_LENGTH (type); + unsigned int len =3D type->length (); =20 arc_debug_printf ("called"); =20 @@ -1029,7 +1029,7 @@ arc_return_value (struct gdbarch *gdbarch, struct val= ue *function, stored. Otherwise, the result is returned in registers. */ int is_struct_return =3D (valtype->code () =3D=3D TYPE_CODE_STRUCT || valtype->code () =3D=3D TYPE_CODE_UNION - || TYPE_LENGTH (valtype) > 2 * ARC_REGISTER_SIZE); + || valtype->length () > 2 * ARC_REGISTER_SIZE); =20 arc_debug_printf ("readbuf =3D %s, writebuf =3D %s", host_address_to_string (readbuf), @@ -2237,7 +2237,7 @@ arc_type_align (struct gdbarch *gdbarch, struct type = *type) case TYPE_CODE_METHODPTR: case TYPE_CODE_MEMBERPTR: type =3D check_typedef (type); - return std::min (4, TYPE_LENGTH (type)); + return std::min (4, type->length ()); default: return 0; } diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 7333fa6a4c9..2810232fcb8 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -4132,10 +4132,10 @@ arm_type_align (gdbarch *gdbarch, struct type *t) { /* Use the natural alignment for vector types (the same for scalar type), but the maximum alignment is 64-bit. */ - if (TYPE_LENGTH (t) > 8) + if (t->length () > 8) return 8; else - return TYPE_LENGTH (t); + return t->length (); } =20 /* Allow the common code to calculate the alignment. */ @@ -4218,7 +4218,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, switch (t->code ()) { case TYPE_CODE_FLT: - switch (TYPE_LENGTH (t)) + switch (t->length ()) { case 4: if (*base_type =3D=3D VFP_CPRC_UNKNOWN) @@ -4250,7 +4250,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, }; =20 */ - switch (TYPE_LENGTH (t)) + switch (t->length ()) { case 8: if (*base_type =3D=3D VFP_CPRC_UNKNOWN) @@ -4277,7 +4277,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, { /* A 64-bit or 128-bit containerized vector type are VFP CPRCs. */ - switch (TYPE_LENGTH (t)) + switch (t->length ()) { case 8: if (*base_type =3D=3D VFP_CPRC_UNKNOWN) @@ -4300,7 +4300,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, base_type); if (count =3D=3D -1) return -1; - if (TYPE_LENGTH (t) =3D=3D 0) + if (t->length () =3D=3D 0) { gdb_assert (count =3D=3D 0); return 0; @@ -4308,8 +4308,8 @@ arm_vfp_cprc_sub_candidate (struct type *t, else if (count =3D=3D 0) return -1; unitlen =3D arm_vfp_cprc_unit_length (*base_type); - gdb_assert ((TYPE_LENGTH (t) % unitlen) =3D=3D 0); - return TYPE_LENGTH (t) / unitlen; + gdb_assert ((t->length () % unitlen) =3D=3D 0); + return t->length () / unitlen; } } break; @@ -4330,7 +4330,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, return -1; count +=3D sub_count; } - if (TYPE_LENGTH (t) =3D=3D 0) + if (t->length () =3D=3D 0) { gdb_assert (count =3D=3D 0); return 0; @@ -4338,7 +4338,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, else if (count =3D=3D 0) return -1; unitlen =3D arm_vfp_cprc_unit_length (*base_type); - if (TYPE_LENGTH (t) !=3D unitlen * count) + if (t->length () !=3D unitlen * count) return -1; return count; } @@ -4356,7 +4356,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, return -1; count =3D (count > sub_count ? count : sub_count); } - if (TYPE_LENGTH (t) =3D=3D 0) + if (t->length () =3D=3D 0) { gdb_assert (count =3D=3D 0); return 0; @@ -4364,7 +4364,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, else if (count =3D=3D 0) return -1; unitlen =3D arm_vfp_cprc_unit_length (*base_type); - if (TYPE_LENGTH (t) !=3D unitlen * count) + if (t->length () !=3D unitlen * count) return -1; return count; } @@ -4484,7 +4484,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct = value *function, int may_use_core_reg =3D 1; =20 arg_type =3D check_typedef (value_type (args[argnum])); - len =3D TYPE_LENGTH (arg_type); + len =3D arg_type->length (); target_type =3D arg_type->target_type (); typecode =3D arg_type->code (); val =3D value_contents (args[argnum]).data (); @@ -8705,7 +8705,7 @@ arm_extract_return_value (struct type *type, struct r= egcache *regs, not using the VFP ABI code. */ case ARM_FLOAT_VFP: regs->cooked_read (ARM_A1_REGNUM, valbuf); - if (TYPE_LENGTH (type) > 4) + if (type->length () > 4) regs->cooked_read (ARM_A1_REGNUM + 1, valbuf + ARM_INT_REGISTER_SIZE); break; @@ -8728,7 +8728,7 @@ arm_extract_return_value (struct type *type, struct r= egcache *regs, /* If the type is a plain integer, then the access is straight-forward. Otherwise we have to play around a bit more. */ - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); int regno =3D ARM_A1_REGNUM; ULONGEST tmp; =20 @@ -8750,7 +8750,7 @@ arm_extract_return_value (struct type *type, struct r= egcache *regs, /* For a structure or union the behaviour is as if the value had been stored to word-aligned memory and then loaded into=20 registers with 32-bit load instruction(s). */ - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); int regno =3D ARM_A1_REGNUM; bfd_byte tmpbuf[ARM_INT_REGISTER_SIZE]; =20 @@ -8788,7 +8788,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct= type *type) { /* Vector values should be returned using ARM registers if they are not over 16 bytes. */ - return (TYPE_LENGTH (type) > 16); + return (type->length () > 16); } =20 arm_gdbarch_tdep *tdep =3D gdbarch_tdep (gdbarch); @@ -8796,7 +8796,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct= type *type) { /* The AAPCS says all aggregates not larger than a word are returned in a register. */ - if (TYPE_LENGTH (type) <=3D ARM_INT_REGISTER_SIZE + if (type->length () <=3D ARM_INT_REGISTER_SIZE && language_pass_by_reference (type).trivially_copyable) return 0; =20 @@ -8808,7 +8808,7 @@ arm_return_in_memory (struct gdbarch *gdbarch, struct= type *type) =20 /* All aggregate types that won't fit in a register must be returned in memory. */ - if (TYPE_LENGTH (type) > ARM_INT_REGISTER_SIZE + if (type->length () > ARM_INT_REGISTER_SIZE || !language_pass_by_reference (type).trivially_copyable) return 1; =20 @@ -8913,7 +8913,7 @@ arm_store_return_value (struct type *type, struct reg= cache *regs, not using the VFP ABI code. */ case ARM_FLOAT_VFP: regs->cooked_write (ARM_A1_REGNUM, valbuf); - if (TYPE_LENGTH (type) > 4) + if (type->length () > 4) regs->cooked_write (ARM_A1_REGNUM + 1, valbuf + ARM_INT_REGISTER_SIZE); break; @@ -8932,7 +8932,7 @@ arm_store_return_value (struct type *type, struct reg= cache *regs, || TYPE_IS_REFERENCE (type) || type->code () =3D=3D TYPE_CODE_ENUM) { - if (TYPE_LENGTH (type) <=3D 4) + if (type->length () <=3D 4) { /* Values of one word or less are zero/sign-extended and returned in r0. */ @@ -8947,7 +8947,7 @@ arm_store_return_value (struct type *type, struct reg= cache *regs, /* Integral values greater than one word are stored in consecutive registers starting with r0. This will always be a multiple of the regiser size. */ - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); int regno =3D ARM_A1_REGNUM; =20 while (len > 0) @@ -8963,7 +8963,7 @@ arm_store_return_value (struct type *type, struct reg= cache *regs, /* For a structure or union the behaviour is as if the value had been stored to word-aligned memory and then loaded into=20 registers with 32-bit load instruction(s). */ - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); int regno =3D ARM_A1_REGNUM; bfd_byte tmpbuf[ARM_INT_REGISTER_SIZE]; =20 @@ -9053,7 +9053,7 @@ arm_return_value (struct gdbarch *gdbarch, struct val= ue *function, CORE_ADDR addr; =20 regcache->cooked_read (ARM_A1_REGNUM, &addr); - read_memory (addr, readbuf, TYPE_LENGTH (valtype)); + read_memory (addr, readbuf, valtype->length ()); } return RETURN_VALUE_ABI_RETURNS_ADDRESS; } diff --git a/gdb/auxv.c b/gdb/auxv.c index 6154988f6dd..b248f997f1c 100644 --- a/gdb/auxv.c +++ b/gdb/auxv.c @@ -84,7 +84,7 @@ ld_so_xfer_auxv (gdb_byte *readbuf, struct bound_minimal_symbol msym; CORE_ADDR data_address, pointer_address; struct type *ptr_type =3D builtin_type (target_gdbarch ())->builtin_data= _ptr; - size_t ptr_size =3D TYPE_LENGTH (ptr_type); + size_t ptr_size =3D ptr_type->length (); size_t auxv_pair_size =3D 2 * ptr_size; gdb_byte *ptr_buf =3D (gdb_byte *) alloca (ptr_size); LONGEST retval; @@ -255,7 +255,7 @@ generic_auxv_parse (struct gdbarch *gdbarch, gdb_byte *= *readptr, int sizeof_auxv_type) { struct type *ptr_type =3D builtin_type (gdbarch)->builtin_data_ptr; - const int sizeof_auxv_val =3D TYPE_LENGTH (ptr_type); + const int sizeof_auxv_val =3D ptr_type->length (); enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); gdb_byte *ptr =3D *readptr; =20 @@ -286,7 +286,7 @@ default_auxv_parse (struct target_ops *ops, gdb_byte **= readptr, { struct gdbarch *gdbarch =3D target_gdbarch (); struct type *ptr_type =3D builtin_type (gdbarch)->builtin_data_ptr; - const int sizeof_auxv_type =3D TYPE_LENGTH (ptr_type); + const int sizeof_auxv_type =3D ptr_type->length (); =20 return generic_auxv_parse (gdbarch, readptr, endptr, typep, valp, sizeof_auxv_type); @@ -299,7 +299,7 @@ svr4_auxv_parse (struct gdbarch *gdbarch, gdb_byte **re= adptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp) { struct type *int_type =3D builtin_type (gdbarch)->builtin_int; - const int sizeof_auxv_type =3D TYPE_LENGTH (int_type); + const int sizeof_auxv_type =3D int_type->length (); =20 return generic_auxv_parse (gdbarch, readptr, endptr, typep, valp, sizeof_auxv_type); diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index f020d21e3b8..fa66d8380c5 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -315,7 +315,7 @@ avr_address_to_pointer (struct gdbarch *gdbarch, if (AVR_TYPE_ADDRESS_CLASS_FLASH (type)) { /* A data pointer in flash is byte addressed. */ - store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, + store_unsigned_integer (buf, type->length (), byte_order, avr_convert_iaddr_to_raw (addr)); } /* Is it a code address? */ @@ -324,13 +324,13 @@ avr_address_to_pointer (struct gdbarch *gdbarch, { /* A code pointer is word (16 bits) addressed. We shift the address= down by 1 bit to convert it to a pointer. */ - store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, + store_unsigned_integer (buf, type->length (), byte_order, avr_convert_iaddr_to_raw (addr >> 1)); } else { /* Strip off any upper segment bits. */ - store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, + store_unsigned_integer (buf, type->length (), byte_order, avr_convert_saddr_to_raw (addr)); } } @@ -341,7 +341,7 @@ avr_pointer_to_address (struct gdbarch *gdbarch, { enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); CORE_ADDR addr - =3D extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order); + =3D extract_unsigned_integer (buf, type->length (), byte_order); =20 /* Is it a data address in flash? */ if (AVR_TYPE_ADDRESS_CLASS_FLASH (type)) @@ -946,27 +946,27 @@ avr_return_value (struct gdbarch *gdbarch, struct val= ue *function, if ((valtype->code () =3D=3D TYPE_CODE_STRUCT || valtype->code () =3D=3D TYPE_CODE_UNION || valtype->code () =3D=3D TYPE_CODE_ARRAY) - && TYPE_LENGTH (valtype) > 8) + && valtype->length () > 8) return RETURN_VALUE_STRUCT_CONVENTION; =20 - if (TYPE_LENGTH (valtype) <=3D 2) + if (valtype->length () <=3D 2) lsb_reg =3D 24; - else if (TYPE_LENGTH (valtype) <=3D 4) + else if (valtype->length () <=3D 4) lsb_reg =3D 22; - else if (TYPE_LENGTH (valtype) <=3D 8) + else if (valtype->length () <=3D 8) lsb_reg =3D 18; else gdb_assert_not_reached ("unexpected type length"); =20 if (writebuf !=3D NULL) { - for (i =3D 0; i < TYPE_LENGTH (valtype); i++) + for (i =3D 0; i < valtype->length (); i++) regcache->cooked_write (lsb_reg + i, writebuf + i); } =20 if (readbuf !=3D NULL) { - for (i =3D 0; i < TYPE_LENGTH (valtype); i++) + for (i =3D 0; i < valtype->length (); i++) regcache->cooked_read (lsb_reg + i, readbuf + i); } =20 @@ -1302,7 +1302,7 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct = value *function, struct value *arg =3D args[i]; struct type *type =3D check_typedef (value_type (arg)); const bfd_byte *contents =3D value_contents (arg).data (); - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); =20 /* Calculate the potential last register needed. E.g. For length 2, registers regnum and regnum-1 (say 25 and 24) diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 44a2f966995..a52a5bf2596 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -221,7 +221,7 @@ gen_trace_static_fields (struct agent_expr *ax, { /* Initialize the TYPE_LENGTH if it is a typedef. */ check_typedef (value.type); - ax_const_l (ax, TYPE_LENGTH (value.type)); + ax_const_l (ax, value.type->length ()); ax_simple (ax, aop_trace); } break; @@ -292,7 +292,7 @@ gen_traced_pop (struct agent_expr *ax, struct axs_value= *value) "const8 SIZE trace" is also three bytes, does the same thing, and the simplest code which generates that will also work correctly for objects with large sizes. */ - ax_const_l (ax, TYPE_LENGTH (value->type)); + ax_const_l (ax, value->type->length ()); ax_simple (ax, aop_trace); } } @@ -337,7 +337,7 @@ gen_sign_extend (struct agent_expr *ax, struct type *ty= pe) { /* Do we need to sign-extend this? */ if (!type->is_unsigned ()) - ax_ext (ax, TYPE_LENGTH (type) * TARGET_CHAR_BIT); + ax_ext (ax, type->length () * TARGET_CHAR_BIT); } =20 =20 @@ -347,7 +347,7 @@ gen_sign_extend (struct agent_expr *ax, struct type *ty= pe) static void gen_extend (struct agent_expr *ax, struct type *type) { - int bits =3D TYPE_LENGTH (type) * TARGET_CHAR_BIT; + int bits =3D type->length () * TARGET_CHAR_BIT; =20 /* I just had to. */ ((type->is_unsigned () ? ax_zero_ext : ax_ext) (ax, bits)); @@ -363,7 +363,7 @@ gen_fetch (struct agent_expr *ax, struct type *type) if (ax->tracing) { /* Record the area of memory we're about to fetch. */ - ax_trace_quick (ax, TYPE_LENGTH (type)); + ax_trace_quick (ax, type->length ()); } =20 if (type->code () =3D=3D TYPE_CODE_RANGE) @@ -380,7 +380,7 @@ gen_fetch (struct agent_expr *ax, struct type *type) case TYPE_CODE_BOOL: /* It's a scalar value, so we know how to dereference it. How many bytes long is it? */ - switch (TYPE_LENGTH (type)) + switch (type->length ()) { case 8 / TARGET_CHAR_BIT: ax_simple (ax, aop_ref8); @@ -761,8 +761,8 @@ gen_usual_unary (struct agent_expr *ax, struct axs_valu= e *value) static int type_wider_than (struct type *type1, struct type *type2) { - return (TYPE_LENGTH (type1) > TYPE_LENGTH (type2) - || (TYPE_LENGTH (type1) =3D=3D TYPE_LENGTH (type2) + return (type1->length () > type2->length () + || (type1->length () =3D=3D type2->length () && type1->is_unsigned () && !type2->is_unsigned ())); } @@ -784,12 +784,12 @@ gen_conversion (struct agent_expr *ax, struct type *f= rom, struct type *to) =20 /* If we're converting to a narrower type, then we need to clear out the upper bits. */ - if (TYPE_LENGTH (to) < TYPE_LENGTH (from)) + if (to->length () < from->length ()) gen_extend (ax, to); =20 /* If the two values have equal width, but different signednesses, then we need to extend. */ - else if (TYPE_LENGTH (to) =3D=3D TYPE_LENGTH (from)) + else if (to->length () =3D=3D from->length ()) { if (from->is_unsigned () !=3D to->is_unsigned ()) gen_extend (ax, to); @@ -797,7 +797,7 @@ gen_conversion (struct agent_expr *ax, struct type *fro= m, struct type *to) =20 /* If we're converting to a wider type, and becoming unsigned, then we need to zero out any possible sign bits. */ - else if (TYPE_LENGTH (to) > TYPE_LENGTH (from)) + else if (to->length () > from->length ()) { if (to->is_unsigned ()) gen_extend (ax, to); @@ -948,9 +948,9 @@ gen_scale (struct agent_expr *ax, enum agent_op op, str= uct type *type) { struct type *element =3D type->target_type (); =20 - if (TYPE_LENGTH (element) !=3D 1) + if (element->length () !=3D 1) { - ax_const_l (ax, TYPE_LENGTH (element)); + ax_const_l (ax, element->length ()); ax_simple (ax, op); } } @@ -997,8 +997,8 @@ gen_ptrdiff (struct agent_expr *ax, struct axs_value *v= alue, gdb_assert (value1->type->is_pointer_or_reference ()); gdb_assert (value2->type->is_pointer_or_reference ()); =20 - if (TYPE_LENGTH (value1->type->target_type ()) - !=3D TYPE_LENGTH (value2->type->target_type ())) + if (value1->type->target_type ()->length () + !=3D value2->type->target_type ()->length ()) error (_("\ First argument of `-' is a pointer, but second argument is neither\n\ an integer nor a pointer of the same type.")); @@ -1810,7 +1810,7 @@ unop_sizeof_operation::do_generate_ax (struct express= ion *exp, /* Throw away the code we just generated. */ ax->len =3D start; =20 - ax_const_l (ax, TYPE_LENGTH (value->type)); + ax_const_l (ax, value->type->length ()); value->kind =3D axs_rvalue; value->type =3D builtin_type (ax->gdbarch)->builtin_int; } diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c index 3e801a982a8..dc1ee51d103 100644 --- a/gdb/bfin-tdep.c +++ b/gdb/bfin-tdep.c @@ -511,7 +511,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch, { struct type *value_type =3D value_enclosing_type (args[i]); =20 - total_len +=3D align_up (TYPE_LENGTH (value_type), 4); + total_len +=3D align_up (value_type->length (), 4); } =20 /* At least twelve bytes of stack space must be allocated for the functi= on's @@ -527,7 +527,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch, { struct type *value_type =3D value_enclosing_type (args[i]); struct type *arg_type =3D check_typedef (value_type); - int container_len =3D align_up (TYPE_LENGTH (arg_type), 4); + int container_len =3D align_up (arg_type->length (), 4); =20 sp -=3D container_len; write_memory (sp, value_contents (args[i]).data (), container_len); @@ -612,7 +612,7 @@ bfin_extract_return_value (struct type *type, struct gdbarch *gdbarch =3D regs->arch (); enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); bfd_byte *valbuf =3D dst; - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); ULONGEST tmp; int regno =3D BFIN_R0_REGNUM; =20 @@ -641,7 +641,7 @@ bfin_store_return_value (struct type *type, registers starting with R0. This will always be a multiple of the register size. */ =20 - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); int regno =3D BFIN_R0_REGNUM; =20 gdb_assert (len <=3D 8); @@ -668,7 +668,7 @@ bfin_return_value (struct gdbarch *gdbarch, gdb_byte *readbuf, const gdb_byte *writebuf) { - if (TYPE_LENGTH (type) > 8) + if (type->length () > 8) return RETURN_VALUE_STRUCT_CONVENTION; =20 if (readbuf) diff --git a/gdb/bpf-tdep.c b/gdb/bpf-tdep.c index 4c085093632..b50988f0344 100644 --- a/gdb/bpf-tdep.c +++ b/gdb/bpf-tdep.c @@ -265,7 +265,7 @@ static void bpf_extract_return_value (struct type *type, struct regcache *regcache, gdb_byte *valbuf) { - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); gdb_byte vbuf[8]; =20 gdb_assert (len <=3D 8); @@ -279,7 +279,7 @@ static void bpf_store_return_value (struct type *type, struct regcache *regcache, const gdb_byte *valbuf) { - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); gdb_byte vbuf[8]; =20 gdb_assert (len <=3D 8); @@ -295,7 +295,7 @@ bpf_return_value (struct gdbarch *gdbarch, struct value= *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); =20 if (len > 8) return RETURN_VALUE_STRUCT_CONVENTION; diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index bff3bac7d1a..002f4a935b1 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2120,7 +2120,7 @@ update_watchpoint (struct watchpoint *b, int reparse) loc->length =3D ((bitpos % 8) + bitsize + 7) / 8; } else - loc->length =3D TYPE_LENGTH (value_type (v)); + loc->length =3D value_type (v)->length (); =20 loc->watchpoint_type =3D type; } @@ -10259,7 +10259,7 @@ can_use_hardware_watchpoint (const std::vector &vals) =20 len =3D (target_exact_watchpoints && is_scalar_type_recursive (vtype))? - 1 : TYPE_LENGTH (value_type (v)); + 1 : value_type (v)->length (); =20 num_regs =3D target_region_ok_for_hw_watchpoint (vaddr, len); if (!num_regs) diff --git a/gdb/c-exp.y b/gdb/c-exp.y index abd5b6717a5..5a3569a7606 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -957,7 +957,7 @@ exp : SIZEOF '(' type ')' %prec UNARY type =3D check_typedef (type->target_type ()); =20 pstate->push_new - (int_type, TYPE_LENGTH (type)); + (int_type, type->length ()); } ; =20 diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 59ecdd38cea..86e0af7c91b 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -280,7 +280,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_= ptr *buffer, if (! c_textual_element_type (element_type, 0)) goto error; classify_type (element_type, element_type->arch (), charset); - width =3D TYPE_LENGTH (element_type); + width =3D element_type->length (); =20 /* If the string lives in GDB's memory instead of the inferior's, then we just need to copy it to BUFFER. Also, since such strings @@ -433,9 +433,9 @@ emit_numeric_character (struct type *type, unsigned lon= g value, { gdb_byte *buffer; =20 - buffer =3D (gdb_byte *) alloca (TYPE_LENGTH (type)); + buffer =3D (gdb_byte *) alloca (type->length ()); pack_long (buffer, type, value); - obstack_grow (output, buffer, TYPE_LENGTH (type)); + obstack_grow (output, buffer, type->length ()); } =20 /* Convert an octal escape sequence. TYPE is the target character @@ -645,7 +645,7 @@ c_string_operation::evaluate (struct type *expect_type, { LONGEST value; =20 - if (obstack_object_size (&output) !=3D TYPE_LENGTH (type)) + if (obstack_object_size (&output) !=3D type->length ()) error (_("Could not convert character " "constant to target character set")); value =3D unpack_long (type, (gdb_byte *) obstack_base (&output)); @@ -656,19 +656,19 @@ c_string_operation::evaluate (struct type *expect_typ= e, int i; =20 /* Write the terminating character. */ - for (i =3D 0; i < TYPE_LENGTH (type); ++i) + for (i =3D 0; i < type->length (); ++i) obstack_1grow (&output, 0); =20 if (satisfy_expected) { LONGEST low_bound, high_bound; - int element_size =3D TYPE_LENGTH (type); + int element_size =3D type->length (); =20 if (!get_discrete_bounds (expect_type->index_type (), &low_bound, &high_bound)) { low_bound =3D 0; - high_bound =3D (TYPE_LENGTH (expect_type) / element_size) - 1; + high_bound =3D (expect_type->length () / element_size) - 1; } if (obstack_object_size (&output) / element_size > (high_bound - low_bound + 1)) @@ -707,8 +707,8 @@ c_is_string_type_p (struct type *type) { /* See if target type looks like a string. */ struct type *array_target_type =3D type->target_type (); - return (TYPE_LENGTH (type) > 0 - && TYPE_LENGTH (array_target_type) > 0 + return (type->length () > 0 + && array_target_type->length () > 0 && c_textual_element_type (array_target_type, 0)); } case TYPE_CODE_STRING: diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index d7e33bab1e3..3a611cdac5d 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -1188,7 +1188,7 @@ c_type_print_base_struct_union (struct type *type, st= ruct ui_file *stream, the whole struct/union. */ local_podata.end_bitpos =3D podata->end_bitpos - - TYPE_LENGTH (type->field (i).type ()) * TARGET_CHAR_BIT; + - type->field (i).type ()->length () * TARGET_CHAR_BIT; } =20 c_print_type_1 (type->field (i).type (), diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index a93280c6685..9b73d973cd5 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -98,7 +98,7 @@ c_textual_element_type (struct type *type, char format) /* Print this as a string if we can manage it. For now, no wide character support. */ if (true_type->code () =3D=3D TYPE_CODE_INT - && TYPE_LENGTH (true_type) =3D=3D 1) + && true_type->length () =3D=3D 1) return 1; } else @@ -107,7 +107,7 @@ c_textual_element_type (struct type *type, char format) flag, then we treat it as text; otherwise, we assume it's being used as data. */ if (true_type->code () =3D=3D TYPE_CODE_INT - && TYPE_LENGTH (true_type) =3D=3D 1 + && true_type->length () =3D=3D 1 && !TYPE_NOTTEXT (true_type)) return 1; } @@ -241,7 +241,7 @@ c_value_print_array (struct value *val, struct type *unresolved_elttype =3D type->target_type (); struct type *elttype =3D check_typedef (unresolved_elttype); =20 - if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0) + if (type->length () > 0 && unresolved_elttype->length () > 0) { LONGEST low_bound, high_bound; int eltlen, len; @@ -250,16 +250,16 @@ c_value_print_array (struct value *val, if (!get_array_bounds (type, &low_bound, &high_bound)) error (_("Could not determine the array high bound")); =20 - eltlen =3D TYPE_LENGTH (elttype); + eltlen =3D elttype->length (); len =3D high_bound - low_bound + 1; =20 /* Print arrays of textual chars with a string syntax, as long as the entire array is valid. */ if (c_textual_element_type (unresolved_elttype, options->format) - && value_bytes_available (val, 0, TYPE_LENGTH (type)) + && value_bytes_available (val, 0, type->length ()) && !value_bits_any_optimized_out (val, 0, - TARGET_CHAR_BIT * TYPE_LENGTH (type))) + TARGET_CHAR_BIT * type->length ())) { int force_ellipses =3D 0; =20 @@ -569,8 +569,8 @@ c_value_print (struct value *val, struct ui_file *strea= m, superclass of the object's type. In this case it is better to leave the object as-is. */ if (!(full - && (TYPE_LENGTH (real_type) - < TYPE_LENGTH (value_enclosing_type (val))))) + && (real_type->length () + < value_enclosing_type (val)->length ()))) val =3D value_cast (real_type, val); gdb_printf (stream, "(%s%s) ", real_type->name (), diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c index 957e7f3d72f..4911e37a200 100644 --- a/gdb/c-varobj.c +++ b/gdb/c-varobj.c @@ -191,9 +191,9 @@ c_number_of_children (const struct varobj *var) switch (type->code ()) { case TYPE_CODE_ARRAY: - if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (target) > 0 + if (type->length () > 0 && target->length () > 0 && (type->bounds ()->high.kind () !=3D PROP_UNDEFINED)) - children =3D TYPE_LENGTH (type) / TYPE_LENGTH (target); + children =3D type->length () / target->length (); else /* If we don't know how many elements there are, don't display any. */ diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 33c162b9f11..a79088399a6 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -225,7 +225,7 @@ dump_value_to_file (const char *cmd, const char *mode, = const char *file_format) /* Have everything. Open/write the data. */ if (file_format =3D=3D NULL || strcmp (file_format, "binary") =3D=3D 0) dump_binary_file (filename.get (), mode, value_contents (val).data (), - TYPE_LENGTH (value_type (val))); + value_type (val)->length ()); else { CORE_ADDR vaddr; @@ -242,7 +242,7 @@ dump_value_to_file (const char *cmd, const char *mode, = const char *file_format) =20 dump_bfd_file (filename.get (), mode, file_format, vaddr, value_contents (val).data (),=20 - TYPE_LENGTH (value_type (val))); + value_type (val)->length ()); } } =20 diff --git a/gdb/coffread.c b/gdb/coffread.c index 801978978e9..babf6bdbaa8 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1509,7 +1509,7 @@ patch_opaque_types (struct symtab *s) if (real_sym->aclass () =3D=3D LOC_TYPEDEF && real_sym->domain () =3D=3D VAR_DOMAIN && real_sym->type ()->code () =3D=3D TYPE_CODE_PTR - && TYPE_LENGTH (real_sym->type ()->target_type ()) !=3D 0) + && real_sym->type ()->target_type ()->length () !=3D 0) { const char *name =3D real_sym->linkage_name (); int hash =3D hashname (name); @@ -1699,7 +1699,7 @@ process_coff_symbol (struct coff_symbol *cs, references work themselves out via the magic of coff_lookup_type. */ if (sym->type ()->code () =3D=3D TYPE_CODE_PTR - && TYPE_LENGTH (sym->type ()->target_type ()) =3D=3D 0 + && sym->type ()->target_type ()->length () =3D=3D 0 && sym->type ()->target_type ()->code () !=3D TYPE_CODE_UNDEF) { diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-suppor= t.c index 81356f048be..19fcf00594f 100644 --- a/gdb/compile/compile-c-support.c +++ b/gdb/compile/compile-c-support.c @@ -252,7 +252,7 @@ generate_register_struct (struct ui_file *stream, struc= t gdbarch *gdbarch, case TYPE_CODE_INT: { const char *mode - =3D c_get_mode_for_size (TYPE_LENGTH (regtype)); + =3D c_get_mode_for_size (regtype->length ()); =20 if (mode !=3D NULL) { @@ -275,7 +275,7 @@ generate_register_struct (struct ui_file *stream, struc= t gdbarch *gdbarch, " __attribute__((__aligned__(" "__BIGGEST_ALIGNMENT__)))", regname.c_str (), - pulongest (TYPE_LENGTH (regtype))); + pulongest (regtype->length ())); } gdb_puts (";\n", stream); } diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c index d92bd204485..5cfbeccfc18 100644 --- a/gdb/compile/compile-c-types.c +++ b/gdb/compile/compile-c-types.c @@ -110,7 +110,7 @@ convert_struct_or_union (compile_c_instance *context, s= truct type *type) =20 field_type =3D context->convert_type (type->field (i).type ()); if (bitsize =3D=3D 0) - bitsize =3D 8 * TYPE_LENGTH (type->field (i).type ()); + bitsize =3D 8 * type->field (i).type ()->length (); context->plugin ().build_add_field (result, type->field (i).name (), field_type, @@ -118,7 +118,7 @@ convert_struct_or_union (compile_c_instance *context, s= truct type *type) type->field (i).loc_bitpos ()); } =20 - context->plugin ().finish_record_or_union (result, TYPE_LENGTH (type)); + context->plugin ().finish_record_or_union (result, type->length ()); return result; } =20 @@ -131,7 +131,7 @@ convert_enum (compile_c_instance *context, struct type = *type) int i; =20 int_type =3D context->plugin ().int_type_v0 (type->is_unsigned (), - TYPE_LENGTH (type)); + type->length ()); =20 result =3D context->plugin ().build_enum_type (int_type); for (i =3D 0; i < type->num_fields (); ++i) @@ -196,16 +196,16 @@ convert_int (compile_c_instance *context, struct type= *type) { if (type->has_no_signedness ()) { - gdb_assert (TYPE_LENGTH (type) =3D=3D 1); + gdb_assert (type->length () =3D=3D 1); return context->plugin ().char_type (); } return context->plugin ().int_type (type->is_unsigned (), - TYPE_LENGTH (type), + type->length (), type->name ()); } else return context->plugin ().int_type_v0 (type->is_unsigned (), - TYPE_LENGTH (type)); + type->length ()); } =20 /* Convert a floating-point type to its gcc representation. */ @@ -214,10 +214,10 @@ static gcc_type convert_float (compile_c_instance *context, struct type *type) { if (context->plugin ().version () >=3D GCC_C_FE_VERSION_1) - return context->plugin ().float_type (TYPE_LENGTH (type), + return context->plugin ().float_type (type->length (), type->name ()); else - return context->plugin ().float_type_v0 (TYPE_LENGTH (type)); + return context->plugin ().float_type_v0 (type->length ()); } =20 /* Convert the 'void' type to its gcc representation. */ diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-= types.c index 6f666e24fc3..245345d1dbf 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -648,7 +648,7 @@ compile_cplus_convert_struct_or_union_members | get_field_access_flag (type, i); =20 if (bitsize =3D=3D 0) - bitsize =3D 8 * TYPE_LENGTH (type->field (i).type ()); + bitsize =3D 8 * type->field (i).type ()->length (); =20 instance->plugin ().build_field (field_name, field_type, field_flags, bitsize, @@ -891,7 +891,7 @@ compile_cplus_convert_struct_or_union (compile_cplus_in= stance *instance, compile_cplus_convert_struct_or_union_members (instance, type, result); =20 /* All finished. */ - instance->plugin ().finish_class_type (name.get (), TYPE_LENGTH (type)); + instance->plugin ().finish_class_type (name.get (), type->length ()); =20 /* Pop all scopes. */ instance->leave_scope (); @@ -926,7 +926,7 @@ compile_cplus_convert_enum (compile_cplus_instance *ins= tance, struct type *type, =20 gcc_type int_type =3D instance->plugin ().get_int_type (type->is_unsigned (), - TYPE_LENGTH (type), nullptr); + type->length (), nullptr); gcc_type result =3D instance->plugin ().start_enum_type (name.get (), int_type, GCC_CP_SYMBOL_ENUM | nested_access @@ -1012,12 +1012,12 @@ compile_cplus_convert_int (compile_cplus_instance *= instance, struct type *type) { if (type->has_no_signedness ()) { - gdb_assert (TYPE_LENGTH (type) =3D=3D 1); + gdb_assert (type->length () =3D=3D 1); return instance->plugin ().get_char_type (); } =20 return instance->plugin ().get_int_type - (type->is_unsigned (), TYPE_LENGTH (type), type->name ()); + (type->is_unsigned (), type->length (), type->name ()); } =20 /* Convert a floating-point type to its gcc representation. */ @@ -1027,7 +1027,7 @@ compile_cplus_convert_float (compile_cplus_instance *= instance, struct type *type) { return instance->plugin ().get_float_type - (TYPE_LENGTH (type), type->name ()); + (type->length (), type->name ()); } =20 /* Convert the 'void' type to its gcc representation. */ diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object= -load.c index aede3bc43b3..f3573cb7c72 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -557,7 +557,7 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base) ULONGEST reg_offset; struct type *reg_type =3D check_typedef (regs_type->field (fieldno).type ()); - ULONGEST reg_size =3D TYPE_LENGTH (reg_type); + ULONGEST reg_size =3D reg_type->length (); int regnum; struct value *regval; CORE_ADDR inferior_addr; @@ -806,15 +806,15 @@ compile_object_load (const compile_file_names &file_n= ames, { /* Use read-only non-executable memory protection. */ regs_addr =3D gdbarch_infcall_mmap (target_gdbarch (), - TYPE_LENGTH (regs_type), + regs_type->length (), GDB_MMAP_PROT_READ); gdb_assert (regs_addr !=3D 0); - setup_sections_data.munmap_list.add (regs_addr, TYPE_LENGTH (regs_ty= pe)); + setup_sections_data.munmap_list.add (regs_addr, regs_type->length ()= ); if (compile_debug) gdb_printf (gdb_stdlog, "allocated %s bytes at %s for registers\n", paddress (target_gdbarch (), - TYPE_LENGTH (regs_type)), + regs_type->length ()), paddress (target_gdbarch (), regs_addr)); store_regs (regs_type, regs_addr); } @@ -827,17 +827,17 @@ compile_object_load (const compile_file_names &file_n= ames, return NULL; check_typedef (out_value_type); out_value_addr =3D gdbarch_infcall_mmap (target_gdbarch (), - TYPE_LENGTH (out_value_type), + out_value_type->length (), (GDB_MMAP_PROT_READ | GDB_MMAP_PROT_WRITE)); gdb_assert (out_value_addr !=3D 0); setup_sections_data.munmap_list.add (out_value_addr, - TYPE_LENGTH (out_value_type)); + out_value_type->length ()); if (compile_debug) gdb_printf (gdb_stdlog, "allocated %s bytes at %s for printed value\n", paddress (target_gdbarch (), - TYPE_LENGTH (out_value_type)), + out_value_type->length ()), paddress (target_gdbarch (), out_value_addr)); } =20 diff --git a/gdb/corefile.c b/gdb/corefile.c index 71f81571342..6a226cc4755 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -335,9 +335,9 @@ read_code_unsigned_integer (CORE_ADDR memaddr, int len, CORE_ADDR read_memory_typed_address (CORE_ADDR addr, struct type *type) { - gdb_byte *buf =3D (gdb_byte *) alloca (TYPE_LENGTH (type)); + gdb_byte *buf =3D (gdb_byte *) alloca (type->length ()); =20 - read_memory (addr, buf, TYPE_LENGTH (type)); + read_memory (addr, buf, type->length ()); return extract_typed_address (buf, type); } =20 diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 86bc57b5353..fac558deb05 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -451,12 +451,12 @@ cp_print_value (struct value *val, struct ui_file *st= ream, clobbered by the user program. Make sure that it still points to a valid memory location. */ =20 - if (boffset < 0 || boffset >=3D TYPE_LENGTH (type)) + if (boffset < 0 || boffset >=3D type->length ()) { - gdb::byte_vector buf (TYPE_LENGTH (baseclass)); + gdb::byte_vector buf (baseclass->length ()); =20 if (target_read_memory (address + boffset, buf.data (), - TYPE_LENGTH (baseclass)) !=3D 0) + baseclass->length ()) !=3D 0) skip =3D 1; base_val =3D value_from_contents_and_address (baseclass, buf.data (), @@ -652,7 +652,7 @@ cp_find_class_member (struct type **self_p, int *fieldn= o, for (i =3D 0; i < TYPE_N_BASECLASSES (self); i++) { LONGEST bitpos =3D self->field (i).loc_bitpos (); - LONGEST bitsize =3D 8 * TYPE_LENGTH (self->field (i).type ()); + LONGEST bitsize =3D 8 * self->field (i).type ()->length (); =20 if (offset >=3D bitpos && offset < bitpos + bitsize) { @@ -679,7 +679,7 @@ cp_print_class_member (const gdb_byte *valaddr, struct = type *type, int fieldno; =20 val =3D extract_signed_integer (valaddr, - TYPE_LENGTH (type), + type->length (), byte_order); =20 /* Pointers to data members are usually byte offsets into an object. @@ -763,7 +763,7 @@ test_print_fields (gdbarch *arch) =20 value *val =3D allocate_value (the_struct); gdb_byte *contents =3D value_contents_writeable (val).data (); - store_unsigned_integer (contents, TYPE_LENGTH (value_enclosing_type (val= )), + store_unsigned_integer (contents, value_enclosing_type (val)->length (), gdbarch_byte_order (arch), 0xe9); =20 string_file out; diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 73110d97f2f..549bc066480 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -821,7 +821,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct v= alue *function, int reg_demand; int i; =20 - len =3D TYPE_LENGTH (value_type (args[argnum])); + len =3D value_type (args[argnum])->length (); val =3D value_contents (args[argnum]).data (); =20 /* How may registers worth of storage do we need for this argument? = */ @@ -1611,7 +1611,7 @@ cris_store_return_value (struct type *type, struct re= gcache *regcache, struct gdbarch *gdbarch =3D regcache->arch (); enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); ULONGEST val; - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); =20 if (len <=3D 4) { @@ -1779,7 +1779,7 @@ cris_extract_return_value (struct type *type, struct = regcache *regcache, struct gdbarch *gdbarch =3D regcache->arch (); enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); ULONGEST val; - int len =3D TYPE_LENGTH (type); + int len =3D type->length (); =20 if (len <=3D 4) { @@ -1808,7 +1808,7 @@ cris_return_value (struct gdbarch *gdbarch, struct va= lue *function, { if (type->code () =3D=3D TYPE_CODE_STRUCT || type->code () =3D=3D TYPE_CODE_UNION - || TYPE_LENGTH (type) > 8) + || type->length () > 8) /* Structs, unions, and anything larger than 8 bytes (2 registers) goes on the stack. */ return RETURN_VALUE_STRUCT_CONVENTION; diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c index ca0111f7025..cbf12c18063 100644 --- a/gdb/csky-tdep.c +++ b/gdb/csky-tdep.c @@ -802,7 +802,7 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct v= alue *function, const gdb_byte *val; =20 arg_type =3D check_typedef (value_type (args[argnum])); - len =3D TYPE_LENGTH (arg_type); + len =3D arg_type->length (); val =3D value_contents (args[argnum]).data (); =20 /* Copy the argument to argument registers or the dummy stack. @@ -869,7 +869,7 @@ csky_return_value (struct gdbarch *gdbarch, struct valu= e *function, { CORE_ADDR regval; enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); - int len =3D TYPE_LENGTH (valtype); + int len =3D valtype->length (); unsigned int ret_regnum =3D CSKY_RET_REGNUM; =20 /* Csky abi specifies that return values larger than 8 bytes diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 890cb91aca7..4e866b8b92b 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -749,7 +749,7 @@ read_enum_type (struct ctf_context *ccp, ctf_id_t tid) type->set_code (TYPE_CODE_ENUM); type->set_length (ctf_type_size (fp, tid)); /* Set the underlying type based on its ctf_type_size bits. */ - type->set_target_type (objfile_int_type (of, TYPE_LENGTH (type), false)); + type->set_target_type (objfile_int_type (of, type->length (), false)); set_type_align (type, ctf_type_align (fp, tid)); =20 return set_tid_type (of, tid, type); diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c index 85b3da378f5..947c4ae1e0e 100644 --- a/gdb/d-valprint.c +++ b/gdb/d-valprint.c @@ -40,7 +40,7 @@ dynamic_array_type (struct type *type, && strcmp (type->field (1).name (), "ptr") =3D=3D 0 && !value_bits_any_optimized_out (val, TARGET_CHAR_BIT * embedded_offset, - TARGET_CHAR_BIT * TYPE_LENGTH (type))) + TARGET_CHAR_BIT * type->length ())) { CORE_ADDR addr; struct type *elttype; diff --git a/gdb/dwarf2/cu.c b/gdb/dwarf2/cu.c index fe95d7ea87b..e95208e2e75 100644 --- a/gdb/dwarf2/cu.c +++ b/gdb/dwarf2/cu.c @@ -110,7 +110,7 @@ dwarf2_cu::addr_type () const struct type *addr_type =3D lookup_pointer_type (void_type); int addr_size =3D this->per_cu->addr_size (); =20 - if (TYPE_LENGTH (addr_type) =3D=3D addr_size) + if (addr_type->length () =3D=3D addr_size) return addr_type; =20 addr_type =3D addr_sized_int_type (addr_type->is_unsigned ()); diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index ed8366d2a87..d3e3e97ba07 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -182,14 +182,14 @@ rw_pieced_value (value *v, value *from, bool check_op= timized) =3D=3D BFD_ENDIAN_BIG)) { /* Use the least significant bits of FROM. */ - max_offset =3D 8 * TYPE_LENGTH (value_type (from)); + max_offset =3D 8 * value_type (from)->length (); offset =3D max_offset - value_bitsize (v); } else max_offset =3D value_bitsize (v); } else - max_offset =3D 8 * TYPE_LENGTH (value_type (v)); + max_offset =3D 8 * value_type (v)->length (); =20 /* Advance to the first non-skipped piece. */ for (i =3D 0; i < c->pieces.size () && bits_to_skip >[...] [diff truncated at 100000 bytes]