-# Copyright 2005-2018 Free Software Foundation, Inc.
+# Copyright 2005-2020 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
proc test_gdb_complete { expr expected_output } {
gdb_test "complete p $expr" \
- "$expected_output" \
- "complete p $expr"
+ "$expected_output"
}
# A convenience function that verifies that the "complete EXPR" command
"p ambiguous_func"
test_gdb_complete "ambiguous_func" \
"p ambiguous_func"
+
+# Perform a test intented to verify the behavior where the number
+# of possible completions is very large. The goal is not to verify
+# precisely the list returned by the complete command (this depends
+# on too many parameters -- targets, compiler version, runtime, etc).
+# However, we want to sanity-check each one of them, knowing that
+# each result should start with "break ada" and that the proposed
+# completion should look like a valid symbol name (in particular,
+# no uppercase letters...). See gdb/22670. File names are OK as
+# well, which is why "/" and "-" appear in the regexp.
+
+gdb_test_no_output "set max-completions unlimited"
+
+set test "complete break ada"
+gdb_test_multiple "$test" $test {
+ -re "^$test$eol\(break ada\[-a-z0-9._@/\]*$eol\)+$gdb_prompt $" {
+ pass $test
+ }
+ -re "\[A-Z\].*$gdb_prompt $" {
+ fail "$test (gdb/22670)"
+ }
+}