diff options
author | Pedro Alves <palves@redhat.com> | 2018-01-10 20:38:07 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2018-01-10 20:47:37 +0000 |
commit | c63d3e8d12f0b08cda95f89aa13274defed215f0 (patch) | |
tree | 4e46ac3e784408de56a7b5accb5f735e7fbcd10b /gdb/language.h | |
parent | d4c2a405cb7535d25b88e9b8dad0e557242950ca (diff) | |
download | gdb-c63d3e8d12f0b08cda95f89aa13274defed215f0.zip gdb-c63d3e8d12f0b08cda95f89aa13274defed215f0.tar.gz gdb-c63d3e8d12f0b08cda95f89aa13274defed215f0.tar.bz2 |
Ada: make verbatim matcher override other language matchers (PR gdb/22670)
A previous patch fixed verbatim matching in the lookup at the minimal
symbol level, but we should also be finding that same symbol through
the partial/full symtab search.
For example, this is what happens if we use "print" instead of
"break":
(gdb) p <MixedCaseFunc>
$1 = {<text variable, no debug info>} 0x4024dc <MixedCaseFunc>
Before the C++ wildmatching series, GDB knows that MixedCaseFunc is a
function without parameters, and the expression above means calling
it. If you try it before having started the inferior, you'd get the
following (expected) error:
(gdb) print <MixedCaseFunc>
You can't do that without a process to debug.
The main idea behind making the name matcher be determined by the
symbol's language is so that C++ (etc.) wildmatching in linespecs
works even if the current language is not C++, as e.g., when you step
through C or assembly code.
Ada's verbatim matching syntax however ("<...>") isn't quite the same.
It is more a property of the current language than of a particular
symbol's language. We want to support this syntax when debugging an
Ada program, but it's reason of existence is to find non-Ada symbols.
This suggests going back to enabling it depending on current language
instead of language of the symbol being matched.
I'm not entirely happy with the "current_language" reference (though I
think that it's harmless). I think we could try storing the current
language in the lookup_name_info object, and then convert a bunch of
functions more to pass around lookup_name_info objects instead of
"const char *" names. I.e., build the lookup_name_info higher up.
I'm not sure about that, I'll have to think more about it. Maybe
something different will be better. Meanwhile, this gets us going.
I've extended the testcase to also exercise a no-debug-info function,
for extra coverage of the minsyms-only paths.
gdb/ChangeLog:
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* dwarf2read.c
(gdb_index_symbol_name_matcher::gdb_index_symbol_name_matcher):
Adjust to use language_get_symbol_name_matcher instead of
language_defn::la_get_symbol_name_matcher.
* language.c (language_get_symbol_name_matcher): If in Ada mode
and the lookup name is a verbatim match, return Ada's matcher.
* language.h (language_get_symbol_name_matcher): Adjust comment.
(ada_lookup_name_info::verbatim_p):: New method.
gdb/testsuite/ChangeLog:
2018-01-10 Pedro Alves <palves@redhat.com>
PR gdb/22670
* gdb.ada/bp_c_mixed_case.exp: Add intro comment. Test printing C
functions too. Test setting breakpoints and printing C functions
with no debug info too.
* gdb.ada/bp_c_mixed_case/qux.c: New file.
Diffstat (limited to 'gdb/language.h')
-rw-r--r-- | gdb/language.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/language.h b/gdb/language.h index 49828f3..5061095 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -633,7 +633,10 @@ extern bool default_symbol_name_matcher completion_match_result *comp_match_res); /* Get LANG's symbol_name_matcher method for LOOKUP_NAME. Returns - default_symbol_name_matcher if not set. */ + default_symbol_name_matcher if not set. LANG is used as a hint; + the function may ignore it depending on the current language and + LOOKUP_NAME. Specifically, if the current language is Ada, this + may return an Ada matcher regardless of LANG. */ symbol_name_matcher_ftype *language_get_symbol_name_matcher (const language_defn *lang, const lookup_name_info &lookup_name); |