diff options
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/ada-lang.c | 19 | ||||
-rw-r--r-- | gdb/symtab.c | 16 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/complete.exp | 4 |
5 files changed, 35 insertions, 18 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4c90a5b9dd..3ad43f82d5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,6 +1,14 @@ 2018-01-10 Pedro Alves <palves@redhat.com> PR gdb/22670 + * ada-lang.c (ada_collect_symbol_completion_matches): If the + minsym's language is language_auto or language_cplus, pass down + language_ada instead. + * symtab.c (compare_symbol_name): Don't frob symbol language here. + +2018-01-10 Pedro Alves <palves@redhat.com> + + PR gdb/22670 * minsyms.c (linkage_name_str): New function. (iterate_over_minimal_symbols): Use it. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 748e8196ab..6395184956 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -6499,8 +6499,25 @@ ada_collect_symbol_completion_matches (completion_tracker &tracker, if (completion_skip_symbol (mode, msymbol)) continue; + language symbol_language = MSYMBOL_LANGUAGE (msymbol); + + /* Ada minimal symbols won't have their language set to Ada. If + we let completion_list_add_name compare using the + default/C-like matcher, then when completing e.g., symbols in a + package named "pck", we'd match internal Ada symbols like + "pckS", which are invalid in an Ada expression, unless you wrap + them in '<' '>' to request a verbatim match. + + Unfortunately, some Ada encoded names successfully demangle as + C++ symbols (using an old mangling scheme), such as "name__2Xn" + -> "Xn::name(void)" and thus some Ada minimal symbols end up + with the wrong language set. Paper over that issue here. */ + if (symbol_language == language_auto + || symbol_language == language_cplus) + symbol_language = language_ada; + completion_list_add_name (tracker, - MSYMBOL_LANGUAGE (msymbol), + symbol_language, MSYMBOL_LINKAGE_NAME (msymbol), lookup_name, text, word); } diff --git a/gdb/symtab.c b/gdb/symtab.c index 146dc2e421..2fe249682f 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4704,21 +4704,7 @@ compare_symbol_name (const char *symbol_name, language symbol_language, const lookup_name_info &lookup_name, completion_match_result &match_res) { - const language_defn *lang; - - /* If we're completing for an expression and the symbol doesn't have - an explicit language set, fallback to the current language. Ada - minimal symbols won't have their language set to Ada, for - example, and if we compared using the default/C-like matcher, - then when completing e.g., symbols in a package named "pck", we'd - match internal Ada symbols like "pckS", which are invalid in an - Ada expression, unless you wrap them in '<' '>' to request a - verbatim match. */ - if (symbol_language == language_auto - && lookup_name.match_type () == symbol_name_match_type::EXPRESSION) - lang = current_language; - else - lang = language_def (symbol_language); + const language_defn *lang = language_def (symbol_language); symbol_name_matcher_ftype *name_match = language_get_symbol_name_matcher (lang, lookup_name); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 2d362d09ba..9e62ee8b08 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,6 +1,12 @@ 2018-01-10 Pedro Alves <palves@redhat.com> PR gdb/22670 + * gdb.ada/complete.exp ("complete break ada"): Replace kfail with + a fail. + +2018-01-10 Pedro Alves <palves@redhat.com> + + PR gdb/22670 * gdb.ada/bp_c_mixed_case.exp: Remove setup_kfail calls. 2018-01-08 Simon Marchi <simon.marchi@ericsson.com> diff --git a/gdb/testsuite/gdb.ada/complete.exp b/gdb/testsuite/gdb.ada/complete.exp index c1f22c2a3e..cb9e4ae7ff 100644 --- a/gdb/testsuite/gdb.ada/complete.exp +++ b/gdb/testsuite/gdb.ada/complete.exp @@ -212,7 +212,7 @@ test_gdb_complete "ambiguous_func" \ # 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...). +# no uppercase letters...). See gdb/22670. gdb_test_no_output "set max-completions unlimited" @@ -222,6 +222,6 @@ gdb_test_multiple "$test" $test { pass $test } -re "\[A-Z\].*$gdb_prompt $" { - kfail gdb/22670 $test + fail "$test (gdb/22670)" } } |