iterate_over_symbols should be a wrapper? (was: "Re: GDB 7.4 branching status? (2011-11-23)")

Joel Brobecker brobecker@adacore.com
Tue Nov 29 02:49:00 GMT 2011


I noticed that the following linespec does not work for Ada anymore:

    (gdb) break FILE:FUNCTION

And that got me into looking how we do symbol matching. When no filename
is provided in the linespec, we call iterate_over_all_matching_symtabs,
which calls iterate_over_symbols over all symtabs, immediately followed
by:

    if (current_language->la_iterate_over_symbols)
      (*current_language->la_iterate_over_symbols) (name, domain,

So, basically, we do a first pass collecting symbols that follow
a certain matching algorithm, and then we do a second pass for
language that might require a different matching algorithm...
It seems to me that there should be only one, language-specific
matching routine, and iterate_over_symbols should call it.

So, my proposal is to change the profile of la_iterate_over_symbols
to match the iterate_over_symbols routine, and then then set
the la_iterate_over_symbols field to iterate_over_symbols for
all languages except Ada. The changes in ada_iterate_over_symbols
should be straightforward, since ada_lookup_symbol_list accepts
a block as well.

That would solve the problem above as well: When the linespec contains
a filename in it, add_matching_symbols_to_info only calls
iterate_over_symbols:

      else if (pspace == NULL || pspace == SYMTAB_PSPACE (elt))
        {
          [...]
          iterate_over_symbols (get_search_block (elt), name,
                                VAR_DOMAIN, collect_symbols,
                                info);
        }

In the meantime, I applied a different type of patch which just
follows the current approach of doing the generic matching first,
followed by the language-specific one next. Attached is the
corresponding patch.

-- 
Joel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Call-current_language-la_iterate_over_symbols-for-FI.patch
Type: text/x-diff
Size: 4305 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20111129/e67812a0/attachment.bin>


More information about the Gdb-patches mailing list