This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/3] Fix gdb.base/completion.exp with --target_board=dwarf4-gdb-index
Pedro Alves <palves@redhat.com> writes:
Hi Pedro,
I don't know much about symbtab,
> - /* Find the symtab for SRCFILE (this loads it if it was not yet read
> - in). */
> - s = lookup_symtab (srcfile);
> - if (s == NULL)
> + /* Go through symtabs for SRCFILE and check the externs and statics
> + for symbols which match. */
> + iterate_over_symtabs (srcfile, [&] (struct symtab *symtab)
> {
> - /* Maybe they typed the file with leading directories, while the
> - symbol tables record only its basename. */
> - const char *tail = lbasename (srcfile);
> -
> - if (tail > srcfile)
> - s = lookup_symtab (tail);
This is removed, do we have something equivalent in iterate_over_symtabs?
> - }
> -
> - /* If we have no symtab for that file, return an empty list. */
> - if (s == NULL)
> - return (return_val);
> -
> - /* Go through this symtab and check the externs and statics for
> - symbols which match. */
> -
> - b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), GLOBAL_BLOCK);
> - ALL_BLOCK_SYMBOLS (b, iter, sym)
> - {
> - COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
> - }
> -
> - b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), STATIC_BLOCK);
> - ALL_BLOCK_SYMBOLS (b, iter, sym)
> - {
> - COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
> - }
> + add_symtab_completions (symtab->compunit_symtab,
use SYMTAB_COMPUNIT (s)
> + sym_text, sym_text_len,
> + text, word, TYPE_CODE_UNDEF);
Can you split this part out this patch as a pure refactor?
--
Yao (齐尧)