From c1ceb89a91cb5a67f809eb1068543a8e391421fe Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Tue, 12 Jun 2007 15:33:04 +0000 Subject: [PATCH] 2007-06-12 Markus Deuling * gdbarch.sh (TARGET_SHORT_BIT): Replace by gdbarch_int_bit. * ada-lang.c (ada_create_fundamental_type) (ada_language_arch_info): Likewise. * c-lang.c (c_create_fundamental_type): Likewise. * f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise. * gdbtypes.c (build_gdbtypes, gdbtypes_post_init): Likewise. * m2-lang.c (m2_create_fundamental_type): Likewise. * objc-lang.c (objc_create_fundamental_type): Likewise. * p-lang.c (pascal_create_fundamental_type): Likewise. * gdbarch.sh (TARGET_INT_BIT): Replace by gdbarch_int_bit. * c-exp.y (parse_number): Likewise. * objc-exp.y (parse_number): Likewise. * ada-lex.l (processInt): Likewise. * f-exp.y (parse_number): Likewise. * p-exp.y (parse_number): Likewise. * ada-lang.c (ada_create_fundamental_type, ada_language_arch_info) (gdbtypes_post_init, build_gdbtypes): Likewise. * p-lang.c (pascal_create_fundamental_type): Likewise. * parse.c (build_parse): Likewise. * xcoffread.c (_initialize_xcoffread): Likewise. * stabsread.c (define_symbol, read_one_struct_field, read_enum_type) (read_range_type): Likewise. * objc-lang.c (objc_create_fundamental_type): Likewise. * f-lang.c (build_fortran_types, f_create_fundamental_type): Likewise. * m2-lang.c (m2_create_fundamental_type, _initialize_m2_language) (m2_create_fundamental_type): Likewise. * c-lang.c (c_create_fundamental_type): Likewise. * coffread.c (coff_read_enum_type): Likewise. * mdebugread.c (parse_symbol, _initialize_mdebugread): Likewise. * dwarf2read.c (new_symbol): Likewise. * gdbarch.sh (TARGET_LONG_BIT): Replace by gdbarch_long_bit. * c-exp.y (parse_number): Likewise. * objc-exp.y (parse_number): Likewise. * ada-lex.l (processInt): Likewise. * f-exp.y (parse_number): Likewise. * p-exp.y (parse_number): Likewise. * valarith.c (value_binop): Likewise. * symfile.c (read_target_long_array, simple_overlay_update_1): Likewise. * ada-lang.c (ada_create_fundamental_type) (ada_language_arch_info): Likewise. * gdbtypes.c (build_gdbtypes, gdbtypes_post_init): Likewise. * symfile.c (TARGET_LONG_BYTES): Likewise. * p-lang.c (pascal_create_fundamental_type): Likewise. * objc-lang.c (objc_create_fundamental_type): Likewise. * m2-lang.c (m2_create_fundamental_type): Likewise. * f-lang.c (f_create_fundamental_type): Likewise. * c-lang.c (c_create_fundamental_type): Likewise. * coffread.c (decode_base_type): Likewise. * gdbarch.sh (TARGET_LONG_LONG_BIT): Replace by gdbarch_long_long_bit. * c-exp.y (parse_number): Likewise. * objc-exp.y (parse_number): Likewise. * p-exp.y (parse_number): Likewise. * ada-lang.c (ada_create_fundamental_type) (ada_language_arch_info): Likewise. * gdbtypes.c (gdbtypes_post_init, build_gdbtypes): Likewise. * stabsread.c (read_range_type): Likewise. * p-lang.c (pascal_create_fundamental_type): Likewise. * objc-lang.c (objc_create_fundamental_type): Likewise. * m2-lang.c (m2_create_fundamental_type): Likewise. * f-lang.c (f_create_fundamental_type): Likewise. * c-lang.c (c_create_fundamental_type): Likewise. * gdbarch.c, gdbarch.h: Regenerate. --- gdb/ChangeLog | 65 +++++++++++++++++++++++++++++++++++++ gdb/ada-lang.c | 65 +++++++++++++++++++++---------------- gdb/ada-lex.l | 6 ++-- gdb/c-exp.y | 17 +++++----- gdb/c-lang.c | 29 +++++++++-------- gdb/coffread.c | 10 +++--- gdb/dwarf2read.c | 5 +-- gdb/f-exp.y | 11 ++++--- gdb/f-lang.c | 55 +++++++++++++++++--------------- gdb/gdbarch.c | 24 ++------------ gdb/gdbarch.h | 24 -------------- gdb/gdbarch.sh | 10 +++--- gdb/gdbtypes.c | 97 ++++++++++++++++++++++++++++---------------------------- gdb/m2-lang.c | 43 ++++++++++++++----------- gdb/mdebugread.c | 8 +++-- gdb/objc-exp.y | 14 ++++---- gdb/objc-lang.c | 29 +++++++++-------- gdb/p-exp.y | 17 +++++----- gdb/p-lang.c | 29 +++++++++-------- gdb/parse.c | 6 ++-- gdb/stabsread.c | 20 ++++++++---- gdb/symfile.c | 3 +- gdb/valarith.c | 4 +-- gdb/xcoffread.c | 3 +- 24 files changed, 330 insertions(+), 264 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cd4322bfad..8912582dde 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,68 @@ +2007-06-12 Markus Deuling + + * gdbarch.sh (TARGET_SHORT_BIT): Replace by gdbarch_int_bit. + * ada-lang.c (ada_create_fundamental_type) + (ada_language_arch_info): Likewise. + * c-lang.c (c_create_fundamental_type): Likewise. + * f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise. + * gdbtypes.c (build_gdbtypes, gdbtypes_post_init): Likewise. + * m2-lang.c (m2_create_fundamental_type): Likewise. + * objc-lang.c (objc_create_fundamental_type): Likewise. + * p-lang.c (pascal_create_fundamental_type): Likewise. + * gdbarch.sh (TARGET_INT_BIT): Replace by gdbarch_int_bit. + * c-exp.y (parse_number): Likewise. + * objc-exp.y (parse_number): Likewise. + * ada-lex.l (processInt): Likewise. + * f-exp.y (parse_number): Likewise. + * p-exp.y (parse_number): Likewise. + * ada-lang.c (ada_create_fundamental_type, ada_language_arch_info) + (gdbtypes_post_init, build_gdbtypes): Likewise. + * p-lang.c (pascal_create_fundamental_type): Likewise. + * parse.c (build_parse): Likewise. + * xcoffread.c (_initialize_xcoffread): Likewise. + * stabsread.c (define_symbol, read_one_struct_field, read_enum_type) + (read_range_type): Likewise. + * objc-lang.c (objc_create_fundamental_type): Likewise. + * f-lang.c (build_fortran_types, f_create_fundamental_type): Likewise. + * m2-lang.c (m2_create_fundamental_type, _initialize_m2_language) + (m2_create_fundamental_type): Likewise. + * c-lang.c (c_create_fundamental_type): Likewise. + * coffread.c (coff_read_enum_type): Likewise. + * mdebugread.c (parse_symbol, _initialize_mdebugread): Likewise. + * dwarf2read.c (new_symbol): Likewise. + * gdbarch.sh (TARGET_LONG_BIT): Replace by gdbarch_long_bit. + * c-exp.y (parse_number): Likewise. + * objc-exp.y (parse_number): Likewise. + * ada-lex.l (processInt): Likewise. + * f-exp.y (parse_number): Likewise. + * p-exp.y (parse_number): Likewise. + * valarith.c (value_binop): Likewise. + * symfile.c (read_target_long_array, simple_overlay_update_1): Likewise. + * ada-lang.c (ada_create_fundamental_type) + (ada_language_arch_info): Likewise. + * gdbtypes.c (build_gdbtypes, gdbtypes_post_init): Likewise. + * symfile.c (TARGET_LONG_BYTES): Likewise. + * p-lang.c (pascal_create_fundamental_type): Likewise. + * objc-lang.c (objc_create_fundamental_type): Likewise. + * m2-lang.c (m2_create_fundamental_type): Likewise. + * f-lang.c (f_create_fundamental_type): Likewise. + * c-lang.c (c_create_fundamental_type): Likewise. + * coffread.c (decode_base_type): Likewise. + * gdbarch.sh (TARGET_LONG_LONG_BIT): Replace by gdbarch_long_long_bit. + * c-exp.y (parse_number): Likewise. + * objc-exp.y (parse_number): Likewise. + * p-exp.y (parse_number): Likewise. + * ada-lang.c (ada_create_fundamental_type) + (ada_language_arch_info): Likewise. + * gdbtypes.c (gdbtypes_post_init, build_gdbtypes): Likewise. + * stabsread.c (read_range_type): Likewise. + * p-lang.c (pascal_create_fundamental_type): Likewise. + * objc-lang.c (objc_create_fundamental_type): Likewise. + * m2-lang.c (m2_create_fundamental_type): Likewise. + * f-lang.c (f_create_fundamental_type): Likewise. + * c-lang.c (c_create_fundamental_type): Likewise. + * gdbarch.c, gdbarch.h: Regenerate. + 2007-06-12 Andreas Schwab * frame-unwind.h (frame_dealloc_cache_ftype): Define. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index f79f727915..7f83bfe7a8 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -10198,7 +10198,7 @@ ada_create_fundamental_type (struct objfile *objfile, int typeid) name "". When all the dust settles from the type reconstruction work, this should probably become an error. */ type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "", objfile); warning (_("internal error: no Ada fundamental type %d"), typeid); break; @@ -10224,63 +10224,66 @@ ada_create_fundamental_type (struct objfile *objfile, int typeid) break; case FT_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "short_integer", objfile); break; case FT_SIGNED_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "short_integer", objfile); break; case FT_UNSIGNED_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned short", objfile); break; case FT_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "integer", objfile); break; case FT_SIGNED_INTEGER: - type = init_type (TYPE_CODE_INT, TARGET_INT_BIT / - TARGET_CHAR_BIT, + type = init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "integer", objfile); /* FIXME -fnf */ break; case FT_UNSIGNED_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned int", objfile); break; case FT_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long_integer", objfile); break; case FT_SIGNED_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long_integer", objfile); break; case FT_UNSIGNED_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned long", objfile); break; case FT_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, - 0, "long_long_integer", objfile); + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, + 0, "long_long_integer", objfile); break; case FT_SIGNED_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, - 0, "long_long_integer", objfile); + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, + 0, "long_long_integer", objfile); break; case FT_UNSIGNED_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); break; case FT_FLOAT: type = init_type (TYPE_CODE_FLT, @@ -10326,14 +10329,17 @@ ada_language_arch_info (struct gdbarch *current_gdbarch, = GDBARCH_OBSTACK_CALLOC (current_gdbarch, nr_ada_primitive_types + 1, struct type *); lai->primitive_type_vector [ada_primitive_type_int] = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, - 0, "integer", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "integer", (struct objfile *) NULL); lai->primitive_type_vector [ada_primitive_type_long] = - init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT, - 0, "long_integer", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "long_integer", (struct objfile *) NULL); lai->primitive_type_vector [ada_primitive_type_short] = - init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT, - 0, "short_integer", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "short_integer", (struct objfile *) NULL); lai->string_char_type = lai->primitive_type_vector [ada_primitive_type_char] = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, @@ -10345,17 +10351,20 @@ ada_language_arch_info (struct gdbarch *current_gdbarch, init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, 0, "long_float", (struct objfile *) NULL); lai->primitive_type_vector [ada_primitive_type_long_long] = - init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_INT, + gdbarch_long_long_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long_long_integer", (struct objfile *) NULL); lai->primitive_type_vector [ada_primitive_type_long_double] = init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, 0, "long_long_float", (struct objfile *) NULL); lai->primitive_type_vector [ada_primitive_type_natural] = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, - 0, "natural", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "natural", (struct objfile *) NULL); lai->primitive_type_vector [ada_primitive_type_positive] = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, - 0, "positive", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "positive", (struct objfile *) NULL); lai->primitive_type_vector [ada_primitive_type_void] = builtin->builtin_void; lai->primitive_type_vector [ada_primitive_type_system_address] = diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l index 45def66354..a52f505427 100644 --- a/gdb/ada-lex.l +++ b/gdb/ada-lex.l @@ -341,11 +341,11 @@ processInt (const char *base0, const char *num0, const char *exp0) exp -= 1; } - if ((result >> (TARGET_INT_BIT-1)) == 0) + if ((result >> (gdbarch_int_bit (current_gdbarch)-1)) == 0) yylval.typed_val.type = type_int (); - else if ((result >> (TARGET_LONG_BIT-1)) == 0) + else if ((result >> (gdbarch_long_bit (current_gdbarch)-1)) == 0) yylval.typed_val.type = type_long (); - else if (((result >> (TARGET_LONG_BIT-1)) >> 1) == 0) + else if (((result >> (gdbarch_long_bit (current_gdbarch)-1)) >> 1) == 0) { /* We have a number representable as an unsigned integer quantity. For consistency with the C treatment, we will treat it as an diff --git a/gdb/c-exp.y b/gdb/c-exp.y index fde097dba3..b67c7e1a8d 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1194,16 +1194,16 @@ parse_number (p, len, parsed_float, putithere) shift it right and see whether anything remains. Note that we can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one operation, because many compilers will warn about such a shift - (which always produces a zero result). Sometimes TARGET_INT_BIT - or TARGET_LONG_BIT will be that big, sometimes not. To deal with + (which always produces a zero result). Sometimes gdbarch_int_bit + or gdbarch_long_bit will be that big, sometimes not. To deal with the case where it is we just always shift the value more than once, with fewer bits each time. */ un = (ULONGEST)n >> 2; if (long_p == 0 - && (un >> (TARGET_INT_BIT - 2)) == 0) + && (un >> (gdbarch_int_bit (current_gdbarch) - 2)) == 0) { - high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1); + high_bit = ((ULONGEST)1) << (gdbarch_int_bit (current_gdbarch) - 1); /* A large decimal (not hex or octal) constant (between INT_MAX and UINT_MAX) is a long or unsigned long, according to ANSI, @@ -1215,20 +1215,21 @@ parse_number (p, len, parsed_float, putithere) signed_type = builtin_type (current_gdbarch)->builtin_int; } else if (long_p <= 1 - && (un >> (TARGET_LONG_BIT - 2)) == 0) + && (un >> (gdbarch_long_bit (current_gdbarch) - 2)) == 0) { - high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1); + high_bit = ((ULONGEST)1) << (gdbarch_long_bit (current_gdbarch) - 1); unsigned_type = builtin_type (current_gdbarch)->builtin_unsigned_long; signed_type = builtin_type (current_gdbarch)->builtin_long; } else { int shift; - if (sizeof (ULONGEST) * HOST_CHAR_BIT < TARGET_LONG_LONG_BIT) + if (sizeof (ULONGEST) * HOST_CHAR_BIT + < gdbarch_long_long_bit (current_gdbarch)) /* A long long does not fit in a LONGEST. */ shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1); else - shift = (TARGET_LONG_LONG_BIT - 1); + shift = (gdbarch_long_long_bit (current_gdbarch) - 1); high_bit = (ULONGEST) 1 << shift; unsigned_type = builtin_type (current_gdbarch)->builtin_unsigned_long_long; signed_type = builtin_type (current_gdbarch)->builtin_long_long; diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 52b2a36b22..8dac4f5052 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -219,7 +219,7 @@ c_create_fundamental_type (struct objfile *objfile, int typeid) name "". When all the dust settles from the type reconstruction work, this should probably become an error. */ type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "", objfile); warning (_("internal error: no C/C++ fundamental type %d"), typeid); break; @@ -250,62 +250,65 @@ c_create_fundamental_type (struct objfile *objfile, int typeid) break; case FT_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "short", objfile); break; case FT_SIGNED_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "short", objfile); /* FIXME-fnf */ break; case FT_UNSIGNED_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned short", objfile); break; case FT_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "int", objfile); break; case FT_SIGNED_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "int", objfile); /* FIXME -fnf */ break; case FT_UNSIGNED_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned int", objfile); break; case FT_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long", objfile); break; case FT_SIGNED_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long", objfile); /* FIXME -fnf */ break; case FT_UNSIGNED_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned long", objfile); break; case FT_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "long long", objfile); break; case FT_SIGNED_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "signed long long", objfile); break; case FT_UNSIGNED_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); break; case FT_FLOAT: diff --git a/gdb/coffread.c b/gdb/coffread.c index a9be6f6914..5b4e52a31b 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1809,7 +1809,8 @@ decode_base_type (struct coff_symbol *cs, unsigned int c_type, case T_LONG: if (cs->c_sclass == C_FIELD - && aux->x_sym.x_misc.x_lnsz.x_size > TARGET_LONG_BIT) + && aux->x_sym.x_misc.x_lnsz.x_size + > gdbarch_long_bit (current_gdbarch)) return lookup_fundamental_type (current_objfile, FT_LONG_LONG); else return lookup_fundamental_type (current_objfile, FT_LONG); @@ -1909,7 +1910,8 @@ decode_base_type (struct coff_symbol *cs, unsigned int c_type, case T_ULONG: if (cs->c_sclass == C_FIELD - && aux->x_sym.x_misc.x_lnsz.x_size > TARGET_LONG_BIT) + && aux->x_sym.x_misc.x_lnsz.x_size + > gdbarch_long_bit (current_gdbarch)) return lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG_LONG); else return lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG); @@ -2082,8 +2084,8 @@ coff_read_enum_type (int index, int length, int lastsym) if (length > 0) TYPE_LENGTH (type) = length; - else - TYPE_LENGTH (type) = TARGET_INT_BIT / TARGET_CHAR_BIT; /* Assume ints */ + else /* Assume ints. */ + TYPE_LENGTH (type) = gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT; TYPE_CODE (type) = TYPE_CODE_ENUM; TYPE_NFIELDS (type) = nsyms; TYPE_FIELDS (type) = (struct field *) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 2a33b9e581..42e50cf18c 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -7153,8 +7153,9 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) to something sensible. */ if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_VOID) SYMBOL_TYPE (sym) = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / HOST_CHAR_BIT, 0, - "", + gdbarch_int_bit (current_gdbarch) + / HOST_CHAR_BIT, + 0, "", objfile); attr = dwarf2_attr (die, DW_AT_const_value, cu); if (attr) diff --git a/gdb/f-exp.y b/gdb/f-exp.y index f87937373a..b03ca375e0 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -766,23 +766,24 @@ parse_number (p, len, parsed_float, putithere) target int size is different to the target long size. In the expression below, we could have tested - (n >> TARGET_INT_BIT) + (n >> gdbarch_int_bit (current_gdbarch)) to see if it was zero, but too many compilers warn about that, when ints and longs are the same size. So we shift it twice, with fewer bits each time, for the same result. */ - if ((TARGET_INT_BIT != TARGET_LONG_BIT - && ((n >> 2) >> (TARGET_INT_BIT-2))) /* Avoid shift warning */ + if ((gdbarch_int_bit (current_gdbarch) != gdbarch_long_bit (current_gdbarch) + && ((n >> 2) + >> (gdbarch_int_bit (current_gdbarch)-2))) /* Avoid shift warning */ || long_p) { - high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1); + high_bit = ((ULONGEST)1) << (gdbarch_long_bit (current_gdbarch)-1); unsigned_type = builtin_type_unsigned_long; signed_type = builtin_type_long; } else { - high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1); + high_bit = ((ULONGEST)1) << (gdbarch_int_bit (current_gdbarch)-1); unsigned_type = builtin_type_unsigned_int; signed_type = builtin_type_int; } diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 46fb39cfa9..76c5ec67c0 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -285,67 +285,70 @@ f_create_fundamental_type (struct objfile *objfile, int typeid) break; case FT_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "integer*2", objfile); break; case FT_SIGNED_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "short", objfile); /* FIXME-fnf */ break; case FT_UNSIGNED_SHORT: type = init_type (TYPE_CODE_BOOL, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "logical*2", objfile); break; case FT_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "integer*4", objfile); break; case FT_SIGNED_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "integer", objfile); /* FIXME -fnf */ break; case FT_UNSIGNED_INTEGER: type = init_type (TYPE_CODE_BOOL, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "logical*4", objfile); break; case FT_FIXED_DECIMAL: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "fixed decimal", objfile); break; case FT_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long", objfile); break; case FT_SIGNED_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long", objfile); /* FIXME -fnf */ break; case FT_UNSIGNED_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned long", objfile); break; case FT_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "long long", objfile); break; case FT_SIGNED_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "signed long long", objfile); break; case FT_UNSIGNED_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); break; case FT_FLOAT: @@ -392,7 +395,7 @@ f_create_fundamental_type (struct objfile *objfile, int typeid) name "". When all the dust settles from the type reconstruction work, this should probably become an error. */ type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "", objfile); warning (_("internal error: no F77 fundamental type %d"), typeid); break; @@ -508,24 +511,24 @@ build_fortran_types (void) "logical*1", (struct objfile *) NULL); builtin_type_f_integer_s2 = - init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT, - 0, - "integer*2", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "integer*2", (struct objfile *) NULL); builtin_type_f_logical_s2 = - init_type (TYPE_CODE_BOOL, TARGET_SHORT_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, - "logical*2", (struct objfile *) NULL); + init_type (TYPE_CODE_BOOL, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "logical*2", (struct objfile *) NULL); builtin_type_f_integer = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, - 0, - "integer", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "integer", (struct objfile *) NULL); builtin_type_f_logical = - init_type (TYPE_CODE_BOOL, TARGET_INT_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, - "logical*4", (struct objfile *) NULL); + init_type (TYPE_CODE_BOOL, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "logical*4", (struct objfile *) NULL); builtin_type_f_real = init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT, diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index f20b5bc632..810e93a96f 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -401,11 +401,11 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->short_bit = 2*TARGET_CHAR_BIT; current_gdbarch->int_bit = 4*TARGET_CHAR_BIT; current_gdbarch->long_bit = 4*TARGET_CHAR_BIT; - current_gdbarch->long_long_bit = 2*TARGET_LONG_BIT; + current_gdbarch->long_long_bit = 2*current_gdbarch->long_bit; current_gdbarch->float_bit = 4*TARGET_CHAR_BIT; current_gdbarch->double_bit = 8*TARGET_CHAR_BIT; current_gdbarch->long_double_bit = 8*TARGET_CHAR_BIT; - current_gdbarch->ptr_bit = TARGET_INT_BIT; + current_gdbarch->ptr_bit = current_gdbarch->int_bit; current_gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address; current_gdbarch->char_signed = -1; current_gdbarch->write_pc = generic_target_write_pc; @@ -977,11 +977,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: inner_than = <0x%lx>\n", (long) current_gdbarch->inner_than); -#ifdef TARGET_INT_BIT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_INT_BIT # %s\n", - XSTRING (TARGET_INT_BIT)); -#endif fprintf_unfiltered (file, "gdbarch_dump: int_bit = %s\n", paddr_d (current_gdbarch->int_bit)); @@ -991,11 +986,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: integer_to_address = <0x%lx>\n", (long) current_gdbarch->integer_to_address); -#ifdef TARGET_LONG_BIT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_LONG_BIT # %s\n", - XSTRING (TARGET_LONG_BIT)); -#endif fprintf_unfiltered (file, "gdbarch_dump: long_bit = %s\n", paddr_d (current_gdbarch->long_bit)); @@ -1015,11 +1005,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: long_double_format = %s\n", pformat (current_gdbarch->long_double_format)); -#ifdef TARGET_LONG_LONG_BIT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_LONG_LONG_BIT # %s\n", - XSTRING (TARGET_LONG_LONG_BIT)); -#endif fprintf_unfiltered (file, "gdbarch_dump: long_long_bit = %s\n", paddr_d (current_gdbarch->long_long_bit)); @@ -1194,11 +1179,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: sdb_reg_to_regnum = <0x%lx>\n", (long) current_gdbarch->sdb_reg_to_regnum); -#ifdef TARGET_SHORT_BIT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_SHORT_BIT # %s\n", - XSTRING (TARGET_SHORT_BIT)); -#endif fprintf_unfiltered (file, "gdbarch_dump: short_bit = %s\n", paddr_d (current_gdbarch->short_bit)); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 21f26025d5..97805c99ed 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -87,46 +87,22 @@ extern const struct target_desc * gdbarch_target_desc (struct gdbarch *gdbarch); extern int gdbarch_short_bit (struct gdbarch *gdbarch); extern void set_gdbarch_short_bit (struct gdbarch *gdbarch, int short_bit); -#if !defined (GDB_TM_FILE) && defined (TARGET_SHORT_BIT) -#error "Non multi-arch definition of TARGET_SHORT_BIT" -#endif -#if !defined (TARGET_SHORT_BIT) -#define TARGET_SHORT_BIT (gdbarch_short_bit (current_gdbarch)) -#endif /* Number of bits in an int or unsigned int for the target machine. */ extern int gdbarch_int_bit (struct gdbarch *gdbarch); extern void set_gdbarch_int_bit (struct gdbarch *gdbarch, int int_bit); -#if !defined (GDB_TM_FILE) && defined (TARGET_INT_BIT) -#error "Non multi-arch definition of TARGET_INT_BIT" -#endif -#if !defined (TARGET_INT_BIT) -#define TARGET_INT_BIT (gdbarch_int_bit (current_gdbarch)) -#endif /* Number of bits in a long or unsigned long for the target machine. */ extern int gdbarch_long_bit (struct gdbarch *gdbarch); extern void set_gdbarch_long_bit (struct gdbarch *gdbarch, int long_bit); -#if !defined (GDB_TM_FILE) && defined (TARGET_LONG_BIT) -#error "Non multi-arch definition of TARGET_LONG_BIT" -#endif -#if !defined (TARGET_LONG_BIT) -#define TARGET_LONG_BIT (gdbarch_long_bit (current_gdbarch)) -#endif /* Number of bits in a long long or unsigned long long for the target machine. */ extern int gdbarch_long_long_bit (struct gdbarch *gdbarch); extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bit); -#if !defined (GDB_TM_FILE) && defined (TARGET_LONG_LONG_BIT) -#error "Non multi-arch definition of TARGET_LONG_LONG_BIT" -#endif -#if !defined (TARGET_LONG_LONG_BIT) -#define TARGET_LONG_LONG_BIT (gdbarch_long_long_bit (current_gdbarch)) -#endif /* The ABI default bit-size and format for "float", "double", and "long double". These bit/format pairs should eventually be combined into diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index b729c6b97f..7595a96c57 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -379,14 +379,14 @@ i::const struct target_desc *:target_desc:::::::paddr_d ((long) current_gdbarch- # v:TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0: # # Number of bits in a short or unsigned short for the target machine. -v:TARGET_SHORT_BIT:int:short_bit:::8 * sizeof (short):2*TARGET_CHAR_BIT::0 +v::int:short_bit:::8 * sizeof (short):2*TARGET_CHAR_BIT::0 # Number of bits in an int or unsigned int for the target machine. -v:TARGET_INT_BIT:int:int_bit:::8 * sizeof (int):4*TARGET_CHAR_BIT::0 +v::int:int_bit:::8 * sizeof (int):4*TARGET_CHAR_BIT::0 # Number of bits in a long or unsigned long for the target machine. -v:TARGET_LONG_BIT:int:long_bit:::8 * sizeof (long):4*TARGET_CHAR_BIT::0 +v::int:long_bit:::8 * sizeof (long):4*TARGET_CHAR_BIT::0 # Number of bits in a long long or unsigned long long for the target # machine. -v:TARGET_LONG_LONG_BIT:int:long_long_bit:::8 * sizeof (LONGEST):2*TARGET_LONG_BIT::0 +v::int:long_long_bit:::8 * sizeof (LONGEST):2*current_gdbarch->long_bit::0 # The ABI default bit-size and format for "float", "double", and "long # double". These bit/format pairs should eventually be combined into @@ -411,7 +411,7 @@ v:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat **:long_double_format:::::f # as well. # # ptr_bit is the size of a pointer on the target -v:TARGET_PTR_BIT:int:ptr_bit:::8 * sizeof (void*):TARGET_INT_BIT::0 +v:TARGET_PTR_BIT:int:ptr_bit:::8 * sizeof (void*):current_gdbarch->int_bit::0 # addr_bit is the size of a target address as represented in gdb v:TARGET_ADDR_BIT:int:addr_bit:::8 * sizeof (void*):0:TARGET_PTR_BIT: # Number of bits in a BFD_VMA for the target object file format. diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 9ea7b633fa..92d5a39a84 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3434,38 +3434,38 @@ build_gdbtypes (void) TYPE_FLAG_UNSIGNED, "unsigned char", (struct objfile *) NULL); builtin_type_short = - init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT, - 0, - "short", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "short", (struct objfile *) NULL); builtin_type_unsigned_short = - init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, - "unsigned short", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned short", (struct objfile *) NULL); builtin_type_int = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, - 0, - "int", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "int", (struct objfile *) NULL); builtin_type_unsigned_int = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, - "unsigned int", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned int", (struct objfile *) NULL); builtin_type_long = - init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT, - 0, - "long", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "long", (struct objfile *) NULL); builtin_type_unsigned_long = - init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, - "unsigned long", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned long", (struct objfile *) NULL); builtin_type_long_long = - init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, - 0, - "long long", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_long_long_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "long long", (struct objfile *) NULL); builtin_type_unsigned_long_long = - init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, + init_type (TYPE_CODE_INT, + gdbarch_long_long_bit (current_gdbarch) / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned long long", (struct objfile *) NULL); - builtin_type_float = build_flt (TARGET_FLOAT_BIT, "float", TARGET_FLOAT_FORMAT); builtin_type_double = build_flt (TARGET_DOUBLE_BIT, "double", @@ -3629,37 +3629,38 @@ gdbtypes_post_init (struct gdbarch *gdbarch) TYPE_FLAG_UNSIGNED, "unsigned char", (struct objfile *) NULL); builtin_type->builtin_short = - init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT, - 0, - "short", (struct objfile *) NULL); + init_type + (TYPE_CODE_INT, gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "short", (struct objfile *) NULL); builtin_type->builtin_unsigned_short = - init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, - "unsigned short", (struct objfile *) NULL); + init_type + (TYPE_CODE_INT, gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned short", (struct objfile *) NULL); builtin_type->builtin_int = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, - 0, - "int", (struct objfile *) NULL); + init_type + (TYPE_CODE_INT, gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "int", (struct objfile *) NULL); builtin_type->builtin_unsigned_int = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, - "unsigned int", (struct objfile *) NULL); + init_type + (TYPE_CODE_INT, gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned int", (struct objfile *) NULL); builtin_type->builtin_long = - init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT, - 0, - "long", (struct objfile *) NULL); + init_type + (TYPE_CODE_INT, gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "long", (struct objfile *) NULL); builtin_type->builtin_unsigned_long = - init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, - "unsigned long", (struct objfile *) NULL); + init_type + (TYPE_CODE_INT, gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned long", (struct objfile *) NULL); builtin_type->builtin_long_long = - init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, - 0, - "long long", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_long_long_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "long long", (struct objfile *) NULL); builtin_type->builtin_unsigned_long_long = - init_type (TYPE_CODE_INT, TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, - TYPE_FLAG_UNSIGNED, - "unsigned long long", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_long_long_bit (current_gdbarch) / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "unsigned long long", + (struct objfile *) NULL); builtin_type->builtin_float = build_flt (gdbarch_float_bit (gdbarch), "float", gdbarch_float_format (gdbarch)); diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 0f4b66aaae..8aa66c6721 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -206,7 +206,7 @@ m2_create_fundamental_type (struct objfile *objfile, int typeid) name "". When all the dust settles from the type reconstruction work, this should probably become an error. */ type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "", objfile); warning (_("internal error: no Modula fundamental type %d"), typeid); break; @@ -242,67 +242,70 @@ m2_create_fundamental_type (struct objfile *objfile, int typeid) break; case FT_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "short", objfile); break; case FT_SIGNED_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "short", objfile); /* FIXME-fnf */ break; case FT_UNSIGNED_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned short", objfile); break; case FT_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "int", objfile); break; case FT_SIGNED_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "int", objfile); /* FIXME -fnf */ break; case FT_UNSIGNED_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned int", objfile); break; case FT_FIXED_DECIMAL: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "fixed decimal", objfile); break; case FT_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long", objfile); break; case FT_SIGNED_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long", objfile); /* FIXME -fnf */ break; case FT_UNSIGNED_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned long", objfile); break; case FT_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "long long", objfile); break; case FT_SIGNED_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "signed long long", objfile); break; case FT_UNSIGNED_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); break; case FT_FLOAT: @@ -448,11 +451,12 @@ _initialize_m2_language (void) { /* Modula-2 "pervasive" types. NOTE: these can be redefined!!! */ builtin_type_m2_int = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, - 0, - "INTEGER", (struct objfile *) NULL); + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "INTEGER", (struct objfile *) NULL); builtin_type_m2_card = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "CARDINAL", (struct objfile *) NULL); builtin_type_m2_real = @@ -464,7 +468,8 @@ _initialize_m2_language (void) TYPE_FLAG_UNSIGNED, "CHAR", (struct objfile *) NULL); builtin_type_m2_bool = - init_type (TYPE_CODE_BOOL, TARGET_INT_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_BOOL, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "BOOLEAN", (struct objfile *) NULL); diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index c4b6877e75..29bf29afa6 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1046,7 +1046,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, that too. */ if (TYPE_LENGTH (t) == TYPE_NFIELDS (t) || TYPE_LENGTH (t) == 0) - TYPE_LENGTH (t) = TARGET_INT_BIT / HOST_CHAR_BIT; + TYPE_LENGTH (t) = + gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT; for (ext_tsym = ext_sh + external_sym_size; ; ext_tsym += external_sym_size) @@ -4871,7 +4872,7 @@ _initialize_mdebugread (void) TYPE_CODE_ERROR print things in hex if it knows the size? */ mdebug_type_fixed_dec = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "fixed decimal", (struct objfile *) NULL); @@ -4885,6 +4886,7 @@ _initialize_mdebugread (void) "", NULL); TYPE_TARGET_TYPE (nodebug_func_symbol_type) = mdebug_type_int; nodebug_var_symbol_type = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0, + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT, 0, "", NULL); } diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y index 5f6095b091..d12a6c28f2 100644 --- a/gdb/objc-exp.y +++ b/gdb/objc-exp.y @@ -1134,16 +1134,16 @@ parse_number (p, len, parsed_float, putithere) shift it right and see whether anything remains. Note that we can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one operation, because many compilers will warn about such a shift - (which always produces a zero result). Sometimes TARGET_INT_BIT - or TARGET_LONG_BIT will be that big, sometimes not. To deal with + (which always produces a zero result). Sometimes gdbarch_int_bit + or gdbarch_long_int will be that big, sometimes not. To deal with the case where it is we just always shift the value more than once, with fewer bits each time. */ un = (unsigned LONGEST)n >> 2; if (long_p == 0 - && (un >> (TARGET_INT_BIT - 2)) == 0) + && (un >> (gdbarch_int_bit (current_gdbarch) - 2)) == 0) { - high_bit = ((unsigned LONGEST)1) << (TARGET_INT_BIT-1); + high_bit = ((unsigned LONGEST)1) << (gdbarch_int_bit (current_gdbarch) - 1); /* A large decimal (not hex or octal) constant (between INT_MAX and UINT_MAX) is a long or unsigned long, according to ANSI, @@ -1155,16 +1155,16 @@ parse_number (p, len, parsed_float, putithere) signed_type = builtin_type_int; } else if (long_p <= 1 - && (un >> (TARGET_LONG_BIT - 2)) == 0) + && (un >> (gdbarch_long_bit (current_gdbarch) - 2)) == 0) { - high_bit = ((unsigned LONGEST)1) << (TARGET_LONG_BIT-1); + high_bit = ((unsigned LONGEST)1) << (gdbarch_long_bit (current_gdbarch) - 1); unsigned_type = builtin_type_unsigned_long; signed_type = builtin_type_long; } else { high_bit = (((unsigned LONGEST)1) - << (TARGET_LONG_LONG_BIT - 32 - 1) + << (gdbarch_long_long_bit (current_gdbarch) - 32 - 1) << 16 << 16); if (high_bit == 0) diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 261e818c1e..53c2f38137 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -461,7 +461,7 @@ objc_create_fundamental_type (struct objfile *objfile, int typeid) the type reconstruction work, this should probably become an error. */ type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "", objfile); warning (_("internal error: no C/C++ fundamental type %d"), typeid); break; @@ -487,62 +487,65 @@ objc_create_fundamental_type (struct objfile *objfile, int typeid) break; case FT_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "short", objfile); break; case FT_SIGNED_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "short", objfile); /* FIXME-fnf */ break; case FT_UNSIGNED_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned short", objfile); break; case FT_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "int", objfile); break; case FT_SIGNED_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "int", objfile); /* FIXME -fnf */ break; case FT_UNSIGNED_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned int", objfile); break; case FT_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long", objfile); break; case FT_SIGNED_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long", objfile); /* FIXME -fnf */ break; case FT_UNSIGNED_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned long", objfile); break; case FT_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "long long", objfile); break; case FT_SIGNED_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "signed long long", objfile); break; case FT_UNSIGNED_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit (current_gdbarch) + / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); break; case FT_FLOAT: diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 68e1a15e9e..683444132c 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -909,16 +909,16 @@ parse_number (p, len, parsed_float, putithere) shift it right and see whether anything remains. Note that we can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one operation, because many compilers will warn about such a shift - (which always produces a zero result). Sometimes TARGET_INT_BIT - or TARGET_LONG_BIT will be that big, sometimes not. To deal with + (which always produces a zero result). Sometimes gdbarch_int_bit + or gdbarch_long_bit will be that big, sometimes not. To deal with the case where it is we just always shift the value more than once, with fewer bits each time. */ un = (ULONGEST)n >> 2; if (long_p == 0 - && (un >> (TARGET_INT_BIT - 2)) == 0) + && (un >> (gdbarch_int_bit (current_gdbarch) - 2)) == 0) { - high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1); + high_bit = ((ULONGEST)1) << (gdbarch_int_bit (current_gdbarch) - 1); /* A large decimal (not hex or octal) constant (between INT_MAX and UINT_MAX) is a long or unsigned long, according to ANSI, @@ -930,20 +930,21 @@ parse_number (p, len, parsed_float, putithere) signed_type = builtin_type_int; } else if (long_p <= 1 - && (un >> (TARGET_LONG_BIT - 2)) == 0) + && (un >> (gdbarch_long_bit (current_gdbarch) - 2)) == 0) { - high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1); + high_bit = ((ULONGEST)1) << (gdbarch_long_bit (current_gdbarch) - 1); unsigned_type = builtin_type_unsigned_long; signed_type = builtin_type_long; } else { int shift; - if (sizeof (ULONGEST) * HOST_CHAR_BIT < TARGET_LONG_LONG_BIT) + if (sizeof (ULONGEST) * HOST_CHAR_BIT + < gdbarch_long_long_bit (current_gdbarch)) /* A long long does not fit in a LONGEST. */ shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1); else - shift = (TARGET_LONG_LONG_BIT - 1); + shift = (gdbarch_long_long_bit (current_gdbarch) - 1); high_bit = (ULONGEST) 1 << shift; unsigned_type = builtin_type_unsigned_long_long; signed_type = builtin_type_long_long; diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 767718c66e..d4acd263a4 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -287,7 +287,7 @@ pascal_create_fundamental_type (struct objfile *objfile, int typeid) name "". When all the dust settles from the type reconstruction work, this should probably become an error. */ type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "", objfile); warning (_("internal error: no Pascal fundamental type %d"), typeid); break; @@ -313,62 +313,65 @@ pascal_create_fundamental_type (struct objfile *objfile, int typeid) break; case FT_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "integer", objfile); break; case FT_SIGNED_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "integer", objfile); /* FIXME-fnf */ break; case FT_UNSIGNED_SHORT: type = init_type (TYPE_CODE_INT, - TARGET_SHORT_BIT / TARGET_CHAR_BIT, + gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "word", objfile); break; case FT_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "longint", objfile); break; case FT_SIGNED_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "longint", objfile); /* FIXME -fnf */ break; case FT_UNSIGNED_INTEGER: type = init_type (TYPE_CODE_INT, - TARGET_INT_BIT / TARGET_CHAR_BIT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "cardinal", objfile); break; case FT_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long", objfile); break; case FT_SIGNED_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long", objfile); /* FIXME -fnf */ break; case FT_UNSIGNED_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned long", objfile); break; case FT_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit + (current_gdbarch) / TARGET_CHAR_BIT, 0, "long long", objfile); break; case FT_SIGNED_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit + (current_gdbarch) / TARGET_CHAR_BIT, 0, "signed long long", objfile); break; case FT_UNSIGNED_LONG_LONG: type = init_type (TYPE_CODE_INT, - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT, + gdbarch_long_long_bit + (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned long long", objfile); break; case FT_FLOAT: diff --git a/gdb/parse.c b/gdb/parse.c index a2f8c026aa..3284af3cdf 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -1185,7 +1185,8 @@ build_parse (void) init_type (TYPE_CODE_FUNC, 1, 0, "", NULL); TYPE_TARGET_TYPE (msym_text_symbol_type) = builtin_type_int; msym_data_symbol_type = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0, + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT, 0, "", NULL); msym_unknown_symbol_type = init_type (TYPE_CODE_INT, 1, 0, @@ -1193,7 +1194,8 @@ build_parse (void) NULL); msym_tls_symbol_type = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0, + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT, 0, "", NULL); } diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 5d3da16376..75bb5f0080 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -984,12 +984,14 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, /* Call it "int" because this is mainly C lossage. */ if (pcc_promotion_type == NULL) pcc_promotion_type = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "int", NULL); if (pcc_unsigned_promotion_type == NULL) pcc_unsigned_promotion_type = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "unsigned int", NULL); /* If PCC says a parameter is a short or a char, it is @@ -2840,7 +2842,8 @@ read_one_struct_field (struct field_info *fip, char **pp, char *p, if ((FIELD_BITSIZE (fip->list->field) == TARGET_CHAR_BIT * TYPE_LENGTH (field_type) || (TYPE_CODE (field_type) == TYPE_CODE_ENUM - && FIELD_BITSIZE (fip->list->field) == TARGET_INT_BIT) + && FIELD_BITSIZE (fip->list->field) + == gdbarch_int_bit (current_gdbarch)) ) && FIELD_BITPOS (fip->list->field) % 8 == 0) @@ -3533,7 +3536,7 @@ read_enum_type (char **pp, struct type *type, /* Now fill in the fields of the type-structure. */ - TYPE_LENGTH (type) = TARGET_INT_BIT / HOST_CHAR_BIT; + TYPE_LENGTH (type) = gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT; TYPE_CODE (type) = TYPE_CODE_ENUM; TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB; if (unsigned_enum) @@ -3958,7 +3961,8 @@ read_range_type (char **pp, int typenums[2], int type_size, /* It is unsigned int or unsigned long. */ /* GCC 2.3.3 uses this for long long too, but that is just a GDB 3.5 compatibility hack. */ - return init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, + return init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, NULL, objfile); } @@ -4000,7 +4004,8 @@ read_range_type (char **pp, int typenums[2], int type_size, of self_subrange. */ else if (n3 == 0 && n2 < 0 && (self_subrange - || n2 == -TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT)) + || n2 == -gdbarch_long_long_bit + (current_gdbarch) / TARGET_CHAR_BIT)) return init_type (TYPE_CODE_INT, -n2, 0, NULL, objfile); else if (n2 == -n3 - 1) { @@ -4031,7 +4036,8 @@ handle_true_range: _("base type %d of range type is not defined"), rangenums[1]); if (range_type_index == NULL) range_type_index = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "range type index type", NULL); index_type = range_type_index; } diff --git a/gdb/symfile.c b/gdb/symfile.c index 8e204e15be..fac4c87ea0 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -3530,7 +3530,8 @@ enum ovly_index { VMA, SIZE, LMA, MAPPED }; -#define TARGET_LONG_BYTES (TARGET_LONG_BIT / TARGET_CHAR_BIT) +#define TARGET_LONG_BYTES (gdbarch_long_bit (current_gdbarch) \ + / TARGET_CHAR_BIT) /* Throw away the cached copy of _ovly_table */ static void diff --git a/gdb/valarith.c b/gdb/valarith.c index b5c69e3535..90679740ad 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -1028,7 +1028,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) /* Can't just call init_type because we wouldn't know what name to give the type. */ val = allocate_value - (result_len > TARGET_LONG_BIT / HOST_CHAR_BIT + (result_len > gdbarch_long_bit (current_gdbarch) / HOST_CHAR_BIT ? builtin_type_unsigned_long_long : builtin_type_unsigned_long); store_unsigned_integer (value_contents_raw (val), @@ -1153,7 +1153,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) /* Can't just call init_type because we wouldn't know what name to give the type. */ val = allocate_value - (result_len > TARGET_LONG_BIT / HOST_CHAR_BIT + (result_len > gdbarch_long_bit (current_gdbarch) / HOST_CHAR_BIT ? builtin_type_long_long : builtin_type_long); store_signed_integer (value_contents_raw (val), diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 849692bc32..8c8208ef51 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -3027,6 +3027,7 @@ _initialize_xcoffread (void) "", NULL); TYPE_TARGET_TYPE (func_symbol_type) = builtin_type_int; var_symbol_type = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0, + init_type (TYPE_CODE_INT, + gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT, 0, "", NULL); } -- 2.11.0