diff options
author | Tom de Vries <tdevries@suse.de> | 2022-11-30 11:37:11 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2022-11-30 11:37:11 +0100 |
commit | aaa79cd62b873be672e3163eb267513c97ec4399 (patch) | |
tree | 9c7408044b19cc0d5d112de8361f84eb42df4324 /gdb/gdbarch.c | |
parent | 6bd454ca033dcb2e178721eb004d0c5f24415c4c (diff) | |
download | fsf-binutils-gdb-aaa79cd62b873be672e3163eb267513c97ec4399.zip fsf-binutils-gdb-aaa79cd62b873be672e3163eb267513c97ec4399.tar.gz fsf-binutils-gdb-aaa79cd62b873be672e3163eb267513c97ec4399.tar.bz2 |
[gdb] Improve printing of float formats
Currently, on x86_64, a little endian target, I get:
...
$ gdb -q -batch -ex "maint print architecture" | grep " = floatformat"
gdbarch_dump: bfloat16_format = floatformat_bfloat16_big
gdbarch_dump: double_format = floatformat_ieee_double_big
gdbarch_dump: float_format = floatformat_ieee_single_big
gdbarch_dump: half_format = floatformat_ieee_half_big
gdbarch_dump: long_double_format = floatformat_i387_ext
...
which suggests big endian.
This is due to this bit of code in pformat:
...
/* Just print out one of them - this is only for diagnostics. */
return format[0]->name;
...
Fix this by using gdbarch_byte_order to pick the appropriate index, such that
we have the more accurate:
...
gdbarch_dump: bfloat16_format = floatformat_bfloat16_little
gdbarch_dump: half_format = floatformat_ieee_half_little
gdbarch_dump: float_format = floatformat_ieee_single_little
gdbarch_dump: double_format = floatformat_ieee_double_little
gdbarch_dump: long_double_format = floatformat_i387_ext
...
Tested on x86_64-linux.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r-- | gdb/gdbarch.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 3227e94..ddb8dec 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -565,31 +565,31 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) plongest (gdbarch->bfloat16_bit)); gdb_printf (file, "gdbarch_dump: bfloat16_format = %s\n", - pformat (gdbarch->bfloat16_format)); + pformat (gdbarch, gdbarch->bfloat16_format)); gdb_printf (file, "gdbarch_dump: half_bit = %s\n", plongest (gdbarch->half_bit)); gdb_printf (file, "gdbarch_dump: half_format = %s\n", - pformat (gdbarch->half_format)); + pformat (gdbarch, gdbarch->half_format)); gdb_printf (file, "gdbarch_dump: float_bit = %s\n", plongest (gdbarch->float_bit)); gdb_printf (file, "gdbarch_dump: float_format = %s\n", - pformat (gdbarch->float_format)); + pformat (gdbarch, gdbarch->float_format)); gdb_printf (file, "gdbarch_dump: double_bit = %s\n", plongest (gdbarch->double_bit)); gdb_printf (file, "gdbarch_dump: double_format = %s\n", - pformat (gdbarch->double_format)); + pformat (gdbarch, gdbarch->double_format)); gdb_printf (file, "gdbarch_dump: long_double_bit = %s\n", plongest (gdbarch->long_double_bit)); gdb_printf (file, "gdbarch_dump: long_double_format = %s\n", - pformat (gdbarch->long_double_format)); + pformat (gdbarch, gdbarch->long_double_format)); gdb_printf (file, "gdbarch_dump: wchar_bit = %s\n", plongest (gdbarch->wchar_bit)); |