aboutsummaryrefslogtreecommitdiff
path: root/gdb/stabsread.c
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2017-09-27 19:02:00 +0200
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2017-09-27 19:02:00 +0200
commit77b7c781e9f03cdd903dad76f47ea0bb25277b06 (patch)
treec54f3868fc8d2eb30ac9d5cae19789294fbc9f96 /gdb/stabsread.c
parent8e43602e34ba404d82f7c74f6629f01e40c740e0 (diff)
downloadgdb-77b7c781e9f03cdd903dad76f47ea0bb25277b06.zip
gdb-77b7c781e9f03cdd903dad76f47ea0bb25277b06.tar.gz
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/stabsread.c')
-rw-r--r--gdb/stabsread.c12
1 files changed, 7 insertions, 5 deletions
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;
}