[PATCH v4 5/8] GDB/testsuite: Add coverage for `print -elements' command

Maciej W. Rozycki macro@embecosm.com
Wed Mar 9 19:18:23 GMT 2022


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.
---
New change in v4.
---
 gdb/testsuite/gdb.base/printcmds.exp |    9 +++++++++
 1 file changed, 9 insertions(+)

gdb-test-printcmd-options.diff
Index: src/gdb/testsuite/gdb.base/printcmds.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.base/printcmds.exp
+++ src/gdb/testsuite/gdb.base/printcmds.exp
@@ -519,6 +519,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\""
 


More information about the Gdb-patches mailing list