mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-18 16:53:50 +08:00
[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.
This commit is contained in:
@ -201,7 +201,7 @@ Value(
|
||||
name="bfloat16_format",
|
||||
postdefault="floatformats_bfloat16",
|
||||
invalid=True,
|
||||
printer="pformat (gdbarch->bfloat16_format)",
|
||||
printer="pformat (gdbarch, gdbarch->bfloat16_format)",
|
||||
)
|
||||
|
||||
Value(
|
||||
@ -216,7 +216,7 @@ Value(
|
||||
name="half_format",
|
||||
postdefault="floatformats_ieee_half",
|
||||
invalid=True,
|
||||
printer="pformat (gdbarch->half_format)",
|
||||
printer="pformat (gdbarch, gdbarch->half_format)",
|
||||
)
|
||||
|
||||
Value(
|
||||
@ -231,7 +231,7 @@ Value(
|
||||
name="float_format",
|
||||
postdefault="floatformats_ieee_single",
|
||||
invalid=True,
|
||||
printer="pformat (gdbarch->float_format)",
|
||||
printer="pformat (gdbarch, gdbarch->float_format)",
|
||||
)
|
||||
|
||||
Value(
|
||||
@ -246,7 +246,7 @@ Value(
|
||||
name="double_format",
|
||||
postdefault="floatformats_ieee_double",
|
||||
invalid=True,
|
||||
printer="pformat (gdbarch->double_format)",
|
||||
printer="pformat (gdbarch, gdbarch->double_format)",
|
||||
)
|
||||
|
||||
Value(
|
||||
@ -261,7 +261,7 @@ Value(
|
||||
name="long_double_format",
|
||||
postdefault="floatformats_ieee_double",
|
||||
invalid=True,
|
||||
printer="pformat (gdbarch->long_double_format)",
|
||||
printer="pformat (gdbarch, gdbarch->long_double_format)",
|
||||
)
|
||||
|
||||
Value(
|
||||
|
Reference in New Issue
Block a user