summaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-12-13 16:38:50 +0000
committerPedro Alves <palves@redhat.com>2017-12-13 16:38:50 +0000
commita22ecf70263eff75ca2c5878fe7e8d0311d6737f (patch)
tree32c859e168f65ea5e7581d8305a0a7e93e194688 /gdb/testsuite/lib
parent60a20c190789fd75d1955576160cbbfe94c792fb (diff)
Fix regression: expression completer and scope operator (PR gdb/22584)
I noticed this regression in the expression completer: "(gdb) p std::[TAB]" => "(gdb) p std::std::" obviously we should have not completed to "std::std::". The problem is that in the earlier big completer rework, I missed taking into account the fact that with expressions, the completion word point is not always at the start of the symbol name (it is with linespecs). The fix is to run the common prefix / LCD string (what readline uses to expand the input line) through make_completion_match_str too. New testcase included, exercising both TAB completion and the complete command. gdb/ChangeLog: 2017-12-13 Pedro Alves <palves@redhat.com> * completer.c (completion_tracker::maybe_add_completion): New 'text' and 'word' parameters. Use make_completion_match_str. (completion_tracker::add_completion): New 'text' and 'word' parameters. Pass down. (completion_tracker::recompute_lowest_common_denominator): Change parameter type to gdb::unique_xmalloc_ptr rval ref. Adjust. * completer.h (completion_tracker::add_completion): New 'text' and 'word' parameters. (completion_tracker::recompute_lowest_common_denominator): Change parameter type to gdb::unique_xmalloc_ptr rval ref. (completion_tracker::recompute_lowest_common_denominator): Change parameter type to gdb::unique_xmalloc_ptr rval ref. * symtab.c (completion_list_add_name): Pass down 'text' and 'word' as well. gdb/testsuite/ChangeLog: 2017-12-13 Pedro Alves <palves@redhat.com> * gdb.cp/cpcompletion.exp: Load completion-support.exp. ("expression with namespace"): New set of tests. * gdb.cp/pr9594.cc (Test_NS::foo, Test_NS::bar) (Nested::Test_NS::qux): New. * lib/completion-support.exp (test_gdb_complete_cmd_multiple): Add defaults to 'start_quote_char' and 'end_quote_char' parameters.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/completion-support.exp2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/testsuite/lib/completion-support.exp b/gdb/testsuite/lib/completion-support.exp
index c7cc1c9755..fe5b16a85b 100644
--- a/gdb/testsuite/lib/completion-support.exp
+++ b/gdb/testsuite/lib/completion-support.exp
@@ -178,7 +178,7 @@ proc test_gdb_complete_cmd_unique { input_line complete_line_re } {
# complete command displays the COMPLETION_LIST completion list. Each
# entry in the list should be prefixed by CMD_PREFIX.
-proc test_gdb_complete_cmd_multiple { cmd_prefix completion_word completion_list start_quote_char end_quote_char } {
+proc test_gdb_complete_cmd_multiple { cmd_prefix completion_word completion_list {start_quote_char ""} {end_quote_char ""} } {
global gdb_prompt
set expected_re [make_cmd_completion_list_re $cmd_prefix $completion_list $start_quote_char $end_quote_char]