diff options
author | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-09-27 19:02:00 +0200 |
---|---|---|
committer | Ulrich Weigand <ulrich.weigand@de.ibm.com> | 2017-09-27 19:02:00 +0200 |
commit | 77b7c781e9f03cdd903dad76f47ea0bb25277b06 (patch) | |
tree | c54f3868fc8d2eb30ac9d5cae19789294fbc9f96 /gdb | |
parent | 8e43602e34ba404d82f7c74f6629f01e40c740e0 (diff) | |
download | fsf-binutils-gdb-77b7c781e9f03cdd903dad76f47ea0bb25277b06.zip fsf-binutils-gdb-77b7c781e9f03cdd903dad76f47ea0bb25277b06.tar.gz fsf-binutils-gdb-77b7c781e9f03cdd903dad76f47ea0bb25277b06.tar.bz2 |
Make init_type/arch_type take a size in bits
This changes the interfaces to init_type and arch_type to take the
type length in bits as input (instead of as bytes). The routines
assert that the length is a multiple of TARGET_CHAR_BIT.
For consistency, arch_flags_type is changed likewise, so that now
all type creation interfaces always use length in bits.
All callers are updated in the straightforward manner.
The assert actually found a bug in read_range_type, where the
init_integer_type routine was called with a wrong argument (probably
a bug introduced with the conversion to use init_integer_type).
gdb/ChangeLog
2017-09-27 Ulrich Weigand <uweigand@de.ibm.com>
* gdbtypes.c (init_type): Change incoming argument from
length-in-bytes to length-in-bits. Assert length is a
multiple of TARGET_CHAR_BITS.
(arch_type, arch_flags_type): Likewise.
(init_integer_type): Update call to init_type.
(init_character_type): Likewise.
(init_boolean_type): Likewise.
(init_float_type): Likewise.
(init_decfloat_type): Likewise.
(init_complex_type): Likewise.
(init_pointer_type): Likewise.
(objfile_type): Likewise.
(arch_integer_type): Update call to arch_type.
(arch_character_type): Likewise.
(arch_boolean_type): Likewise.
(arch_float_type): Likewise.
(arch_decfloat_type): Likewise.
(arch_complex_type): Likewise.
(arch_pointer_type): Likewise.
(gdbtypes_post_init): Likewise.
* dwarf2read.c (dwarf2_init_float_type): Update call to init_type.
(read_base_type): Likewise.
* mdebugread.c (basic_type): Likewise.
* stabsread.c (dbx_init_float_type): Likewise.
(rs6000_builtin_type): Likewise.
(read_range_type): Likewise. Also, fix call to init_integer_type
with erroneous length argument.
* ada-lang.c (ada_language_arch_info): Update call to arch_type.
* d-lang.c (build_d_types): Likewise.
* f-lang.c (build_fortran_types): Likewise.
* go-lang.c (build_go_types): Likewise.
* opencl-lang.c (build_opencl_types): Likewise.
* jit.c (finalize_symtab): Likewise.
* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
(build_std_type_info_type): Likewise.
* target-descriptions.c (tdesc_gdb_type): Likewise. Also,
update call to arch_flags_type.
* linux-tdep.c (linux_get_siginfo_type_with_fields): Update call to
arch_type.
* fbsd-tdep.c (fbsd_get_siginfo_type): Likewise.
* windows-tdep.c (windows_get_tlb_type): Likewise.
* avr-tdep.c (avr_gdbarch_init): Update call to arch_type.
* ft32-tdep.c (ft32_gdbarch_init): Likewise.
* m32c-tdep.c (make_types): Likewise.
* rl78-tdep.c (rl78_gdbarch_init): Likewise.
(rl78_psw_type): Update call to arch_flags_type.
* m68k-tdep.c (m68k_ps_type): Update call to arch_flags_type.
* rx-tdep.c (rx_psw_type): Likewise.
(rx_fpsw_type): Likewise.
* sparc-tdep.c (sparc_psr_type): Likewise.
(sparc_fsr_type): Likewise.
* sparc64-tdep.c (sparc64_pstate_type): Likewise.
(sparc64_ccr_type): Likewise.
(sparc64_fsr_type): Likewise.
(sparc64_fprs_type): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 62 | ||||
-rw-r--r-- | gdb/ada-lang.c | 3 | ||||
-rw-r--r-- | gdb/avr-tdep.c | 3 | ||||
-rw-r--r-- | gdb/d-lang.c | 2 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 7 | ||||
-rw-r--r-- | gdb/f-lang.c | 2 | ||||
-rw-r--r-- | gdb/fbsd-tdep.c | 5 | ||||
-rw-r--r-- | gdb/ft32-tdep.c | 2 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 59 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 2 | ||||
-rw-r--r-- | gdb/gnu-v3-abi.c | 4 | ||||
-rw-r--r-- | gdb/go-lang.c | 2 | ||||
-rw-r--r-- | gdb/jit.c | 2 | ||||
-rw-r--r-- | gdb/linux-tdep.c | 7 | ||||
-rw-r--r-- | gdb/m32c-tdep.c | 2 | ||||
-rw-r--r-- | gdb/m68k-tdep.c | 2 | ||||
-rw-r--r-- | gdb/mdebugread.c | 5 | ||||
-rw-r--r-- | gdb/opencl-lang.c | 2 | ||||
-rw-r--r-- | gdb/rl78-tdep.c | 5 | ||||
-rw-r--r-- | gdb/rx-tdep.c | 4 | ||||
-rw-r--r-- | gdb/sparc-tdep.c | 4 | ||||
-rw-r--r-- | gdb/sparc64-tdep.c | 8 | ||||
-rw-r--r-- | gdb/stabsread.c | 12 | ||||
-rw-r--r-- | gdb/target-descriptions.c | 5 | ||||
-rw-r--r-- | gdb/windows-tdep.c | 12 |
25 files changed, 148 insertions, 75 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 48fb9b5..7de4542 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,65 @@ +2017-09-27 Ulrich Weigand <uweigand@de.ibm.com> + + * gdbtypes.c (init_type): Change incoming argument from + length-in-bytes to length-in-bits. Assert length is a + multiple of TARGET_CHAR_BITS. + (arch_type, arch_flags_type): Likewise. + (init_integer_type): Update call to init_type. + (init_character_type): Likewise. + (init_boolean_type): Likewise. + (init_float_type): Likewise. + (init_decfloat_type): Likewise. + (init_complex_type): Likewise. + (init_pointer_type): Likewise. + (objfile_type): Likewise. + (arch_integer_type): Update call to arch_type. + (arch_character_type): Likewise. + (arch_boolean_type): Likewise. + (arch_float_type): Likewise. + (arch_decfloat_type): Likewise. + (arch_complex_type): Likewise. + (arch_pointer_type): Likewise. + (gdbtypes_post_init): Likewise. + + * dwarf2read.c (dwarf2_init_float_type): Update call to init_type. + (read_base_type): Likewise. + * mdebugread.c (basic_type): Likewise. + * stabsread.c (dbx_init_float_type): Likewise. + (rs6000_builtin_type): Likewise. + (read_range_type): Likewise. Also, fix call to init_integer_type + with erroneous length argument. + + * ada-lang.c (ada_language_arch_info): Update call to arch_type. + * d-lang.c (build_d_types): Likewise. + * f-lang.c (build_fortran_types): Likewise. + * go-lang.c (build_go_types): Likewise. + * opencl-lang.c (build_opencl_types): Likewise. + * jit.c (finalize_symtab): Likewise. + * gnu-v3-abi.c (build_gdb_vtable_type): Likewise. + (build_std_type_info_type): Likewise. + * target-descriptions.c (tdesc_gdb_type): Likewise. Also, + update call to arch_flags_type. + + * linux-tdep.c (linux_get_siginfo_type_with_fields): Update call to + arch_type. + * fbsd-tdep.c (fbsd_get_siginfo_type): Likewise. + * windows-tdep.c (windows_get_tlb_type): Likewise. + + * avr-tdep.c (avr_gdbarch_init): Update call to arch_type. + * ft32-tdep.c (ft32_gdbarch_init): Likewise. + * m32c-tdep.c (make_types): Likewise. + * rl78-tdep.c (rl78_gdbarch_init): Likewise. + (rl78_psw_type): Update call to arch_flags_type. + * m68k-tdep.c (m68k_ps_type): Update call to arch_flags_type. + * rx-tdep.c (rx_psw_type): Likewise. + (rx_fpsw_type): Likewise. + * sparc-tdep.c (sparc_psr_type): Likewise. + (sparc_fsr_type): Likewise. + * sparc64-tdep.c (sparc64_pstate_type): Likewise. + (sparc64_ccr_type): Likewise. + (sparc64_fsr_type): Likewise. + (sparc64_fprs_type): Likewise. + 2017-09-27 Tom Tromey <tom@tromey.com> * findcmd.c (find_command): Constify. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index ea051c3..b5a3b65 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13859,7 +13859,8 @@ ada_language_arch_info (struct gdbarch *gdbarch, = builtin->builtin_void; lai->primitive_type_vector [ada_primitive_type_system_address] - = lookup_pointer_type (arch_type (gdbarch, TYPE_CODE_VOID, 1, "void")); + = lookup_pointer_type (arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, + "void")); TYPE_NAME (lai->primitive_type_vector [ada_primitive_type_system_address]) = "system__address"; diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index 6818f33..9aca8c3 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -1460,7 +1460,8 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Create a type for PC. We can't use builtin types here, as they may not be defined. */ - tdep->void_type = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void"); + tdep->void_type = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, + "void"); tdep->func_void_type = make_function_type (tdep->void_type, NULL); tdep->pc_type = arch_pointer_type (gdbarch, 4 * TARGET_CHAR_BIT, NULL, tdep->func_void_type); diff --git a/gdb/d-lang.c b/gdb/d-lang.c index 277df01..e3220d41 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -263,7 +263,7 @@ build_d_types (struct gdbarch *gdbarch) /* Basic types. */ builtin_d_type->builtin_void - = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void"); + = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); builtin_d_type->builtin_bool = arch_boolean_type (gdbarch, 8, 1, "bool"); builtin_d_type->builtin_byte diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 8c056da..7a59c1b 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -15212,7 +15212,7 @@ dwarf2_init_float_type (struct objfile *objfile, int bits, const char *name, if (format) type = init_float_type (objfile, bits, name, format); else - type = init_type (objfile, TYPE_CODE_ERROR, bits / TARGET_CHAR_BIT, name); + type = init_type (objfile, TYPE_CODE_ERROR, bits, name); return type; } @@ -15250,7 +15250,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) { case DW_ATE_address: /* Turn DW_ATE_address into a void * pointer. */ - type = init_type (objfile, TYPE_CODE_VOID, 1, NULL); + type = init_type (objfile, TYPE_CODE_VOID, TARGET_CHAR_BIT, NULL); type = init_pointer_type (objfile, bits, name, type); break; case DW_ATE_boolean: @@ -15316,8 +15316,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) default: complaint (&symfile_complaints, _("unsupported DW_AT_encoding: '%s'"), dwarf_type_encoding_name (encoding)); - type = init_type (objfile, TYPE_CODE_ERROR, - bits / TARGET_CHAR_BIT, name); + type = init_type (objfile, TYPE_CODE_ERROR, bits, name); break; } diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 54f665d..073d529 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -304,7 +304,7 @@ build_fortran_types (struct gdbarch *gdbarch) = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct builtin_f_type); builtin_f_type->builtin_void - = arch_type (gdbarch, TYPE_CODE_VOID, 1, "VOID"); + = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "VOID"); builtin_f_type->builtin_character = arch_integer_type (gdbarch, TARGET_CHAR_BIT, 0, "character"); diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index 1908269..727e28a 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -432,13 +432,14 @@ fbsd_get_siginfo_type (struct gdbarch *gdbarch) /* __pid_t */ pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - TYPE_LENGTH (int32_type), "__pid_t"); + TYPE_LENGTH (int32_type) * TARGET_CHAR_BIT, "__pid_t"); TYPE_TARGET_TYPE (pid_type) = int32_type; TYPE_TARGET_STUB (pid_type) = 1; /* __uid_t */ uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - TYPE_LENGTH (uint32_type), "__uid_t"); + TYPE_LENGTH (uint32_type) * TARGET_CHAR_BIT, + "__uid_t"); TYPE_TARGET_TYPE (uid_type) = uint32_type; TYPE_TARGET_STUB (uid_type) = 1; diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c index a988421..0e61a4b 100644 --- a/gdb/ft32-tdep.c +++ b/gdb/ft32-tdep.c @@ -598,7 +598,7 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Create a type for PC. We can't use builtin types here, as they may not be defined. */ - void_type = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void"); + void_type = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); func_void_type = make_function_type (void_type, NULL); tdep->pc_type = arch_pointer_type (gdbarch, 4 * TARGET_CHAR_BIT, NULL, func_void_type); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 37162d0..bec1fd5 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -2757,14 +2757,15 @@ verify_floatformat (int bit, const struct floatformat **floatformats) least as long as OBJFILE. */ struct type * -init_type (struct objfile *objfile, enum type_code code, int length, +init_type (struct objfile *objfile, enum type_code code, int bit, const char *name) { struct type *type; type = alloc_type (objfile); set_type_code (type, code); - TYPE_LENGTH (type) = length; + gdb_assert ((bit % TARGET_CHAR_BIT) == 0); + TYPE_LENGTH (type) = bit / TARGET_CHAR_BIT; TYPE_NAME (type) = name; return type; @@ -2790,7 +2791,7 @@ init_integer_type (struct objfile *objfile, { struct type *t; - t = init_type (objfile, TYPE_CODE_INT, bit / TARGET_CHAR_BIT, name); + t = init_type (objfile, TYPE_CODE_INT, bit, name); if (unsigned_p) TYPE_UNSIGNED (t) = 1; @@ -2807,7 +2808,7 @@ init_character_type (struct objfile *objfile, { struct type *t; - t = init_type (objfile, TYPE_CODE_CHAR, bit / TARGET_CHAR_BIT, name); + t = init_type (objfile, TYPE_CODE_CHAR, bit, name); if (unsigned_p) TYPE_UNSIGNED (t) = 1; @@ -2824,7 +2825,7 @@ init_boolean_type (struct objfile *objfile, { struct type *t; - t = init_type (objfile, TYPE_CODE_BOOL, bit / TARGET_CHAR_BIT, name); + t = init_type (objfile, TYPE_CODE_BOOL, bit, name); if (unsigned_p) TYPE_UNSIGNED (t) = 1; @@ -2844,7 +2845,7 @@ init_float_type (struct objfile *objfile, struct type *t; bit = verify_floatformat (bit, floatformats); - t = init_type (objfile, TYPE_CODE_FLT, bit / TARGET_CHAR_BIT, name); + t = init_type (objfile, TYPE_CODE_FLT, bit, name); TYPE_FLOATFORMAT (t) = floatformats; return t; @@ -2858,7 +2859,7 @@ init_decfloat_type (struct objfile *objfile, int bit, const char *name) { struct type *t; - t = init_type (objfile, TYPE_CODE_DECFLOAT, bit / TARGET_CHAR_BIT, name); + t = init_type (objfile, TYPE_CODE_DECFLOAT, bit, name); return t; } @@ -2872,7 +2873,7 @@ init_complex_type (struct objfile *objfile, struct type *t; t = init_type (objfile, TYPE_CODE_COMPLEX, - 2 * TYPE_LENGTH (target_type), name); + 2 * TYPE_LENGTH (target_type) * TARGET_CHAR_BIT, name); TYPE_TARGET_TYPE (t) = target_type; return t; } @@ -2888,7 +2889,7 @@ init_pointer_type (struct objfile *objfile, { struct type *t; - t = init_type (objfile, TYPE_CODE_PTR, bit / TARGET_CHAR_BIT, name); + t = init_type (objfile, TYPE_CODE_PTR, bit, name); TYPE_TARGET_TYPE (t) = target_type; TYPE_UNSIGNED (t) = 1; return t; @@ -4831,13 +4832,14 @@ copy_type (const struct type *type) struct type * arch_type (struct gdbarch *gdbarch, - enum type_code code, int length, const char *name) + enum type_code code, int bit, const char *name) { struct type *type; type = alloc_type_arch (gdbarch); set_type_code (type, code); - TYPE_LENGTH (type) = length; + gdb_assert ((bit % TARGET_CHAR_BIT) == 0); + TYPE_LENGTH (type) = bit / TARGET_CHAR_BIT; if (name) TYPE_NAME (type) = gdbarch_obstack_strdup (gdbarch, name); @@ -4855,7 +4857,7 @@ arch_integer_type (struct gdbarch *gdbarch, { struct type *t; - t = arch_type (gdbarch, TYPE_CODE_INT, bit / TARGET_CHAR_BIT, name); + t = arch_type (gdbarch, TYPE_CODE_INT, bit, name); if (unsigned_p) TYPE_UNSIGNED (t) = 1; @@ -4872,7 +4874,7 @@ arch_character_type (struct gdbarch *gdbarch, { struct type *t; - t = arch_type (gdbarch, TYPE_CODE_CHAR, bit / TARGET_CHAR_BIT, name); + t = arch_type (gdbarch, TYPE_CODE_CHAR, bit, name); if (unsigned_p) TYPE_UNSIGNED (t) = 1; @@ -4889,7 +4891,7 @@ arch_boolean_type (struct gdbarch *gdbarch, { struct type *t; - t = arch_type (gdbarch, TYPE_CODE_BOOL, bit / TARGET_CHAR_BIT, name); + t = arch_type (gdbarch, TYPE_CODE_BOOL, bit, name); if (unsigned_p) TYPE_UNSIGNED (t) = 1; @@ -4909,7 +4911,7 @@ arch_float_type (struct gdbarch *gdbarch, struct type *t; bit = verify_floatformat (bit, floatformats); - t = arch_type (gdbarch, TYPE_CODE_FLT, bit / TARGET_CHAR_BIT, name); + t = arch_type (gdbarch, TYPE_CODE_FLT, bit, name); TYPE_FLOATFORMAT (t) = floatformats; return t; @@ -4923,7 +4925,7 @@ arch_decfloat_type (struct gdbarch *gdbarch, int bit, const char *name) { struct type *t; - t = arch_type (gdbarch, TYPE_CODE_DECFLOAT, bit / TARGET_CHAR_BIT, name); + t = arch_type (gdbarch, TYPE_CODE_DECFLOAT, bit, name); return t; } @@ -4937,7 +4939,7 @@ arch_complex_type (struct gdbarch *gdbarch, struct type *t; t = arch_type (gdbarch, TYPE_CODE_COMPLEX, - 2 * TYPE_LENGTH (target_type), name); + 2 * TYPE_LENGTH (target_type) * TARGET_CHAR_BIT, name); TYPE_TARGET_TYPE (t) = target_type; return t; } @@ -4953,27 +4955,26 @@ arch_pointer_type (struct gdbarch *gdbarch, { struct type *t; - t = arch_type (gdbarch, TYPE_CODE_PTR, bit / TARGET_CHAR_BIT, name); + t = arch_type (gdbarch, TYPE_CODE_PTR, bit, name); TYPE_TARGET_TYPE (t) = target_type; TYPE_UNSIGNED (t) = 1; return t; } /* Allocate a TYPE_CODE_FLAGS type structure associated with GDBARCH. - NAME is the type name. LENGTH is the size of the flag word in bytes. */ + NAME is the type name. BIT is the size of the flag word in bits. */ struct type * -arch_flags_type (struct gdbarch *gdbarch, const char *name, int length) +arch_flags_type (struct gdbarch *gdbarch, const char *name, int bit) { - int max_nfields = length * TARGET_CHAR_BIT; struct type *type; - type = arch_type (gdbarch, TYPE_CODE_FLAGS, length, name); + type = arch_type (gdbarch, TYPE_CODE_FLAGS, bit, name); TYPE_UNSIGNED (type) = 1; TYPE_NFIELDS (type) = 0; /* Pre-allocate enough space assuming every field is one bit. */ TYPE_FIELDS (type) - = (struct field *) TYPE_ZALLOC (type, max_nfields * sizeof (struct field)); + = (struct field *) TYPE_ZALLOC (type, bit * sizeof (struct field)); return type; } @@ -5118,7 +5119,7 @@ gdbtypes_post_init (struct gdbarch *gdbarch) /* Basic types. */ builtin_type->builtin_void - = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void"); + = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); builtin_type->builtin_char = arch_integer_type (gdbarch, TARGET_CHAR_BIT, !gdbarch_char_signed (gdbarch), "char"); @@ -5169,9 +5170,9 @@ gdbtypes_post_init (struct gdbarch *gdbarch) = arch_complex_type (gdbarch, "double complex", builtin_type->builtin_double); builtin_type->builtin_string - = arch_type (gdbarch, TYPE_CODE_STRING, 1, "string"); + = arch_type (gdbarch, TYPE_CODE_STRING, TARGET_CHAR_BIT, "string"); builtin_type->builtin_bool - = arch_type (gdbarch, TYPE_CODE_BOOL, 1, "bool"); + = arch_type (gdbarch, TYPE_CODE_BOOL, TARGET_CHAR_BIT, "bool"); /* The following three are about decimal floating point types, which are 32-bits, 64-bits and 128-bits respectively. */ @@ -5268,7 +5269,7 @@ objfile_type (struct objfile *objfile) /* Basic types. */ objfile_type->builtin_void - = init_type (objfile, TYPE_CODE_VOID, 1, "void"); + = init_type (objfile, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); objfile_type->builtin_char = init_integer_type (objfile, TARGET_CHAR_BIT, !gdbarch_char_signed (gdbarch), "char"); @@ -5320,10 +5321,10 @@ objfile_type (struct objfile *objfile) /* The following set of types is used for symbols with no debug information. */ objfile_type->nodebug_text_symbol - = init_type (objfile, TYPE_CODE_FUNC, 1, + = init_type (objfile, TYPE_CODE_FUNC, TARGET_CHAR_BIT, "<text variable, no debug info>"); objfile_type->nodebug_text_gnu_ifunc_symbol - = init_type (objfile, TYPE_CODE_FUNC, 1, + = init_type (objfile, TYPE_CODE_FUNC, TARGET_CHAR_BIT, "<text gnu-indirect-function variable, no debug info>"); /* Ifunc resolvers return a function address. */ TYPE_TARGET_TYPE (objfile_type->nodebug_text_gnu_ifunc_symbol) diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 8d6fd9b..c96a328 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1683,7 +1683,7 @@ struct field *append_composite_type_field_raw (struct type *t, const char *name, type is created using arch_flag_type(). Flags are then added using append_flag_type_field() and append_flag_type_flag(). */ extern struct type *arch_flags_type (struct gdbarch *gdbarch, - const char *name, int length); + const char *name, int bit); extern void append_flags_type_field (struct type *type, int start_bitpos, int nr_bits, struct type *field_type, const char *name); diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index aad812b..2accc60 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -161,7 +161,7 @@ build_gdb_vtable_type (struct gdbarch *arch) /* We assumed in the allocation above that there were four fields. */ gdb_assert (field == (field_list + 4)); - t = arch_type (arch, TYPE_CODE_STRUCT, offset, NULL); + t = arch_type (arch, TYPE_CODE_STRUCT, offset * TARGET_CHAR_BIT, NULL); TYPE_NFIELDS (t) = field - field_list; TYPE_FIELDS (t) = field_list; TYPE_TAG_NAME (t) = "gdb_gnu_v3_abi_vtable"; @@ -1024,7 +1024,7 @@ build_std_type_info_type (struct gdbarch *arch) gdb_assert (field == (field_list + 2)); - t = arch_type (arch, TYPE_CODE_STRUCT, offset, NULL); + t = arch_type (arch, TYPE_CODE_STRUCT, offset * TARGET_CHAR_BIT, NULL); TYPE_NFIELDS (t) = field - field_list; TYPE_FIELDS (t) = field_list; TYPE_TAG_NAME (t) = "gdb_gnu_v3_type_info"; diff --git a/gdb/go-lang.c b/gdb/go-lang.c index 7441bb3..f66535e 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -621,7 +621,7 @@ build_go_types (struct gdbarch *gdbarch) = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct builtin_go_type); builtin_go_type->builtin_void - = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void"); + = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); builtin_go_type->builtin_char = arch_character_type (gdbarch, 8, 1, "char"); builtin_go_type->builtin_bool @@ -697,7 +697,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) struct symbol *block_name = allocate_symbol (objfile); struct type *block_type = arch_type (get_objfile_arch (objfile), TYPE_CODE_VOID, - 1, + TARGET_CHAR_BIT, "void"); BLOCK_DICT (new_block) = dict_create_linear (&objfile->objfile_obstack, diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 9ca1aca..5dd87b7 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -279,19 +279,20 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch, /* __pid_t */ pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - TYPE_LENGTH (int_type), "__pid_t"); + TYPE_LENGTH (int_type) * TARGET_CHAR_BIT, "__pid_t"); TYPE_TARGET_TYPE (pid_type) = int_type; TYPE_TARGET_STUB (pid_type) = 1; /* __uid_t */ uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - TYPE_LENGTH (uint_type), "__uid_t"); + TYPE_LENGTH (uint_type) * TARGET_CHAR_BIT, "__uid_t"); TYPE_TARGET_TYPE (uid_type) = uint_type; TYPE_TARGET_STUB (uid_type) = 1; /* __clock_t */ clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, - TYPE_LENGTH (long_type), "__clock_t"); + TYPE_LENGTH (long_type) * TARGET_CHAR_BIT, + "__clock_t"); TYPE_TARGET_TYPE (clock_type) = long_type; TYPE_TARGET_STUB (clock_type) = 1; diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 7359141..3a4dbda 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -190,7 +190,7 @@ make_types (struct gdbarch *arch) /* The builtin_type_mumble variables are sometimes uninitialized when this is called, so we avoid using them. */ - tdep->voyd = arch_type (arch, TYPE_CODE_VOID, 1, "void"); + tdep->voyd = arch_type (arch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); tdep->ptr_voyd = arch_pointer_type (arch, gdbarch_ptr_bit (arch), NULL, tdep->voyd); tdep->func_voyd = lookup_function_type (tdep->voyd); diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index afd8678..ce126a8 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -72,7 +72,7 @@ m68k_ps_type (struct gdbarch *gdbarch) { struct type *type; - type = arch_flags_type (gdbarch, "builtin_type_m68k_ps", 4); + type = arch_flags_type (gdbarch, "builtin_type_m68k_ps", 32); append_flags_type_flag (type, 0, "C"); append_flags_type_flag (type, 1, "V"); append_flags_type_flag (type, 2, "Z"); diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index d994216..13140e7 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1469,14 +1469,13 @@ basic_type (int bt, struct objfile *objfile) case btFloatDec: tp = init_type (objfile, TYPE_CODE_ERROR, - gdbarch_double_bit (gdbarch) / TARGET_CHAR_BIT, - "floating decimal"); + gdbarch_double_bit (gdbarch), "floating decimal"); break; case btString: /* Is a "string" the way btString means it the same as TYPE_CODE_STRING? FIXME. */ - tp = init_type (objfile, TYPE_CODE_STRING, 1, "string"); + tp = init_type (objfile, TYPE_CODE_STRING, TARGET_CHAR_BIT, "string"); break; case btVoid: diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index a9c9a34..6a72327 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -1171,7 +1171,7 @@ build_opencl_types (struct gdbarch *gdbarch) types[opencl_primitive_type_uintptr_t] = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "uintptr_t"); types[opencl_primitive_type_void] - = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void"); + = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); return types; } diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c index 56abe28..c3d5352 100644 --- a/gdb/rl78-tdep.c +++ b/gdb/rl78-tdep.c @@ -271,7 +271,7 @@ rl78_psw_type (struct gdbarch *gdbarch) if (tdep->rl78_psw_type == NULL) { tdep->rl78_psw_type = arch_flags_type (gdbarch, - "builtin_type_rl78_psw", 1); + "builtin_type_rl78_psw", 8); append_flags_type_flag (tdep->rl78_psw_type, 0, "CY"); append_flags_type_flag (tdep->rl78_psw_type, 1, "ISP0"); append_flags_type_flag (tdep->rl78_psw_type, 2, "ISP1"); @@ -1417,7 +1417,8 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->elf_flags = elf_flags; /* Initialize types. */ - tdep->rl78_void = arch_type (gdbarch, TYPE_CODE_VOID, 1, "void"); + tdep->rl78_void = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, + "void"); tdep->rl78_uint8 = arch_integer_type (gdbarch, 8, 1, "uint8_t"); tdep->rl78_int8 = arch_integer_type (gdbarch, 8, 0, "int8_t"); tdep->rl78_uint16 = arch_integer_type (gdbarch, 16, 1, "uint16_t"); diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c index d1bc0b2..ac2b68f 100644 --- a/gdb/rx-tdep.c +++ b/gdb/rx-tdep.c @@ -159,7 +159,7 @@ rx_psw_type (struct gdbarch *gdbarch) if (tdep->rx_psw_type == NULL) { - tdep->rx_psw_type = arch_flags_type (gdbarch, "rx_psw_type", 4); + tdep->rx_psw_type = arch_flags_type (gdbarch, "rx_psw_type", 32); append_flags_type_flag (tdep->rx_psw_type, 0, "C"); append_flags_type_flag (tdep->rx_psw_type, 1, "Z"); append_flags_type_flag (tdep->rx_psw_type, 2, "S"); @@ -184,7 +184,7 @@ rx_fpsw_type (struct gdbarch *gdbarch) if (tdep->rx_fpsw_type == NULL) { - tdep->rx_fpsw_type = arch_flags_type (gdbarch, "rx_fpsw_type", 4); + tdep->rx_fpsw_type = arch_flags_type (gdbarch, "rx_fpsw_type", 32); append_flags_type_flag (tdep->rx_fpsw_type, 0, "RM0"); append_flags_type_flag (tdep->rx_fpsw_type, 1, "RM1"); append_flags_type_flag (tdep->rx_fpsw_type, 2, "CV"); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 949c501..8bb69f5 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -410,7 +410,7 @@ sparc_psr_type (struct gdbarch *gdbarch) { struct type *type; - type = arch_flags_type (gdbarch, "builtin_type_sparc_psr", 4); + type = arch_flags_type (gdbarch, "builtin_type_sparc_psr", 32); append_flags_type_flag (type, 5, "ET"); append_flags_type_flag (type, 6, "PS"); append_flags_type_flag (type, 7, "S"); @@ -432,7 +432,7 @@ sparc_fsr_type (struct gdbarch *gdbarch) { struct type *type; - type = arch_flags_type (gdbarch, "builtin_type_sparc_fsr", 4); + type = arch_flags_type (gdbarch, "builtin_type_sparc_fsr", 32); append_flags_type_flag (type, 0, "NXA"); append_flags_type_flag (type, 1, "DZA"); append_flags_type_flag (type, 2, "UFA"); diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index a5ca434..8722f0a 100644 --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c @@ -666,7 +666,7 @@ sparc64_pstate_type (struct gdbarch *gdbarch) { struct type *type; - type = arch_flags_type (gdbarch, "builtin_type_sparc64_pstate", 8); + type = arch_flags_type (gdbarch, "builtin_type_sparc64_pstate", 64); append_flags_type_flag (type, 0, "AG"); append_flags_type_flag (type, 1, "IE"); append_flags_type_flag (type, 2, "PRIV"); @@ -693,7 +693,7 @@ sparc64_ccr_type (struct gdbarch *gdbarch) { struct type *type; - type = arch_flags_type (gdbarch, "builtin_type_sparc64_ccr", 8); + type = arch_flags_type (gdbarch, "builtin_type_sparc64_ccr", 64); append_flags_type_flag (type, 0, "icc.c"); append_flags_type_flag (type, 1, "icc.v"); append_flags_type_flag (type, 2, "icc.z"); @@ -718,7 +718,7 @@ sparc64_fsr_type (struct gdbarch *gdbarch) { struct type *type; - type = arch_flags_type (gdbarch, "builtin_type_sparc64_fsr", 8); + type = arch_flags_type (gdbarch, "builtin_type_sparc64_fsr", 64); append_flags_type_flag (type, 0, "NXC"); append_flags_type_flag (type, 1, "DZC"); append_flags_type_flag (type, 2, "UFC"); @@ -751,7 +751,7 @@ sparc64_fprs_type (struct gdbarch *gdbarch) { struct type *type; - type = arch_flags_type (gdbarch, "builtin_type_sparc64_fprs", 8); + type = arch_flags_type (gdbarch, "builtin_type_sparc64_fprs", 64); append_flags_type_flag (type, 0, "DL"); append_flags_type_flag (type, 1, "DU"); append_flags_type_flag (type, 2, "FEF"); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index d9a4d5e..c51b3c7 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -368,7 +368,7 @@ dbx_init_float_type (struct objfile *objfile, int bits) if (format) type = init_float_type (objfile, bits, NULL, format); else - type = init_type (objfile, TYPE_CODE_ERROR, bits / TARGET_CHAR_BIT, NULL); + type = init_type (objfile, TYPE_CODE_ERROR, bits, NULL); return type; } @@ -2153,7 +2153,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile) rettype = init_integer_type (objfile, 32, 1, "unsigned long"); break; case 11: - rettype = init_type (objfile, TYPE_CODE_VOID, 1, "void"); + rettype = init_type (objfile, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"); break; case 12: /* IEEE single precision (32 bit). */ @@ -3835,7 +3835,8 @@ read_sun_builtin_type (const char **pp, int typenums[2], struct objfile *objfile if (type_bits == 0) { - struct type *type = init_type (objfile, TYPE_CODE_VOID, 1, NULL); + struct type *type = init_type (objfile, TYPE_CODE_VOID, + TARGET_CHAR_BIT, NULL); if (unsigned_type) TYPE_UNSIGNED (type) = 1; return type; @@ -4147,7 +4148,7 @@ read_range_type (const char **pp, int typenums[2], int type_size, /* A type defined as a subrange of itself, with bounds both 0, is void. */ if (self_subrange && n2 == 0 && n3 == 0) - return init_type (objfile, TYPE_CODE_VOID, 1, NULL); + return init_type (objfile, TYPE_CODE_VOID, TARGET_CHAR_BIT, NULL); /* If n3 is zero and n2 is positive, we want a floating type, and n2 is the width in bytes. @@ -4193,7 +4194,8 @@ read_range_type (const char **pp, int typenums[2], int type_size, itself with range 0-127. */ else if (self_subrange && n2 == 0 && n3 == 127) { - struct type *type = init_integer_type (objfile, 1, 0, NULL); + struct type *type = init_integer_type (objfile, TARGET_CHAR_BIT, + 0, NULL); TYPE_NOSIGN (type) = 1; return type; } diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index 6858ee1..06cfbb5 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -1067,7 +1067,7 @@ tdesc_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *tdesc_type) int ix; type = arch_flags_type (gdbarch, tdesc_type->name, - tdesc_type->u.u.size); + tdesc_type->u.u.size * TARGET_CHAR_BIT); for (ix = 0; VEC_iterate (tdesc_type_field, tdesc_type->u.u.fields, ix, f); ix++) @@ -1090,7 +1090,8 @@ tdesc_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *tdesc_type) int ix; type = arch_type (gdbarch, TYPE_CODE_ENUM, - tdesc_type->u.u.size, tdesc_type->name); + tdesc_type->u.u.size * TARGET_CHAR_BIT, + tdesc_type->name); TYPE_UNSIGNED (type) = 1; for (ix = 0; VEC_iterate (tdesc_type_field, tdesc_type->u.u.fields, ix, f); diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 49402d3..98b6d2b 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -143,7 +143,8 @@ windows_get_tlb_type (struct gdbarch *gdbarch) TYPE_NAME (seh_type) = xstrdup ("seh"); seh_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, - TYPE_LENGTH (void_ptr_type), NULL); + TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT, + NULL); TYPE_TARGET_TYPE (seh_ptr_type) = seh_type; append_composite_type_field (seh_type, "next_seh", seh_ptr_type); @@ -163,7 +164,8 @@ windows_get_tlb_type (struct gdbarch *gdbarch) append_composite_type_field (peb_ldr_type, "entry_in_progress", void_ptr_type); peb_ldr_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, - TYPE_LENGTH (void_ptr_type), NULL); + TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT, + NULL); TYPE_TARGET_TYPE (peb_ldr_ptr_type) = peb_ldr_type; @@ -181,7 +183,8 @@ windows_get_tlb_type (struct gdbarch *gdbarch) append_composite_type_field (peb_type, "process_heap", void_ptr_type); append_composite_type_field (peb_type, "fast_peb_lock", void_ptr_type); peb_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, - TYPE_LENGTH (void_ptr_type), NULL); + TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT, + NULL); TYPE_TARGET_TYPE (peb_ptr_type) = peb_type; @@ -224,7 +227,8 @@ windows_get_tlb_type (struct gdbarch *gdbarch) append_composite_type_field (tib_type, "last_error_number", dword_ptr_type); tib_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, - TYPE_LENGTH (void_ptr_type), NULL); + TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT, + NULL); TYPE_TARGET_TYPE (tib_ptr_type) = tib_type; last_tlb_type = tib_ptr_type; |