From 701c159d9190af367e16a63ad8856d6664df1c14 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 23 Aug 2001 01:09:38 +0000 Subject: [PATCH] Add TYPE_FLOATFORMAT(). --- gdb/ChangeLog | 9 +++++++++ gdb/gdbtypes.c | 13 +++++++++++++ gdb/gdbtypes.h | 6 ++++++ 3 files changed, 28 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7ed9886..83689df 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2001-08-22 Andrew Cagney + + * gdbtypes.c (build_gdbtypes): Initialize TYPE_FLOATFORMAT field + of builtin_type_float, builtin_type_double and + builtin_type_long_double. + (recursive_dump_type): Print the floatformat name. + * gdbtypes.h (struct type): Add type_specific field floatformat. + (TYPE_FLOATFORMAT): Define + 2001-08-21 Keith Seitz * printcmd.c (print_insn): Use the given stream for diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index cfb5ffc..5c9e6cf 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -2769,6 +2769,16 @@ recursive_dump_type (struct type *type, int spaces) print_cplus_stuff (type, spaces); break; + case TYPE_CODE_FLT: + printfi_filtered (spaces, "floatformat "); + if (TYPE_FLOATFORMAT (type) == NULL + || TYPE_FLOATFORMAT (type)->name == NULL) + puts_filtered ("(null)"); + else + puts_filtered (TYPE_FLOATFORMAT (type)->name); + puts_filtered ("\n"); + break; + default: /* We have to pick one of the union types to be able print and test the value. Pick cplus_struct_type, even though we know it isn't @@ -2848,14 +2858,17 @@ build_gdbtypes (void) init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT, 0, "float", (struct objfile *) NULL); + TYPE_FLOATFORMAT (builtin_type_float) = TARGET_FLOAT_FORMAT; builtin_type_double = init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, 0, "double", (struct objfile *) NULL); + TYPE_FLOATFORMAT (builtin_type_double) = TARGET_DOUBLE_FORMAT; builtin_type_long_double = init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, 0, "long double", (struct objfile *) NULL); + TYPE_FLOATFORMAT (builtin_type_long_double) = TARGET_LONG_DOUBLE_FORMAT; builtin_type_complex = init_type (TYPE_CODE_COMPLEX, 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT, 0, diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 6869a60..4d47112 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -413,6 +413,11 @@ struct type struct cplus_struct_type *cplus_stuff; + /* FLOATFORMAT is for TYPE_CODE_FLT. It is a pointer to the + floatformat object that describes the floating-point value + that resides within the type. */ + + const struct floatformat *floatformat; } type_specific; }; @@ -722,6 +727,7 @@ extern void allocate_cplus_struct_type (struct type *); #define TYPE_TYPE_SPECIFIC(thistype) (thistype)->type_specific #define TYPE_ARG_TYPES(thistype) (thistype)->type_specific.arg_types #define TYPE_CPLUS_SPECIFIC(thistype) (thistype)->type_specific.cplus_stuff +#define TYPE_FLOATFORMAT(thistype) (thistype)->type_specific.floatformat #define TYPE_BASECLASS(thistype,index) (thistype)->fields[index].type #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses #define TYPE_BASECLASS_NAME(thistype,index) (thistype)->fields[index].name -- 2.7.4