From: Maciej W. Rozycki Date: Thu, 7 Jul 2022 11:00:18 +0000 (+0100) Subject: GDB/testsuite: Add coverage for `print -elements' command X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=309e147fbd26a433ec3a1e2cd346633bb615de29;p=binutils-gdb.git GDB/testsuite: Add coverage for `print -elements' command We currently have no coverage for the `print -elements ...' command (or `p -elements ...' in the shortened form), so add a couple of test cases mimicking ones using corresponding `set print elements ...' values. --- diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index 0a99f3d6f27..60b9de47e52 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -536,6 +536,15 @@ proc test_print_strings {} { gdb_test "p teststring" \ " = (.unsigned char .. )?\"teststring contents\"" "p teststring with elements set to 20" + gdb_test "p -elements 1 -- teststring" \ + " = (.unsigned char .. )?\"t\"\\.\\.\\." + gdb_test "p -elements 5 -- teststring" \ + " = (.unsigned char .. )?\"tests\"\\.\\.\\." + gdb_test "p -elements 19 -- teststring" \ + " = (.unsigned char .. )?\"teststring contents\"" + gdb_test "p -elements 20 -- teststring" \ + " = (.unsigned char .. )?\"teststring contents\"" + gdb_test "print teststring2" \ " = \\(charptr\\) \"more contents\""