diff options
author | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2007-10-25 17:57:34 +0000 |
---|---|---|
committer | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2007-10-25 17:57:34 +0000 |
commit | 7678ef8fb055dd4853c7c6b25f739a8d74650899 (patch) | |
tree | 8aeb5e60db77112eebd98380fb03e6d8048a16b4 /gdb | |
parent | 9b913628cfe092b3fdd328de4264def1ec1e94cb (diff) | |
download | gdb-7678ef8fb055dd4853c7c6b25f739a8d74650899.zip gdb-7678ef8fb055dd4853c7c6b25f739a8d74650899.tar.gz gdb-7678ef8fb055dd4853c7c6b25f739a8d74650899.tar.bz2 |
2007-10-25 Wu Zhou <woodzltc@cn.ibm.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
* c-lang.c (c_create_fundamental_type): Create fundamental
types for DFP.
* c-typeprint.c (c_type_print_varspec_prefix): Add
TYPE_CODE_DECFLOAT to no prefix needed case.
(c_type_print_varspec_suffix): Add TYPE_CODE_DECFLOAT to no
suffix needed case.
* c-valprint.c (c_val_print): Call print_decimal_floating to
print DFP values.
* dwarf2read.c (read_base_type): Read DW_ATE_decimal_float
attribute code and return TYPE_CODE_DECFLOAT.
(dwarf_base_type): Set dwarf2_fundamental_type for DFP values.
* gdbtypes.c (gdbtypes_post_init): Initialize builtin_decfloat,
builtin_decdouble and builtin_declong.
* gdbtypes.h (enum type_code): Add TYPE_CODE_DECFLOAT as a
type code for DFP.
(FT_DECFLOAT, FT_DBL_PREC_DECFLOAT, FT_EXT_PREC_DECFLOAT): New
types, for decimal floating point.
(FT_NUM_MEMBERS): Increment, new types added.
(struct builtin_type): Add builtin_decfloat, builtin_decdouble
and builtin_declong.
* valprint.c (print_decimal_floating): New function to print DFP
values.
* value.h (print_decimal_floating): Prototype.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 27 | ||||
-rw-r--r-- | gdb/c-lang.c | 15 | ||||
-rw-r--r-- | gdb/c-typeprint.c | 2 | ||||
-rw-r--r-- | gdb/c-valprint.c | 7 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 11 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 15 | ||||
-rw-r--r-- | gdb/gdbtypes.h | 14 | ||||
-rw-r--r-- | gdb/valprint.c | 13 | ||||
-rw-r--r-- | gdb/value.h | 3 |
9 files changed, 105 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 530adc6..be6eab8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,6 +1,33 @@ 2007-10-25 Wu Zhou <woodzltc@cn.ibm.com> Thiago Jung Bauermann <bauerman@br.ibm.com> + * c-lang.c (c_create_fundamental_type): Create fundamental + types for DFP. + * c-typeprint.c (c_type_print_varspec_prefix): Add + TYPE_CODE_DECFLOAT to no prefix needed case. + (c_type_print_varspec_suffix): Add TYPE_CODE_DECFLOAT to no + suffix needed case. + * c-valprint.c (c_val_print): Call print_decimal_floating to + print DFP values. + * dwarf2read.c (read_base_type): Read DW_ATE_decimal_float + attribute code and return TYPE_CODE_DECFLOAT. + (dwarf_base_type): Set dwarf2_fundamental_type for DFP values. + * gdbtypes.c (gdbtypes_post_init): Initialize builtin_decfloat, + builtin_decdouble and builtin_declong. + * gdbtypes.h (enum type_code): Add TYPE_CODE_DECFLOAT as a + type code for DFP. + (FT_DECFLOAT, FT_DBL_PREC_DECFLOAT, FT_EXT_PREC_DECFLOAT): New + types, for decimal floating point. + (FT_NUM_MEMBERS): Increment, new types added. + (struct builtin_type): Add builtin_decfloat, builtin_decdouble + and builtin_declong. + * valprint.c (print_decimal_floating): New function to print DFP + values. + * value.h (print_decimal_floating): Prototype. + +2007-10-25 Wu Zhou <woodzltc@cn.ibm.com> + Thiago Jung Bauermann <bauerman@br.ibm.com> + * Makefile.in (LIBDECNUMBER_DIR, LIBDECNUMBER, LIBDECNUMBER_SRC LIBDECNUMBER_CFLAGS): New macros for libdecnumber. (INTERNAL_CFLAGS_BASE): Add LIBDECNUMBER_CFLAGS in. diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 7855551..9b4d1cd 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -325,6 +325,21 @@ c_create_fundamental_type (struct objfile *objfile, int typeid) / TARGET_CHAR_BIT, 0, "long double", objfile); break; + case FT_DECFLOAT: + type = init_type (TYPE_CODE_DECFLOAT, + 32 / 8, + 0, "decimal float", objfile); + break; + case FT_DBL_PREC_DECFLOAT: + type = init_type (TYPE_CODE_DECFLOAT, + 64 / 8, + 0, "decimal double", objfile); + break; + case FT_EXT_PREC_DECFLOAT: + type = init_type (TYPE_CODE_DECFLOAT, + 128 / 8, + 0, "decimal long double", objfile); + break; case FT_COMPLEX: type = init_type (TYPE_CODE_FLT, 2 * gdbarch_float_bit (current_gdbarch) diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index b249dda..77647ad 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -277,6 +277,7 @@ c_type_print_varspec_prefix (struct type *type, struct ui_file *stream, case TYPE_CODE_COMPLEX: case TYPE_CODE_TEMPLATE: case TYPE_CODE_NAMESPACE: + case TYPE_CODE_DECFLOAT: /* These types need no prefix. They are listed here so that gcc -Wall will reveal any types that haven't been handled. */ break; @@ -599,6 +600,7 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream, case TYPE_CODE_COMPLEX: case TYPE_CODE_TEMPLATE: case TYPE_CODE_NAMESPACE: + case TYPE_CODE_DECFLOAT: /* These types do not need a suffix. They are listed so that gcc -Wall will report types that may not have been considered. */ break; diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index cd4c85a..ddcec6e 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -474,6 +474,13 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, } break; + case TYPE_CODE_DECFLOAT: + if (format) + print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream); + else + print_decimal_floating (valaddr + embedded_offset, type, stream); + break; + case TYPE_CODE_VOID: fprintf_filtered (stream, "void"); break; diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index a5fdbee..5d85519 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -4865,6 +4865,9 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) case DW_ATE_complex_float: code = TYPE_CODE_COMPLEX; break; + case DW_ATE_decimal_float: + code = TYPE_CODE_DECFLOAT; + break; case DW_ATE_float: code = TYPE_CODE_FLT; break; @@ -7751,6 +7754,14 @@ dwarf_base_type (int encoding, int size, struct dwarf2_cu *cu) type = dwarf2_fundamental_type (objfile, FT_FLOAT, cu); } return type; + case DW_ATE_decimal_float: + if (size == 16) + type = dwarf2_fundamental_type (objfile, FT_DBL_PREC_DECFLOAT, cu); + else if (size == 8) + type = dwarf2_fundamental_type (objfile, FT_EXT_PREC_DECFLOAT, cu); + else + type = dwarf2_fundamental_type (objfile, FT_DECFLOAT, cu); + return type; case DW_ATE_signed: switch (size) { diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 7ffa986..7400d68 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3506,6 +3506,21 @@ gdbtypes_post_init (struct gdbarch *gdbarch) 0, "bool", (struct objfile *) NULL); + /* The following three are about decimal floating point types, which + are 32-bits, 64-bits and 128-bits respectively. */ + builtin_type->builtin_decfloat + = init_type (TYPE_CODE_DECFLOAT, 32 / 8, + 0, + "decimal float", (struct objfile *) NULL); + builtin_type->builtin_decdouble + = init_type (TYPE_CODE_DECFLOAT, 64 / 8, + 0, + "decimal double", (struct objfile *) NULL); + builtin_type->builtin_declong + = init_type (TYPE_CODE_DECFLOAT, 128 / 8, + 0, + "decimal long double", (struct objfile *) NULL); + /* Pointer/Address types. */ /* NOTE: on some targets, addresses and pointers are not necessarily diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 7c93ca5..b1e8558 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -65,7 +65,12 @@ struct block; #define FT_UNSIGNED_BYTE 27 #define FT_TEMPLATE_ARG 28 -#define FT_NUM_MEMBERS 29 /* Highest FT_* above, plus one. */ +/* The following three fundamental types are for decimal floating point. */ +#define FT_DECFLOAT 29 +#define FT_DBL_PREC_DECFLOAT 30 +#define FT_EXT_PREC_DECFLOAT 31 + +#define FT_NUM_MEMBERS 32 /* Highest FT_* above, plus one. */ /* Some macros for char-based bitfields. */ @@ -169,7 +174,9 @@ enum type_code TYPE_CODE_TEMPLATE, /* C++ template */ TYPE_CODE_TEMPLATE_ARG, /* C++ template arg */ - TYPE_CODE_NAMESPACE /* C++ namespace. */ + TYPE_CODE_NAMESPACE, /* C++ namespace. */ + + TYPE_CODE_DECFLOAT /* Decimal floating point. */ }; /* For now allow source to use TYPE_CODE_CLASS for C++ classes, as an @@ -1041,6 +1048,9 @@ struct builtin_type struct type *builtin_bool; struct type *builtin_long_long; struct type *builtin_unsigned_long_long; + struct type *builtin_decfloat; + struct type *builtin_decdouble; + struct type *builtin_declong; }; /* Return the type table for the specified architecture. */ diff --git a/gdb/valprint.c b/gdb/valprint.c index eb3a73b..2b995da 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -33,6 +33,7 @@ #include "floatformat.h" #include "doublest.h" #include "exceptions.h" +#include "dfp.h" #include <errno.h> @@ -506,6 +507,18 @@ print_floating (const gdb_byte *valaddr, struct type *type, } void +print_decimal_floating (const gdb_byte *valaddr, struct type *type, + struct ui_file *stream) +{ + char decstr[MAX_DECIMAL_STRING]; + unsigned len = TYPE_LENGTH (type); + + decimal_to_string (valaddr, len, decstr); + fputs_filtered (decstr, stream); + return; +} + +void print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr, unsigned len) { diff --git a/gdb/value.h b/gdb/value.h index 0824b5e..7026466 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -492,6 +492,9 @@ extern void print_longest (struct ui_file *stream, int format, extern void print_floating (const gdb_byte *valaddr, struct type *type, struct ui_file *stream); +extern void print_decimal_floating (const gdb_byte *valaddr, struct type *type, + struct ui_file *stream); + extern int value_print (struct value *val, struct ui_file *stream, int format, enum val_prettyprint pretty); |