aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.base/completion.exp85
-rw-r--r--gdb/testsuite/gdb.linespec/ls-errs.exp3
2 files changed, 87 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index 1123b99..f77bfe2 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -67,6 +67,7 @@ if ![runto_main] then {
}
set timeout 30
+gdb_test_no_output "set max-completions unlimited"
gdb_test_no_output "complete print values\[0\].x." \
"field completion with invalid field"
@@ -775,4 +776,86 @@ gdb_test_multiple "" "$test" {
}
}
-return 0
+#
+# Completion limiting.
+#
+
+gdb_test_no_output "set max-completions 5"
+
+set test "command-name completion limiting using tab character"
+send_gdb "p\t"
+gdb_test_multiple "" "$test" {
+ -re "^p\\\x07$" {
+ send_gdb "\t"
+ gdb_test_multiple "" "$test" {
+ -re "List may be truncated, max-completions reached.*\r\n$gdb_prompt p$" {
+ # Complete the command and ignore the output to resync
+ # gdb for the next test.
+ send_gdb "\n"
+ gdb_test_multiple "" "$test" {
+ -re "$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+ }
+ -re "$gdb_prompt p$" {
+ # Complete the command and ignore the output to resync
+ # gdb for the next test.
+ send_gdb "\n"
+ gdb_test_multiple "" "$test" {
+ -re "$gdb_prompt $" {
+ fail "$test"
+ }
+ }
+ }
+ }
+ }
+}
+
+set test "command-name completion limiting using complete command"
+send_gdb "complete p\n"
+gdb_test_multiple "" "$test" {
+ -re "List may be truncated, max-completions reached.*\r\n$gdb_prompt $" {
+ pass "$test"
+ }
+}
+
+gdb_test_no_output "set max-completions 3"
+
+set test "symbol-name completion limiting using tab character"
+send_gdb "p marker\t"
+gdb_test_multiple "" "$test" {
+ -re "^p marker\\\x07$" {
+ send_gdb "\t"
+ gdb_test_multiple "" "$test" {
+ -re "List may be truncated, max-completions reached.*\r\n$gdb_prompt p marker$" {
+ # Complete the command and ignore the output to resync
+ # gdb for the next test.
+ send_gdb "\n"
+ gdb_test_multiple "" "$test" {
+ -re "$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+ }
+ -re "$gdb_prompt p marker$" {
+ # Complete the command and ignore the output to resync
+ # gdb for the next test.
+ send_gdb "\n"
+ gdb_test_multiple "" "$test" {
+ -re "$gdb_prompt $" {
+ fail "$test"
+ }
+ }
+ }
+ }
+ }
+}
+
+set test "symbol-name completion limiting using complete command"
+send_gdb "complete p mark\n"
+gdb_test_multiple "" "$test" {
+ -re "List may be truncated, max-completions reached.*\r\n$gdb_prompt $" {
+ pass "$test"
+ }
+}
diff --git a/gdb/testsuite/gdb.linespec/ls-errs.exp b/gdb/testsuite/gdb.linespec/ls-errs.exp
index 322598e..019312c 100644
--- a/gdb/testsuite/gdb.linespec/ls-errs.exp
+++ b/gdb/testsuite/gdb.linespec/ls-errs.exp
@@ -26,6 +26,9 @@ if {[prepare_for_testing $testfile $exefile $srcfile \
# Turn off the pending breakpoint queries.
gdb_test_no_output "set breakpoint pending off"
+# Turn off completion limiting
+gdb_test_no_output "set max-completions unlimited"
+
# We intentionally do not use gdb_breakpoint for these tests.
# Break at 'linespec' and expect the message in ::error_messages indexed by