This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[rfc] Add builtin_type_<floatformat>
- To: gdb-patches at sources dot redhat dot com
- Subject: [rfc] Add builtin_type_<floatformat>
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Tue, 21 Aug 2001 20:58:08 -0400
Hello,
(Almost there)
The attached patch adds a builtin_type for each of the machine dependant
float formats.
The intent is that, like the builtin_type_intNN already used by MIPS,
these make it possible for a target to exactly describe their
floating-point registers as they appear in a buffer.
At present several things happen:
o
builtin_type_long_double gets used and
the target programmer hopes that this
matches the ABI (typically it does but
sometimes it doesn't!)
Instead something like builtin_type_i387_ext
can be specified which exactly describes
the register buffer.
o
GDB does lossy target-fp -> DOUBLEST ->
??? conversions when displaying FP registers
(CONVERT_TO_VIRTUAL) and this is no longer
required. REGISTER_VIRTUAL_TYPE can
byte-for-byte, describe the
buffer being returned.
Just need someone to fix the code that
prints such types :-)
Thoughts?
The first version of this function and
builtin_type_floatformat_<floatformat> but I dropped that (for no real
reason other than it was shorter).
Andrew
2001-08-21 Andrew Cagney <ac131313@redhat.com>
* gdbtypes.h (builtin_type_ieee_single_big)
(builtin_type_ieee_single_little, builtin_type_ieee_double_big)
(builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword)
(builtin_type_i387_ext, builtin_type_m68881_ext)
(builtin_type_i960_ext, builtin_type_m88110_ext)
(builtin_type_m88110_harris_ext, builtin_type_arm_ext_big)
(builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big)
(builtin_type_ia64_quad_little): Declare.
* gdbtypes.c (builtin_type_ieee_single_big)
(builtin_type_ieee_single_little, builtin_type_ieee_double_big)
(builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword)
(builtin_type_i387_ext, builtin_type_m68881_ext)
(builtin_type_i960_ext, builtin_type_m88110_ext)
(builtin_type_m88110_harris_ext, builtin_type_arm_ext_big)
(builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big)
(builtin_type_ia64_quad_little): Define.
(_initialize_gdbtypes): Initialize builtin floatformat types.
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.23
diff -p -r1.23 gdbtypes.c
*** gdbtypes.c 2001/07/08 20:42:15 1.23
--- gdbtypes.c 2001/08/22 00:41:02
*************** struct type *builtin_type_v4si;
*** 73,78 ****
--- 73,94 ----
struct type *builtin_type_v8qi;
struct type *builtin_type_v4hi;
struct type *builtin_type_v2si;
+ struct type *builtin_type_ieee_single_big;
+ struct type *builtin_type_ieee_single_little;
+ struct type *builtin_type_ieee_double_big;
+ struct type *builtin_type_ieee_double_little;
+ struct type *builtin_type_ieee_double_littlebyte_bigword;
+ struct type *builtin_type_i387_ext;
+ struct type *builtin_type_m68881_ext;
+ struct type *builtin_type_i960_ext;
+ struct type *builtin_type_m88110_ext;
+ struct type *builtin_type_m88110_harris_ext;
+ struct type *builtin_type_arm_ext_big;
+ struct type *builtin_type_arm_ext_littlebyte_bigword;
+ struct type *builtin_type_ia64_spill_big;
+ struct type *builtin_type_ia64_spill_little;
+ struct type *builtin_type_ia64_quad_big;
+ struct type *builtin_type_ia64_quad_little;
struct type *builtin_type_void_data_ptr;
struct type *builtin_type_void_func_ptr;
struct type *builtin_type_CORE_ADDR;
*************** _initialize_gdbtypes (void)
*** 3016,3021 ****
--- 3045,3102 ----
REGISTER_GDBARCH_SWAP (builtin_type_CORE_ADDR);
REGISTER_GDBARCH_SWAP (builtin_type_bfd_vma);
register_gdbarch_swap (NULL, 0, build_gdbtypes);
+
+ /* Note: These types do not need to be swapped - they are target
+ neutral. */
+ builtin_type_ieee_single_big =
+ init_type (TYPE_CODE_FLT, floatformat_ieee_single_big.totalsize / 8,
+ 0, "builtin_type_ieee_single_big", NULL);
+ TYPE_FLOATFORMAT (builtin_type_ieee_single_big) = &floatformat_ieee_single_big;
+ builtin_type_ieee_single_little =
+ init_type (TYPE_CODE_FLT, floatformat_ieee_single_little.totalsize / 8,
+ 0, "builtin_type_ieee_single_little", NULL);
+ builtin_type_ieee_double_big =
+ init_type (TYPE_CODE_FLT, floatformat_ieee_double_big.totalsize / 8,
+ 0, "builtin_type_ieee_double_big", NULL);
+ builtin_type_ieee_double_little =
+ init_type (TYPE_CODE_FLT, floatformat_ieee_double_little.totalsize / 8,
+ 0, "builtin_type_ieee_double_little", NULL);
+ builtin_type_ieee_double_littlebyte_bigword =
+ init_type (TYPE_CODE_FLT, floatformat_ieee_double_littlebyte_bigword.totalsize / 8,
+ 0, "builtin_type_ieee_double_littlebyte_bigword", NULL);
+ builtin_type_i387_ext =
+ init_type (TYPE_CODE_FLT, floatformat_i387_ext.totalsize / 8,
+ 0, "builtin_type_i387_ext", NULL);
+ builtin_type_m68881_ext =
+ init_type (TYPE_CODE_FLT, floatformat_m68881_ext.totalsize / 8,
+ 0, "builtin_type_m68881_ext", NULL);
+ builtin_type_i960_ext =
+ init_type (TYPE_CODE_FLT, floatformat_i960_ext.totalsize / 8,
+ 0, "builtin_type_i960_ext", NULL);
+ builtin_type_m88110_ext =
+ init_type (TYPE_CODE_FLT, floatformat_m88110_ext.totalsize / 8,
+ 0, "builtin_type_m88110_ext", NULL);
+ builtin_type_m88110_harris_ext =
+ init_type (TYPE_CODE_FLT, floatformat_m88110_harris_ext.totalsize / 8,
+ 0, "builtin_type_m88110_harris_ext", NULL);
+ builtin_type_arm_ext_big =
+ init_type (TYPE_CODE_FLT, floatformat_arm_ext_big.totalsize / 8,
+ 0, "builtin_type_arm_ext_big", NULL);
+ builtin_type_arm_ext_littlebyte_bigword =
+ init_type (TYPE_CODE_FLT, floatformat_arm_ext_littlebyte_bigword.totalsize / 8,
+ 0, "builtin_type_arm_ext_littlebyte_bigword", NULL);
+ builtin_type_ia64_spill_big =
+ init_type (TYPE_CODE_FLT, floatformat_ia64_spill_big.totalsize / 8,
+ 0, "builtin_type_ia64_spill_big", NULL);
+ builtin_type_ia64_spill_little =
+ init_type (TYPE_CODE_FLT, floatformat_ia64_spill_little.totalsize / 8,
+ 0, "builtin_type_ia64_spill_little", NULL);
+ builtin_type_ia64_quad_big =
+ init_type (TYPE_CODE_FLT, floatformat_ia64_quad_big.totalsize / 8,
+ 0, "builtin_type_ia64_quad_big", NULL);
+ builtin_type_ia64_quad_little =
+ init_type (TYPE_CODE_FLT, floatformat_ia64_quad_little.totalsize / 8,
+ 0, "builtin_type_ia64_quad_little", NULL);
add_show_from_set (
add_set_cmd ("overload", no_class, var_zinteger, (char *) &overload_debug,
Index: gdbtypes.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.h,v
retrieving revision 1.12
diff -p -r1.12 gdbtypes.h
*** gdbtypes.h 2001/08/21 00:24:58 1.12
--- gdbtypes.h 2001/08/22 00:41:05
*************** extern struct type *builtin_type_v4si;
*** 887,892 ****
--- 893,916 ----
extern struct type *builtin_type_v8qi;
extern struct type *builtin_type_v4hi;
extern struct type *builtin_type_v2si;
+
+ /* Explicit floating-point formats. See "floatformat.h". */
+ extern struct type *builtin_type_ieee_single_big;
+ extern struct type *builtin_type_ieee_single_little;
+ extern struct type *builtin_type_ieee_double_big;
+ extern struct type *builtin_type_ieee_double_little;
+ extern struct type *builtin_type_ieee_double_littlebyte_bigword;
+ extern struct type *builtin_type_i387_ext;
+ extern struct type *builtin_type_m68881_ext;
+ extern struct type *builtin_type_i960_ext;
+ extern struct type *builtin_type_m88110_ext;
+ extern struct type *builtin_type_m88110_harris_ext;
+ extern struct type *builtin_type_arm_ext_big;
+ extern struct type *builtin_type_arm_ext_littlebyte_bigword;
+ extern struct type *builtin_type_ia64_spill_big;
+ extern struct type *builtin_type_ia64_spill_little;
+ extern struct type *builtin_type_ia64_quad_big;
+ extern struct type *builtin_type_ia64_quad_little;
/* We use this for the '/c' print format, because builtin_type_char is
just a one-byte integral type, which languages less laid back than