diff options
author | Joel Brobecker <brobecker@gnat.com> | 2012-01-26 04:20:36 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2012-01-26 04:20:36 +0000 |
commit | 74ccd7f58b78303b1de7c7823d39821119592c20 (patch) | |
tree | 80d5cc92610d9679038af4766b25179729e3999c /gdb/linespec.c | |
parent | b8b196db1ef731b7d9de7f332dd745f3240d8623 (diff) | |
download | gdb-74ccd7f58b78303b1de7c7823d39821119592c20.zip gdb-74ccd7f58b78303b1de7c7823d39821119592c20.tar.gz gdb-74ccd7f58b78303b1de7c7823d39821119592c20.tar.bz2 |
Ada: allow unqualified function names in linespecs
This is the meat, where we replace the old la_symbol_name_compare
language method with the new ada_get_symbol_name_match_p.
It fixes the problem when trying to insert a breakpoint on "+".
gdb/ChangeLog:
* language.h (symbol_name_match_p_ftype): New typedef.
(struct language_defn): Replace field la_symbol_name_compare
by la_get_symbol_name_match_p.
* ada-lang.c (ada_get_symbol_name_match_p): New function.
(ada_language_defn): Use it.
* linespec.c (struct symbol_matcher_data): New type.
(iterate_name_matcher): Rewrite.
(iterate_over_all_matching_symtabs): Pass a pointer to
a symbol_matcher_data struct to expand_symtabs_matching
instead of just the lookup name.
* c-lang.c, d-lang.c, jv-lang.c, m2-lang.c, objc-lang.c,
opencl-lang.c, p-lang.c, language.c: Delete field
la_symbol_name_compare, and replace by NULL for new field
la_get_symbol_name_match_p.
* symfile.h (struct quick_symbol_functions): Update comment.
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r-- | gdb/linespec.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c index 0782c54..28fcf4d 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -321,6 +321,17 @@ cplusplus_error (const char *name, const char *fmt, ...) throw_error (NOT_FOUND_ERROR, "%s", message); } +/* Some data for the expand_symtabs_matching callback. */ + +struct symbol_matcher_data +{ + /* The lookup name against which symbol name should be compared. */ + const char *lookup_name; + + /* The routine to be used for comparison. */ + symbol_name_match_p_ftype symbol_name_match_p; +}; + /* A helper for iterate_over_all_matching_symtabs that is passed as a callback to the expand_symtabs_matching method. */ @@ -328,9 +339,9 @@ static int iterate_name_matcher (const struct language_defn *language, const char *name, void *d) { - const char **dname = d; + const struct symbol_matcher_data *data = d; - if (language->la_symbol_name_compare (name, *dname) == 0) + if (data->symbol_name_match_p (name, data->lookup_name)) return 1; return 0; } @@ -349,6 +360,13 @@ iterate_over_all_matching_symtabs (const char *name, { struct objfile *objfile; struct program_space *pspace; + struct symbol_matcher_data matcher_data; + + matcher_data.lookup_name = name; + matcher_data.symbol_name_match_p = + current_language->la_get_symbol_name_match_p != NULL + ? current_language->la_get_symbol_name_match_p (name) + : strcmp_iw; ALL_PSPACES (pspace) { @@ -367,7 +385,7 @@ iterate_over_all_matching_symtabs (const char *name, objfile->sf->qf->expand_symtabs_matching (objfile, NULL, iterate_name_matcher, ALL_DOMAIN, - &name); + &matcher_data); ALL_OBJFILE_SYMTABS (objfile, symtab) { |