diff options
author | Hannes Domani <ssbssa@yahoo.de> | 2020-10-08 17:38:32 +0200 |
---|---|---|
committer | Hannes Domani <ssbssa@yahoo.de> | 2020-10-09 13:51:50 +0200 |
commit | 3d87245cc1a4310264d9cb0e4566517d3455a7f5 (patch) | |
tree | f40422303f174a6b63d393fe41457400e4f82513 /gdb/testsuite | |
parent | bbb826f5e92e26815357b7f3243f6b3453ec5bc1 (diff) | |
download | gdb-3d87245cc1a4310264d9cb0e4566517d3455a7f5.zip gdb-3d87245cc1a4310264d9cb0e4566517d3455a7f5.tar.gz gdb-3d87245cc1a4310264d9cb0e4566517d3455a7f5.tar.bz2 |
Handle void results as unformatted prints
When printing void results without any format letter, they are output
as expected:
(gdb) p $abcd
$1 = void
(gdb) p (void)10
$2 = void
But if any format letter (besides s) is used, it always outputs zero:
(gdb) p/x $abcd
$3 = 0x0
(gdb) p/x (void)10
$4 = 0x0
So this adds void results to the types handled like unformatted prints.
gdb/ChangeLog:
2020-10-09 Hannes Domani <ssbssa@yahoo.de>
PR exp/26714
* printcmd.c (print_formatted): Handle void results as
unformatted prints.
gdb/testsuite/ChangeLog:
2020-10-09 Hannes Domani <ssbssa@yahoo.de>
PR exp/26714
* gdb.base/printcmds.exp: Add tests for void results.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/printcmds.exp | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3d88199..e1b623b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-10-09 Hannes Domani <ssbssa@yahoo.de> + + PR exp/26714 + * gdb.base/printcmds.exp: Add tests for void results. + 2020-10-09 Jan Vrany <jan.vrany@labware.com> * gdb.mi/mi-cmd-param-changed.exp: Check that notification is diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index 0a96b22..08a0961 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -1005,6 +1005,11 @@ gdb_test "print sizeof (\$cvar)" " = 4" # Similarly, printf of a string convenience var should work without a target. test_printf_convenience_var "no target" +# Test void results. +gdb_test "p (void)10" " = void" +gdb_test "p/x (void)10" " = void" +gdb_test "p \$abcd" " = void" + # GDB used to complete the explicit location options even when # printing expressions. gdb_test_no_output "complete p -function" |