mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
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.
This commit is contained in:
@@ -114,6 +114,7 @@ struct gdbarch
|
||||
gdbarch_return_value_ftype *return_value = nullptr;
|
||||
gdbarch_return_value_as_value_ftype *return_value_as_value = default_gdbarch_return_value;
|
||||
gdbarch_get_return_buf_addr_ftype *get_return_buf_addr = default_get_return_buf_addr;
|
||||
gdbarch_dwarf2_omit_typedef_p_ftype *dwarf2_omit_typedef_p = default_dwarf2_omit_typedef_p;
|
||||
gdbarch_return_in_first_hidden_param_p_ftype *return_in_first_hidden_param_p = default_return_in_first_hidden_param_p;
|
||||
gdbarch_skip_prologue_ftype *skip_prologue = nullptr;
|
||||
gdbarch_skip_main_prologue_ftype *skip_main_prologue = nullptr;
|
||||
@@ -370,6 +371,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
|
||||
if ((gdbarch->return_value_as_value == default_gdbarch_return_value) == (gdbarch->return_value == nullptr))
|
||||
log.puts ("\n\treturn_value_as_value");
|
||||
/* Skip verify of get_return_buf_addr, invalid_p == 0 */
|
||||
/* Skip verify of dwarf2_omit_typedef_p, invalid_p == 0 */
|
||||
/* Skip verify of return_in_first_hidden_param_p, invalid_p == 0 */
|
||||
if (gdbarch->skip_prologue == 0)
|
||||
log.puts ("\n\tskip_prologue");
|
||||
@@ -788,6 +790,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
|
||||
gdb_printf (file,
|
||||
"gdbarch_dump: get_return_buf_addr = <%s>\n",
|
||||
host_address_to_string (gdbarch->get_return_buf_addr));
|
||||
gdb_printf (file,
|
||||
"gdbarch_dump: dwarf2_omit_typedef_p = <%s>\n",
|
||||
host_address_to_string (gdbarch->dwarf2_omit_typedef_p));
|
||||
gdb_printf (file,
|
||||
"gdbarch_dump: return_in_first_hidden_param_p = <%s>\n",
|
||||
host_address_to_string (gdbarch->return_in_first_hidden_param_p));
|
||||
@@ -2617,6 +2622,23 @@ set_gdbarch_get_return_buf_addr (struct gdbarch *gdbarch,
|
||||
gdbarch->get_return_buf_addr = get_return_buf_addr;
|
||||
}
|
||||
|
||||
bool
|
||||
gdbarch_dwarf2_omit_typedef_p (struct gdbarch *gdbarch, struct type *target_type, const char *producer, const char *name)
|
||||
{
|
||||
gdb_assert (gdbarch != NULL);
|
||||
gdb_assert (gdbarch->dwarf2_omit_typedef_p != NULL);
|
||||
if (gdbarch_debug >= 2)
|
||||
gdb_printf (gdb_stdlog, "gdbarch_dwarf2_omit_typedef_p called\n");
|
||||
return gdbarch->dwarf2_omit_typedef_p (target_type, producer, name);
|
||||
}
|
||||
|
||||
void
|
||||
set_gdbarch_dwarf2_omit_typedef_p (struct gdbarch *gdbarch,
|
||||
gdbarch_dwarf2_omit_typedef_p_ftype dwarf2_omit_typedef_p)
|
||||
{
|
||||
gdbarch->dwarf2_omit_typedef_p = dwarf2_omit_typedef_p;
|
||||
}
|
||||
|
||||
int
|
||||
gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch, struct type *type)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user