diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 16905ac636d..0d322da69c5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-11-15 Joel Brobecker + + * printcmd.c (print_scalar_formatted): Add fixed-point type + handling when options->format is set. + 2020-11-15 Joel Brobecker * ada-valprint.c (ada_value_print_1): Add fixed-point type handling. diff --git a/gdb/printcmd.c b/gdb/printcmd.c index f7186c296af..665142446f4 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -421,7 +421,8 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type, range case, we want to avoid this, so we store the unpacked value here for possible use later. */ gdb::optional val_long; - if ((type->code () == TYPE_CODE_FLT + if (((type->code () == TYPE_CODE_FLT + || is_fixed_point_type (type)) && (options->format == 'o' || options->format == 'x' || options->format == 't' diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 0f629bd76b9..9b9ffe51133 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2020-11-15 Joel Brobecker + + * gdb.dwarf2/dw2-fixed-point.exp: Add "print /x" tests. + 2020-11-15 Joel Brobecker * gdb.ada/fixed_cmp.exp: Force compilation to use -fgnat-encodings=all. diff --git a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp index bf88ffe4f73..27c549c602f 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-fixed-point.exp @@ -122,11 +122,23 @@ gdb_test_no_output "set lang ada" gdb_test "print pck.fp1_var" \ " = 0.25" +gdb_test "print /x pck.fp1_var" \ + " = 0x0" + gdb_test "print pck.fp2_var" \ " = -0.01" +gdb_test "print /x pck.fp2_var" \ + " = 0x0" + gdb_test "print pck.fp3_var" \ " = 0.1" +gdb_test "print /x pck.fp3_var" \ + " = 0x0" + gdb_test "print pck.fp1_range_var" \ " = 1" + +gdb_test "print /x pck.fp1_range_var" \ + " = 0x1"