* [RFA] Use symbol search name in expand_symtabs_matching_via_partial...
@ 2011-12-13 20:45 Joel Brobecker
2011-12-13 21:10 ` Jan Kratochvil
0 siblings, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2011-12-13 20:45 UTC (permalink / raw)
To: gdb-patches; +Cc: Joel Brobecker
We are iterating over all symbols in a partial symtab that would
match a given name, so we should match the partial symbols
search name against the given name rather than using the natural
name. In C++, that does not make a difference, but it does in
Ada, because Ada searches using the symbol encoded name...
gdb/ChangeLog:
* psymtab.c (expand_symtabs_matching_via_partial): Match
the partial symbols using their SYMBOL_SEARCH_NAME.
Tested on x86_64-linux. OK to commit?
---
gdb/psymtab.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 74185cc..861b302 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1305,7 +1305,7 @@ expand_symtabs_matching_via_partial
|| (kind == TYPES_DOMAIN
&& SYMBOL_CLASS (*psym) == LOC_TYPEDEF))
&& (*name_matcher) (current_language,
- SYMBOL_NATURAL_NAME (*psym), data))
+ SYMBOL_SEARCH_NAME (*psym), data))
{
PSYMTAB_TO_SYMTAB (ps);
keep_going = 0;
--
1.7.1
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [RFA] Use symbol search name in expand_symtabs_matching_via_partial... 2011-12-13 20:45 [RFA] Use symbol search name in expand_symtabs_matching_via_partial Joel Brobecker @ 2011-12-13 21:10 ` Jan Kratochvil 2011-12-13 21:30 ` Joel Brobecker 0 siblings, 1 reply; 7+ messages in thread From: Jan Kratochvil @ 2011-12-13 21:10 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches On Tue, 13 Dec 2011 21:33:50 +0100, Joel Brobecker wrote: > In C++, that does not make a difference, but it does in > Ada, because Ada searches using the symbol encoded name... That is more your Ada decision then... > --- a/gdb/psymtab.c > +++ b/gdb/psymtab.c > @@ -1305,7 +1305,7 @@ expand_symtabs_matching_via_partial > || (kind == TYPES_DOMAIN > && SYMBOL_CLASS (*psym) == LOC_TYPEDEF)) > && (*name_matcher) (current_language, > - SYMBOL_NATURAL_NAME (*psym), data)) > + SYMBOL_SEARCH_NAME (*psym), data)) It will need the same change for .gdb_index in write_psymbols. It would also mean .gdb_index version should be increased and backward compatibility implemented although IMHO it can be ignored for Ada, not sure if Ada users deploy .gdb_index. Thanks, Jan ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] Use symbol search name in expand_symtabs_matching_via_partial... 2011-12-13 21:10 ` Jan Kratochvil @ 2011-12-13 21:30 ` Joel Brobecker 2011-12-13 21:33 ` Jan Kratochvil 0 siblings, 1 reply; 7+ messages in thread From: Joel Brobecker @ 2011-12-13 21:30 UTC (permalink / raw) To: Jan Kratochvil; +Cc: gdb-patches > > --- a/gdb/psymtab.c > > +++ b/gdb/psymtab.c > > @@ -1305,7 +1305,7 @@ expand_symtabs_matching_via_partial > > || (kind == TYPES_DOMAIN > > && SYMBOL_CLASS (*psym) == LOC_TYPEDEF)) > > && (*name_matcher) (current_language, > > - SYMBOL_NATURAL_NAME (*psym), data)) > > + SYMBOL_SEARCH_NAME (*psym), data)) > > It will need the same change for .gdb_index in write_psymbols. > > It would also mean .gdb_index version should be increased and backward > compatibility implemented although IMHO it can be ignored for Ada, not sure if > Ada users deploy .gdb_index. Thanks for the quick review, Jan. How about the following. As explained in the revision history, I ended up not incrementing the version number, because I don't think we have a compatibility issue. The only language for which it would have made a difference (search-name != natural-name) is Ada, and the feature is not supported for Ada. So... gdb/ChangeLog: * psymtab.c (expand_symtabs_matching_via_partial): Match the partial symbols using their SYMBOL_SEARCH_NAME. * dwarf2read.c (write_psymbols): Use SYMBOL_SEARCH_NAME instead of SYMBOL_NATURAL_NAME in index entry. Still testing, but I do not expect any regression. Thanks, -- Joel commit a46ee1ab51430ba315cb20bb46555f5e76d4171e Author: Joel Brobecker <brobecker@adacore.com> Date: Tue Dec 13 15:24:53 2011 -0500 Use symbol search name in expand_symtabs_matching_via_partial... We are iterating over all symbols in a partial symtab that would match a given name, so we should match the partial symbols search name against the given name rather than using the natural name. In C++, that does not make a difference, but it does in Ada, because Ada searches using the symbol encoded name... We also update the generation of the .gdb_index file to match this change in the search. Although technically an incompatible change, we do not increment the gdb_index version number, because Ada is the only language where it would make a difference - except that this feature is not supported for Ada. gdb/ChangeLog: * psymtab.c (expand_symtabs_matching_via_partial): Match the partial symbols using their SYMBOL_SEARCH_NAME. * dwarf2read.c (write_psymbols): Use SYMBOL_SEARCH_NAME instead of SYMBOL_NATURAL_NAME in index entry. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index c482c43..7905052 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -16890,7 +16890,7 @@ write_psymbols (struct mapped_symtab *symtab, if (!*slot) { *slot = lookup; - add_index_entry (symtab, SYMBOL_NATURAL_NAME (*psymp), cu_index); + add_index_entry (symtab, SYMBOL_SEARCH_NAME (*psymp), cu_index); } } } diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 74185cc..861b302 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1305,7 +1305,7 @@ expand_symtabs_matching_via_partial || (kind == TYPES_DOMAIN && SYMBOL_CLASS (*psym) == LOC_TYPEDEF)) && (*name_matcher) (current_language, - SYMBOL_NATURAL_NAME (*psym), data)) + SYMBOL_SEARCH_NAME (*psym), data)) { PSYMTAB_TO_SYMTAB (ps); keep_going = 0; ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] Use symbol search name in expand_symtabs_matching_via_partial... 2011-12-13 21:30 ` Joel Brobecker @ 2011-12-13 21:33 ` Jan Kratochvil 2011-12-14 0:18 ` Joel Brobecker 2011-12-20 15:03 ` Tom Tromey 0 siblings, 2 replies; 7+ messages in thread From: Jan Kratochvil @ 2011-12-13 21:33 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches On Tue, 13 Dec 2011 22:25:47 +0100, Joel Brobecker wrote: > (search-name != natural-name) is Ada, and the feature is not supported > for Ada. So... I forgot, true, OK. Please update also the comment for expand_symtabs_matching in symfile.h . OK with me, unless Tom has comments. Thanks, Jan ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] Use symbol search name in expand_symtabs_matching_via_partial... 2011-12-13 21:33 ` Jan Kratochvil @ 2011-12-14 0:18 ` Joel Brobecker 2011-12-21 9:30 ` Joel Brobecker 2011-12-20 15:03 ` Tom Tromey 1 sibling, 1 reply; 7+ messages in thread From: Joel Brobecker @ 2011-12-14 0:18 UTC (permalink / raw) To: Jan Kratochvil; +Cc: gdb-patches > Please update also the comment for expand_symtabs_matching in symfile.h . > OK with me, unless Tom has comments. Here is the latest version. Will wait for Tom's comments... Thanks, -- Joel commit 3bd5c92a7f98feac47612559b60b64fae4e699d5 Author: Joel Brobecker <brobecker@adacore.com> Date: Tue Dec 13 15:24:53 2011 -0500 Use symbol search name in expand_symtabs_matching_via_partial... We are iterating over all symbols in a partial symtab that would match a given name, so we should match the partial symbols search name against the given name rather than using the natural name. In C++, that does not make a difference, but it does in Ada, because Ada searches using the symbol encoded name... We also update the generation of the .gdb_index file to match this change in the search. Although technically an incompatible change, we do not increment the gdb_index version number, because Ada is the only language where it would make a difference - except that this feature is not supported for Ada. gdb/ChangeLog: * psymtab.c (expand_symtabs_matching_via_partial): Match the partial symbols using their SYMBOL_SEARCH_NAME. * symfile.h (struct quick_symbol_functions): Udate the documentation of expand_symtabs_matching. * dwarf2read.c (write_psymbols): Use SYMBOL_SEARCH_NAME instead of SYMBOL_NATURAL_NAME in index entry. diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 74185cc..861b302 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1305,7 +1305,7 @@ expand_symtabs_matching_via_partial || (kind == TYPES_DOMAIN && SYMBOL_CLASS (*psym) == LOC_TYPEDEF)) && (*name_matcher) (current_language, - SYMBOL_NATURAL_NAME (*psym), data)) + SYMBOL_SEARCH_NAME (*psym), data)) { PSYMTAB_TO_SYMTAB (ps); keep_going = 0; diff --git a/gdb/symfile.h b/gdb/symfile.h index 44f0c01..91605a2 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -263,10 +263,9 @@ struct quick_symbol_functions If even KIND matches, then NAME_MATCHER is called for each symbol defined in the file. The current language, the symbol name and - DATA are passed to NAME_MATCHER. The symbol "natural" name should - be passed to NAME_MATCHER for all languages except Ada, where - the encoded name is passed instead (see la_symbol_name_compare in - struct language_defn for more details on this). + DATA are passed to NAME_MATCHER. The symbol "search" name should + be passed to NAME_MATCHER (see la_symbol_name_compare in struct + language_defn for more details on this). If NAME_MATCHER returns zero, then this symbol is skipped. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index c482c43..7905052 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -16890,7 +16890,7 @@ write_psymbols (struct mapped_symtab *symtab, if (!*slot) { *slot = lookup; - add_index_entry (symtab, SYMBOL_NATURAL_NAME (*psymp), cu_index); + add_index_entry (symtab, SYMBOL_SEARCH_NAME (*psymp), cu_index); } } } ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] Use symbol search name in expand_symtabs_matching_via_partial... 2011-12-14 0:18 ` Joel Brobecker @ 2011-12-21 9:30 ` Joel Brobecker 0 siblings, 0 replies; 7+ messages in thread From: Joel Brobecker @ 2011-12-21 9:30 UTC (permalink / raw) To: gdb-patches > gdb/ChangeLog: > > * psymtab.c (expand_symtabs_matching_via_partial): Match > the partial symbols using their SYMBOL_SEARCH_NAME. > * symfile.h (struct quick_symbol_functions): Udate the > documentation of expand_symtabs_matching. > * dwarf2read.c (write_psymbols): Use SYMBOL_SEARCH_NAME instead > of SYMBOL_NATURAL_NAME in index entry. Patch now checked in. Thanks Jan and Tom. -- Joel ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFA] Use symbol search name in expand_symtabs_matching_via_partial... 2011-12-13 21:33 ` Jan Kratochvil 2011-12-14 0:18 ` Joel Brobecker @ 2011-12-20 15:03 ` Tom Tromey 1 sibling, 0 replies; 7+ messages in thread From: Tom Tromey @ 2011-12-20 15:03 UTC (permalink / raw) To: Jan Kratochvil; +Cc: Joel Brobecker, gdb-patches >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes: Jan> OK with me, unless Tom has comments. It is fine by me. The symbol tables are driving me a little crazy. Tom ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-12-21 7:41 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-12-13 20:45 [RFA] Use symbol search name in expand_symtabs_matching_via_partial Joel Brobecker 2011-12-13 21:10 ` Jan Kratochvil 2011-12-13 21:30 ` Joel Brobecker 2011-12-13 21:33 ` Jan Kratochvil 2011-12-14 0:18 ` Joel Brobecker 2011-12-21 9:30 ` Joel Brobecker 2011-12-20 15:03 ` Tom Tromey
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox