diff options
author | Carl Love <cel@us.ibm.com> | 2023-03-23 18:23:05 -0400 |
---|---|---|
committer | Carl Love <cel@us.ibm.com> | 2023-04-18 11:03:08 -0400 |
commit | c1a398a320f46905eaf6f520dddc441791861dcb (patch) | |
tree | cc83eb566cd1183ca7e6d94c6a755d997a2987a4 /gdb/gdbarch_components.py | |
parent | a02676b77d84d8229b5d4b01259535234cded19e (diff) | |
download | binutils-gdb-c1a398a320f46905eaf6f520dddc441791861dcb.tar.gz |
PowerPC: fix _Float128 type output string
PowerPC supports two 128-bit floating point formats, the IBM long double
and IEEE 128-bit float. The issue is the DWARF information does not
distinguish between the two. There have been proposals of how to extend
the DWARF information as discussed in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104194
but has not been fully implemented.
GCC introduced the _Float128 internal type as a work around for the issue.
The workaround is not transparent to GDB. The internal _Float128 type
name is printed rather then the user specified long double type. This
patch adds a new gdbarch method to allow PowerPC to detect the GCC
workaround. The workaround checks for "_Float128" name when reading the
base typedef from the die_info. If the workaround is detected, the type
and format fields from the _Float128 typedef are copied to the long
double typedef. The same is done for the complex long double typedef.
This patch fixes 74 regression test failures in
gdb.base/whatis-ptype-typedefs.exp on PowerPC with IEEE float 128 as the
default on GCC. It fixes one regression test failure in
gdb.base/complex-parts.exp.
The patch has been tested on Power 10 where GCC defaults to IEEE Float
128-bit and on Power 10 where GCC defaults to the IBM 128-bit float. The
patch as also been tested on X86-64 with no new regression failures.
Diffstat (limited to 'gdb/gdbarch_components.py')
-rw-r--r-- | gdb/gdbarch_components.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py index 9f0430c7770..a0e35b8b5e8 100644 --- a/gdb/gdbarch_components.py +++ b/gdb/gdbarch_components.py @@ -901,6 +901,29 @@ May return 0 when unable to determine that address.""", invalid=False, ) + +# The DWARF info currently does not distinquish between IEEE 128-bit floating +# point values and the IBM 128-bit floating point format. GCC has an internal +# hack to identify the IEEE 128-bit floating point value. The long double is a +# defined base type in C. The GCC hack uses a typedef for long double to +# reference_Float128 base to identify the long double as and IEEE 128-bit +# value. The following method is used to "fix" the long double type to be a +# base type with the IEEE float format info from the _Float128 basetype and +# the long double name. With the fix, the proper name is printed for the +# GDB typedef command. +Function( + comment=""" +Return true if the typedef record needs to be replaced.". + +Return 0 by default""", + type="bool", + name="dwarf2_omit_typedef_p", + params=[("struct type *", "target_type"), ("const char *", "producer"), + ("const char *", "name")], + predefault="default_dwarf2_omit_typedef_p", + invalid=False, +) + Method( comment=""" Return true if the return value of function is stored in the first hidden |