This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/22584] Regression: expression completer and scope operator ("p std::[TAB]" => "p std::std::")


https://sourceware.org/bugzilla/show_bug.cgi?id=22584

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pedro Alves <palves@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a22ecf70263eff75ca2c5878fe7e8d0311d6737f

commit a22ecf70263eff75ca2c5878fe7e8d0311d6737f
Author: Pedro Alves <palves@redhat.com>
Date:   Wed Dec 13 16:38:50 2017 +0000

    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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]