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.
+2020-10-09 Hannes Domani <ssbssa@yahoo.de>
+
+ PR exp/26714
+ * printcmd.c (print_formatted): Handle void results as
+ unformatted prints.
+
2020-10-09 Andrew Burgess <andrew.burgess@embecosm.com>
* arch/aarch32.c (aarch32_create_target_description): Release the
}
if (options->format == 0 || options->format == 's'
+ || type->code () == TYPE_CODE_VOID
|| type->code () == TYPE_CODE_REF
|| type->code () == TYPE_CODE_ARRAY
|| type->code () == TYPE_CODE_STRING
+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
# 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"