From ea06eb3dd8f0780ee5ffa63354e60533990a890a Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Tue, 12 Jun 2007 16:33:20 +0000 Subject: [PATCH] 2007-06-12 Markus Deuling * gdbarch.sh (TARGET_FLOAT_BIT): Replace by gdbarch_float_bit. * p-lang.c (pascal_create_fundamental_type): Likewise. * objc-lang.c (objc_create_fundamental_type): Likewise. * mdebugread.c (_initialize_mdebugread): Likewise. * m2-lang.c (m2_create_fundamental_type) (_initialize_m2_language): Likewise. * gdbtypes.c (build_gdbtypes): Likewise. * f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise. * doublest.c (floatformat_from_length): Likewise. * c-lang.c (c_create_fundamental_type): Likewise. * ada-lang.c (ada_create_fundamental_type) (ada_language_arch_info): Likewise. * gdbarch.sh (TARGET_FLOAT_FORMAT): Replace by gdbarch_float_format. * value.c (unpack_double): Likewise (comment). * gdbtypes.c (build_gdbtypes): Likewise. * doublest.c (floatformat_from_length): Likewise. * gdbarch.sh (TARGET_DOUBLE_BIT): Replace by gdbarch_double_bit. * valarith.c (value_binop): Likewise. * p-lang.c (pascal_create_fundamental_type): Likewise. * objc-lang.c (objc_create_fundamental_type): Likewise. * mdebugread.c (_initialize_mdebugread): Likewise. * m2-lang.c (m2_create_fundamental_type): Likewise. * gdbtypes.c (build_gdbtypes): Likewise. * f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise. * doublest.c (floatformat_from_length): Likewise. * cris-tdep.c (cris_gdbarch_init): Likewise (comment). * c-lang.c (c_create_fundamental_type): Likewise. * ada-lex.l (processReal): Likewise. * ada-lang.c (ada_create_fundamental_type) (ada_language_arch_info): Likewise. * gdbarch.sh (TARGET_DOUBLE_FORMAT): Replace by gdbarch_double_format. * value.c (unpack_double): Likewise (comment). * gdbtypes.c (build_gdbtypes): Likewise. * doublest.c (floatformat_from_length): Likewise. * gdbarch.sh (TARGET_LONG_DOUBLE_BIT): Replace by gdbarch_long_double_bit. * p-lang.c (pascal_create_fundamental_type): Likewise. * objc-lang.c (objc_create_fundamental_type): Likewise. * m2-lang.c (m2_create_fundamental_type): Likewise. * gdbtypes.c (build_gdbtypes): Likewise. * f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise. * doublest.c (floatformat_from_length): Likewise. * c-lang.c (c_create_fundamental_type): Likewise. * ada-lex.l (processReal): Likewise. * ada-lang.c (ada_create_fundamental_type) (ada_language_arch_info): Likewise. * gdbarch.sh (TARGET_LONG_DOUBLE_FORMAT): Replace by gdbarch_long_double_format. * gdbtypes.c (build_gdbtypes): Likewise. * doublest.c (floatformat_from_length): Likewise. * gdbarch.c, gdbarch.h: Regenerate. --- gdb/ChangeLog | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ gdb/ada-lang.c | 16 ++++++++------ gdb/ada-lex.l | 6 ++++-- gdb/c-lang.c | 26 +++++++++++++++-------- gdb/cris-tdep.c | 2 +- gdb/doublest.c | 22 ++++++++++++-------- gdb/f-lang.c | 35 +++++++++++++++++++------------ gdb/gdbarch.c | 32 +--------------------------- gdb/gdbarch.h | 36 -------------------------------- gdb/gdbarch.sh | 14 ++++++------- gdb/gdbtypes.c | 23 ++++++++++++++------- gdb/m2-lang.c | 21 ++++++++++++------- gdb/mdebugread.c | 26 +++++++++++------------ gdb/objc-lang.c | 8 ++++--- gdb/p-lang.c | 7 ++++--- gdb/valarith.c | 4 ++-- gdb/value.c | 2 +- 17 files changed, 182 insertions(+), 152 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8912582dde6..992b0ebc51e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,57 @@ +2007-06-12 Markus Deuling + + * gdbarch.sh (TARGET_FLOAT_BIT): Replace by gdbarch_float_bit. + * p-lang.c (pascal_create_fundamental_type): Likewise. + * objc-lang.c (objc_create_fundamental_type): Likewise. + * mdebugread.c (_initialize_mdebugread): Likewise. + * m2-lang.c (m2_create_fundamental_type) + (_initialize_m2_language): Likewise. + * gdbtypes.c (build_gdbtypes): Likewise. + * f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise. + * doublest.c (floatformat_from_length): Likewise. + * c-lang.c (c_create_fundamental_type): Likewise. + * ada-lang.c (ada_create_fundamental_type) + (ada_language_arch_info): Likewise. + * gdbarch.sh (TARGET_FLOAT_FORMAT): Replace by gdbarch_float_format. + * value.c (unpack_double): Likewise (comment). + * gdbtypes.c (build_gdbtypes): Likewise. + * doublest.c (floatformat_from_length): Likewise. + * gdbarch.sh (TARGET_DOUBLE_BIT): Replace by gdbarch_double_bit. + * valarith.c (value_binop): Likewise. + * p-lang.c (pascal_create_fundamental_type): Likewise. + * objc-lang.c (objc_create_fundamental_type): Likewise. + * mdebugread.c (_initialize_mdebugread): Likewise. + * m2-lang.c (m2_create_fundamental_type): Likewise. + * gdbtypes.c (build_gdbtypes): Likewise. + * f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise. + * doublest.c (floatformat_from_length): Likewise. + * cris-tdep.c (cris_gdbarch_init): Likewise (comment). + * c-lang.c (c_create_fundamental_type): Likewise. + * ada-lex.l (processReal): Likewise. + * ada-lang.c (ada_create_fundamental_type) + (ada_language_arch_info): Likewise. + * gdbarch.sh (TARGET_DOUBLE_FORMAT): Replace by gdbarch_double_format. + * value.c (unpack_double): Likewise (comment). + * gdbtypes.c (build_gdbtypes): Likewise. + * doublest.c (floatformat_from_length): Likewise. + * gdbarch.sh (TARGET_LONG_DOUBLE_BIT): Replace by + gdbarch_long_double_bit. + * p-lang.c (pascal_create_fundamental_type): Likewise. + * objc-lang.c (objc_create_fundamental_type): Likewise. + * m2-lang.c (m2_create_fundamental_type): Likewise. + * gdbtypes.c (build_gdbtypes): Likewise. + * f-lang.c (f_create_fundamental_type, build_fortran_types): Likewise. + * doublest.c (floatformat_from_length): Likewise. + * c-lang.c (c_create_fundamental_type): Likewise. + * ada-lex.l (processReal): Likewise. + * ada-lang.c (ada_create_fundamental_type) + (ada_language_arch_info): Likewise. + * gdbarch.sh (TARGET_LONG_DOUBLE_FORMAT): Replace by + gdbarch_long_double_format. + * gdbtypes.c (build_gdbtypes): Likewise. + * doublest.c (floatformat_from_length): Likewise. + * gdbarch.c, gdbarch.h: Regenerate. + 2007-06-12 Markus Deuling * gdbarch.sh (TARGET_SHORT_BIT): Replace by gdbarch_int_bit. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 7f83bfe7a8f..26eb64561a6 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -10287,17 +10287,18 @@ ada_create_fundamental_type (struct objfile *objfile, int typeid) break; case FT_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "float", objfile); break; case FT_DBL_PREC_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long_float", objfile); break; case FT_EXT_PREC_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_long_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "long_long_float", objfile); break; } @@ -10345,17 +10346,20 @@ ada_language_arch_info (struct gdbarch *current_gdbarch, init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, 0, "character", (struct objfile *) NULL); lai->primitive_type_vector [ada_primitive_type_float] = - init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_FLT, + gdbarch_float_bit (current_gdbarch)/ TARGET_CHAR_BIT, 0, "float", (struct objfile *) NULL); lai->primitive_type_vector [ada_primitive_type_double] = - init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_FLT, + gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long_float", (struct objfile *) NULL); lai->primitive_type_vector [ada_primitive_type_long_long] = 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, + init_type (TYPE_CODE_FLT, + gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "long_long_float", (struct objfile *) NULL); lai->primitive_type_vector [ada_primitive_type_natural] = init_type (TYPE_CODE_INT, diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l index a52f5054274..842ac7087a9 100644 --- a/gdb/ada-lex.l +++ b/gdb/ada-lex.l @@ -376,9 +376,11 @@ processReal (const char *num0) sscanf (num0, DOUBLEST_SCAN_FORMAT, &yylval.typed_val_float.dval); yylval.typed_val_float.type = type_float (); - if (sizeof(DOUBLEST) >= TARGET_DOUBLE_BIT / TARGET_CHAR_BIT) + if (sizeof(DOUBLEST) >= gdbarch_double_bit (current_gdbarch) + / TARGET_CHAR_BIT) yylval.typed_val_float.type = type_double (); - if (sizeof(DOUBLEST) >= TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT) + if (sizeof(DOUBLEST) >= gdbarch_long_double_bit (current_gdbarch) + / TARGET_CHAR_BIT) yylval.typed_val_float.type = type_long_double (); return FLOAT; diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 8dac4f5052c..32b023dae69 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -313,41 +313,49 @@ c_create_fundamental_type (struct objfile *objfile, int typeid) break; case FT_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "float", objfile); break; case FT_DBL_PREC_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "double", objfile); break; case FT_EXT_PREC_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_long_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "long double", objfile); break; case FT_COMPLEX: type = init_type (TYPE_CODE_FLT, - 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + 2 * gdbarch_float_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "complex float", objfile); TYPE_TARGET_TYPE (type) - = init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + = init_type (TYPE_CODE_FLT, + gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "float", objfile); break; case FT_DBL_PREC_COMPLEX: type = init_type (TYPE_CODE_FLT, - 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + 2 * gdbarch_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "complex double", objfile); TYPE_TARGET_TYPE (type) - = init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + = init_type (TYPE_CODE_FLT, + gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "double", objfile); break; case FT_EXT_PREC_COMPLEX: type = init_type (TYPE_CODE_FLT, - 2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + 2 * gdbarch_long_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "complex long double", objfile); TYPE_TARGET_TYPE (type) - = init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + = init_type (TYPE_CODE_FLT, + gdbarch_long_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "long double", objfile); break; case FT_TEMPLATE_ARG: diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 1eb214a0e02..7ef468c11d7 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -4107,7 +4107,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) register is. */ set_gdbarch_double_bit (gdbarch, 64); - /* The default definition of a long double is 2 * TARGET_DOUBLE_BIT, + /* The default definition of a long double is 2 * gdbarch_double_bit, which means we have to set this explicitly. */ set_gdbarch_long_double_bit (gdbarch, 64); diff --git a/gdb/doublest.c b/gdb/doublest.c index 6107c725854..f05740d0eb9 100644 --- a/gdb/doublest.c +++ b/gdb/doublest.c @@ -724,20 +724,24 @@ static const struct floatformat * floatformat_from_length (int len) { const struct floatformat *format; - if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT) - format = TARGET_FLOAT_FORMAT[gdbarch_byte_order (current_gdbarch)]; - else if (len * TARGET_CHAR_BIT == TARGET_DOUBLE_BIT) - format = TARGET_DOUBLE_FORMAT[gdbarch_byte_order (current_gdbarch)]; - else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT) - format = TARGET_LONG_DOUBLE_FORMAT[gdbarch_byte_order (current_gdbarch)]; + if (len * TARGET_CHAR_BIT == gdbarch_float_bit (current_gdbarch)) + format = gdbarch_float_format (current_gdbarch) + [gdbarch_byte_order (current_gdbarch)]; + else if (len * TARGET_CHAR_BIT == gdbarch_double_bit (current_gdbarch)) + format = gdbarch_double_format (current_gdbarch) + [gdbarch_byte_order (current_gdbarch)]; + else if (len * TARGET_CHAR_BIT == gdbarch_long_double_bit (current_gdbarch)) + format = gdbarch_long_double_format (current_gdbarch) + [gdbarch_byte_order (current_gdbarch)]; /* On i386 the 'long double' type takes 96 bits, while the real number of used bits is only 80, both in processor and in memory. The code below accepts the real bit size. */ - else if ((TARGET_LONG_DOUBLE_FORMAT != NULL) + else if ((gdbarch_long_double_format (current_gdbarch) != NULL) && (len * TARGET_CHAR_BIT == - TARGET_LONG_DOUBLE_FORMAT[0]->totalsize)) - format = TARGET_LONG_DOUBLE_FORMAT[gdbarch_byte_order (current_gdbarch)]; + gdbarch_long_double_format (current_gdbarch)[0]->totalsize)) + format = gdbarch_long_double_format (current_gdbarch) + [gdbarch_byte_order (current_gdbarch)]; else format = NULL; if (format == NULL) diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 76c5ec67c0d..e6b0d6feea6 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -353,39 +353,42 @@ f_create_fundamental_type (struct objfile *objfile, int typeid) break; case FT_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "real", objfile); break; case FT_DBL_PREC_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "real*8", objfile); break; case FT_FLOAT_DECIMAL: type = init_type (TYPE_CODE_FLT, - TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "floating decimal", objfile); break; case FT_EXT_PREC_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_long_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "real*16", objfile); break; case FT_COMPLEX: type = init_type (TYPE_CODE_COMPLEX, - 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + 2 * gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "complex*8", objfile); TYPE_TARGET_TYPE (type) = builtin_type_f_real; break; case FT_DBL_PREC_COMPLEX: type = init_type (TYPE_CODE_COMPLEX, - 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + 2 * gdbarch_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "complex*16", objfile); TYPE_TARGET_TYPE (type) = builtin_type_f_real_s8; break; case FT_EXT_PREC_COMPLEX: type = init_type (TYPE_CODE_COMPLEX, - 2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + 2 * gdbarch_long_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "complex*32", objfile); TYPE_TARGET_TYPE (type) = builtin_type_f_real_s16; break; @@ -531,28 +534,33 @@ build_fortran_types (void) TYPE_FLAG_UNSIGNED, "logical*4", (struct objfile *) NULL); builtin_type_f_real = - init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_FLT, + gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "real", (struct objfile *) NULL); builtin_type_f_real_s8 = - init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_FLT, + gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "real*8", (struct objfile *) NULL); builtin_type_f_real_s16 = - init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_FLT, + gdbarch_long_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "real*16", (struct objfile *) NULL); builtin_type_f_complex_s8 = - init_type (TYPE_CODE_COMPLEX, 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_COMPLEX, + 2 * gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "complex*8", (struct objfile *) NULL); TYPE_TARGET_TYPE (builtin_type_f_complex_s8) = builtin_type_f_real; builtin_type_f_complex_s16 = - init_type (TYPE_CODE_COMPLEX, 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_COMPLEX, + 2 * gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "complex*16", (struct objfile *) NULL); TYPE_TARGET_TYPE (builtin_type_f_complex_s16) = builtin_type_f_real_s8; @@ -561,7 +569,8 @@ build_fortran_types (void) complex*32 data type */ builtin_type_f_complex_s32 = - init_type (TYPE_CODE_COMPLEX, 2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_COMPLEX, + 2 * gdbarch_long_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "complex*32", (struct objfile *) NULL); TYPE_TARGET_TYPE (builtin_type_f_complex_s32) = builtin_type_f_real_s16; diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 810e93a96f4..b03c944cf9d 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -373,7 +373,7 @@ gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep) { /* NOTE: The new architecture variable is named ``current_gdbarch'' - so that macros such as TARGET_DOUBLE_BIT, when expanded, refer to + so that macros such as TARGET_ARCHITECTURE, when expanded, refer to the current local architecture and not the previous global architecture. This ensures that the new architectures initial values are not influenced by the previous architecture. Once @@ -850,19 +850,9 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: deprecated_use_struct_convention = <0x%lx>\n", (long) current_gdbarch->deprecated_use_struct_convention); -#ifdef TARGET_DOUBLE_BIT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_DOUBLE_BIT # %s\n", - XSTRING (TARGET_DOUBLE_BIT)); -#endif fprintf_unfiltered (file, "gdbarch_dump: double_bit = %s\n", paddr_d (current_gdbarch->double_bit)); -#ifdef TARGET_DOUBLE_FORMAT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_DOUBLE_FORMAT # %s\n", - XSTRING (TARGET_DOUBLE_FORMAT)); -#endif fprintf_unfiltered (file, "gdbarch_dump: double_format = %s\n", pformat (current_gdbarch->double_format)); @@ -917,19 +907,9 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: fetch_tls_load_module_address = <0x%lx>\n", (long) current_gdbarch->fetch_tls_load_module_address); -#ifdef TARGET_FLOAT_BIT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_FLOAT_BIT # %s\n", - XSTRING (TARGET_FLOAT_BIT)); -#endif fprintf_unfiltered (file, "gdbarch_dump: float_bit = %s\n", paddr_d (current_gdbarch->float_bit)); -#ifdef TARGET_FLOAT_FORMAT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_FLOAT_FORMAT # %s\n", - XSTRING (TARGET_FLOAT_FORMAT)); -#endif fprintf_unfiltered (file, "gdbarch_dump: float_format = %s\n", pformat (current_gdbarch->float_format)); @@ -989,19 +969,9 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: long_bit = %s\n", paddr_d (current_gdbarch->long_bit)); -#ifdef TARGET_LONG_DOUBLE_BIT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_LONG_DOUBLE_BIT # %s\n", - XSTRING (TARGET_LONG_DOUBLE_BIT)); -#endif fprintf_unfiltered (file, "gdbarch_dump: long_double_bit = %s\n", paddr_d (current_gdbarch->long_double_bit)); -#ifdef TARGET_LONG_DOUBLE_FORMAT - fprintf_unfiltered (file, - "gdbarch_dump: TARGET_LONG_DOUBLE_FORMAT # %s\n", - XSTRING (TARGET_LONG_DOUBLE_FORMAT)); -#endif fprintf_unfiltered (file, "gdbarch_dump: long_double_format = %s\n", pformat (current_gdbarch->long_double_format)); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 97805c99ed0..134b8155b4d 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -112,57 +112,21 @@ extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bi extern int gdbarch_float_bit (struct gdbarch *gdbarch); extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit); -#if !defined (GDB_TM_FILE) && defined (TARGET_FLOAT_BIT) -#error "Non multi-arch definition of TARGET_FLOAT_BIT" -#endif -#if !defined (TARGET_FLOAT_BIT) -#define TARGET_FLOAT_BIT (gdbarch_float_bit (current_gdbarch)) -#endif extern const struct floatformat ** gdbarch_float_format (struct gdbarch *gdbarch); extern void set_gdbarch_float_format (struct gdbarch *gdbarch, const struct floatformat ** float_format); -#if !defined (GDB_TM_FILE) && defined (TARGET_FLOAT_FORMAT) -#error "Non multi-arch definition of TARGET_FLOAT_FORMAT" -#endif -#if !defined (TARGET_FLOAT_FORMAT) -#define TARGET_FLOAT_FORMAT (gdbarch_float_format (current_gdbarch)) -#endif extern int gdbarch_double_bit (struct gdbarch *gdbarch); extern void set_gdbarch_double_bit (struct gdbarch *gdbarch, int double_bit); -#if !defined (GDB_TM_FILE) && defined (TARGET_DOUBLE_BIT) -#error "Non multi-arch definition of TARGET_DOUBLE_BIT" -#endif -#if !defined (TARGET_DOUBLE_BIT) -#define TARGET_DOUBLE_BIT (gdbarch_double_bit (current_gdbarch)) -#endif extern const struct floatformat ** gdbarch_double_format (struct gdbarch *gdbarch); extern void set_gdbarch_double_format (struct gdbarch *gdbarch, const struct floatformat ** double_format); -#if !defined (GDB_TM_FILE) && defined (TARGET_DOUBLE_FORMAT) -#error "Non multi-arch definition of TARGET_DOUBLE_FORMAT" -#endif -#if !defined (TARGET_DOUBLE_FORMAT) -#define TARGET_DOUBLE_FORMAT (gdbarch_double_format (current_gdbarch)) -#endif extern int gdbarch_long_double_bit (struct gdbarch *gdbarch); extern void set_gdbarch_long_double_bit (struct gdbarch *gdbarch, int long_double_bit); -#if !defined (GDB_TM_FILE) && defined (TARGET_LONG_DOUBLE_BIT) -#error "Non multi-arch definition of TARGET_LONG_DOUBLE_BIT" -#endif -#if !defined (TARGET_LONG_DOUBLE_BIT) -#define TARGET_LONG_DOUBLE_BIT (gdbarch_long_double_bit (current_gdbarch)) -#endif extern const struct floatformat ** gdbarch_long_double_format (struct gdbarch *gdbarch); extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struct floatformat ** long_double_format); -#if !defined (GDB_TM_FILE) && defined (TARGET_LONG_DOUBLE_FORMAT) -#error "Non multi-arch definition of TARGET_LONG_DOUBLE_FORMAT" -#endif -#if !defined (TARGET_LONG_DOUBLE_FORMAT) -#define TARGET_LONG_DOUBLE_FORMAT (gdbarch_long_double_format (current_gdbarch)) -#endif /* For most targets, a pointer on the target and its representation as an address in GDB have the same size and "look the same". For such a diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 7595a96c57f..3ee6c1270fe 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -394,12 +394,12 @@ v::int:long_long_bit:::8 * sizeof (LONGEST):2*current_gdbarch->long_bit::0 # Each format describes both the big and little endian layouts (if # useful). -v:TARGET_FLOAT_BIT:int:float_bit:::8 * sizeof (float):4*TARGET_CHAR_BIT::0 -v:TARGET_FLOAT_FORMAT:const struct floatformat **:float_format:::::floatformats_ieee_single::pformat (current_gdbarch->float_format) -v:TARGET_DOUBLE_BIT:int:double_bit:::8 * sizeof (double):8*TARGET_CHAR_BIT::0 -v:TARGET_DOUBLE_FORMAT:const struct floatformat **:double_format:::::floatformats_ieee_double::pformat (current_gdbarch->double_format) -v:TARGET_LONG_DOUBLE_BIT:int:long_double_bit:::8 * sizeof (long double):8*TARGET_CHAR_BIT::0 -v:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat **:long_double_format:::::floatformats_ieee_double::pformat (current_gdbarch->long_double_format) +v::int:float_bit:::8 * sizeof (float):4*TARGET_CHAR_BIT::0 +v::const struct floatformat **:float_format:::::floatformats_ieee_single::pformat (current_gdbarch->float_format) +v::int:double_bit:::8 * sizeof (double):8*TARGET_CHAR_BIT::0 +v::const struct floatformat **:double_format:::::floatformats_ieee_double::pformat (current_gdbarch->double_format) +v::int:long_double_bit:::8 * sizeof (long double):8*TARGET_CHAR_BIT::0 +v::const struct floatformat **:long_double_format:::::floatformats_ieee_double::pformat (current_gdbarch->long_double_format) # For most targets, a pointer on the target and its representation as an # address in GDB have the same size and "look the same". For such a @@ -1348,7 +1348,7 @@ gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep) { /* NOTE: The new architecture variable is named \`\`current_gdbarch'' - so that macros such as TARGET_DOUBLE_BIT, when expanded, refer to + so that macros such as TARGET_ARCHITECTURE, when expanded, refer to the current local architecture and not the previous global architecture. This ensures that the new architectures initial values are not influenced by the previous architecture. Once diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 92d5a39a846..377f73a0b86 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3466,20 +3466,27 @@ build_gdbtypes (void) 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", - TARGET_DOUBLE_FORMAT); - builtin_type_long_double = build_flt (TARGET_LONG_DOUBLE_BIT, "long double", - TARGET_LONG_DOUBLE_FORMAT); + + builtin_type_float + = build_flt (gdbarch_float_bit (current_gdbarch), "float", + gdbarch_float_format (current_gdbarch)); + builtin_type_double + = build_flt (gdbarch_double_bit (current_gdbarch), "double", + gdbarch_double_format (current_gdbarch)); + builtin_type_long_double + = build_flt (gdbarch_long_double_bit (current_gdbarch), "long double", + gdbarch_long_double_format + (current_gdbarch)); builtin_type_complex = - init_type (TYPE_CODE_COMPLEX, 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_COMPLEX, + 2 * gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "complex", (struct objfile *) NULL); TYPE_TARGET_TYPE (builtin_type_complex) = builtin_type_float; builtin_type_double_complex = - init_type (TYPE_CODE_COMPLEX, 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_COMPLEX, + 2 * gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "double complex", (struct objfile *) NULL); TYPE_TARGET_TYPE (builtin_type_double_complex) = builtin_type_double; diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 8aa66c6721a..11716b3dcc8 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -310,41 +310,45 @@ m2_create_fundamental_type (struct objfile *objfile, int typeid) break; case FT_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "float", objfile); break; case FT_DBL_PREC_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "double", objfile); break; case FT_FLOAT_DECIMAL: type = init_type (TYPE_CODE_FLT, - TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "floating decimal", objfile); break; case FT_EXT_PREC_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_long_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "long double", objfile); break; case FT_COMPLEX: type = init_type (TYPE_CODE_COMPLEX, - 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + 2 * gdbarch_float_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "complex", objfile); TYPE_TARGET_TYPE (type) = m2_create_fundamental_type (objfile, FT_FLOAT); break; case FT_DBL_PREC_COMPLEX: type = init_type (TYPE_CODE_COMPLEX, - 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + 2 * gdbarch_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "double complex", objfile); TYPE_TARGET_TYPE (type) = m2_create_fundamental_type (objfile, FT_DBL_PREC_FLOAT); break; case FT_EXT_PREC_COMPLEX: type = init_type (TYPE_CODE_COMPLEX, - 2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + 2 * gdbarch_long_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "long double complex", objfile); TYPE_TARGET_TYPE (type) = m2_create_fundamental_type (objfile, FT_EXT_PREC_FLOAT); @@ -460,7 +464,8 @@ _initialize_m2_language (void) TYPE_FLAG_UNSIGNED, "CARDINAL", (struct objfile *) NULL); builtin_type_m2_real = - init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_FLT, + gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "REAL", (struct objfile *) NULL); builtin_type_m2_char = diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 29bf29afa61..67c49e5cd51 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -4841,22 +4841,22 @@ _initialize_mdebugread (void) "adr_64", (struct objfile *) NULL); TYPE_TARGET_TYPE (mdebug_type_adr_64) = mdebug_type_void; mdebug_type_float = - init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT, - 0, - "float", (struct objfile *) NULL); + init_type (TYPE_CODE_FLT, + gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "float", (struct objfile *) NULL); mdebug_type_double = - init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, - 0, - "double", (struct objfile *) NULL); + init_type (TYPE_CODE_FLT, + gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "double", (struct objfile *) NULL); mdebug_type_complex = - init_type (TYPE_CODE_COMPLEX, 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT, - 0, - "complex", (struct objfile *) NULL); + init_type (TYPE_CODE_COMPLEX, + 2 * gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "complex", (struct objfile *) NULL); TYPE_TARGET_TYPE (mdebug_type_complex) = mdebug_type_float; mdebug_type_double_complex = - init_type (TYPE_CODE_COMPLEX, 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, - 0, - "double complex", (struct objfile *) NULL); + init_type (TYPE_CODE_COMPLEX, + 2 * gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, + 0, "double complex", (struct objfile *) NULL); TYPE_TARGET_TYPE (mdebug_type_double_complex) = mdebug_type_double; /* Is a "string" the way btString means it the same as TYPE_CODE_STRING? @@ -4878,7 +4878,7 @@ _initialize_mdebugread (void) mdebug_type_float_dec = init_type (TYPE_CODE_ERROR, - TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "floating decimal", (struct objfile *) NULL); diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 53c2f38137d..5ab4bb2433e 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -550,17 +550,19 @@ objc_create_fundamental_type (struct objfile *objfile, int typeid) break; case FT_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "float", objfile); break; case FT_DBL_PREC_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "double", objfile); break; case FT_EXT_PREC_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_long_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "long double", objfile); break; } diff --git a/gdb/p-lang.c b/gdb/p-lang.c index d4acd263a4a..aa5545e42e9 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -376,17 +376,18 @@ pascal_create_fundamental_type (struct objfile *objfile, int typeid) break; case FT_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "float", objfile); break; case FT_DBL_PREC_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT, 0, "double", objfile); break; case FT_EXT_PREC_FLOAT: type = init_type (TYPE_CODE_FLT, - TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + gdbarch_long_double_bit (current_gdbarch) + / TARGET_CHAR_BIT, 0, "extended", objfile); break; } diff --git a/gdb/valarith.c b/gdb/valarith.c index 90679740ad5..31705bde21a 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -808,8 +808,8 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) /* If either arg was long double, make sure that value is also long double. */ - if (TYPE_LENGTH (type1) * 8 > TARGET_DOUBLE_BIT - || TYPE_LENGTH (type2) * 8 > TARGET_DOUBLE_BIT) + if (TYPE_LENGTH (type1) * 8 > gdbarch_double_bit (current_gdbarch) + || TYPE_LENGTH (type2) * 8 > gdbarch_double_bit (current_gdbarch)) val = allocate_value (builtin_type_long_double); else val = allocate_value (builtin_type_double); diff --git a/gdb/value.c b/gdb/value.c index e20a6ee5e38..74044088296 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1138,7 +1138,7 @@ unpack_double (struct type *type, const gdb_byte *valaddr, int *invp) only in a non-portable way. Fixing the portability problem wouldn't help since the VAX floating-point code is also badly bit-rotten. The target needs to add definitions for the - methods TARGET_FLOAT_FORMAT and TARGET_DOUBLE_FORMAT - these + methods gdbarch_float_format and gdbarch_double_format - these exactly describe the target floating-point format. The problem here is that the corresponding floatformat_vax_f and floatformat_vax_d values these methods should be set to are -- 2.30.2