aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@embecosm.com>2022-07-07 12:00:18 +0100
committerMaciej W. Rozycki <macro@embecosm.com>2022-07-07 12:00:18 +0100
commit309e147fbd26a433ec3a1e2cd346633bb615de29 (patch)
tree0081a7bf8cd62b113a8a834be69870d1aa7ca065 /gdb/testsuite
parent88de583569400f6c81caa6f943d1290d134ea48a (diff)
downloadgdb-309e147fbd26a433ec3a1e2cd346633bb615de29.zip
gdb-309e147fbd26a433ec3a1e2cd346633bb615de29.tar.gz
gdb-309e147fbd26a433ec3a1e2cd346633bb615de29.tar.bz2
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.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.base/printcmds.exp9
1 files changed, 9 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp
index 0a99f3d..60b9de4 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\""