{
char *demangled = NULL;
int i;
- int recognized;
if (gsymbol->language == language_unknown)
gsymbol->language = language_auto;
{
return find_pc_sect_compunit_symtab (pc, find_pc_mapped_section (pc));
}
+
+/* See symtab.h. */
+
+struct symbol *
+find_symbol_at_address (CORE_ADDR address)
+{
+ struct objfile *objfile;
+
+ ALL_OBJFILES (objfile)
+ {
+ if (objfile->sf == NULL
+ || objfile->sf->qf->find_compunit_symtab_by_address == NULL)
+ continue;
+
+ struct compunit_symtab *symtab
+ = objfile->sf->qf->find_compunit_symtab_by_address (objfile, address);
+ if (symtab != NULL)
+ {
+ const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (symtab);
+
+ for (int i = GLOBAL_BLOCK; i <= STATIC_BLOCK; ++i)
+ {
+ struct block *b = BLOCKVECTOR_BLOCK (bv, i);
+ struct block_iterator iter;
+ struct symbol *sym;
+
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
+ {
+ if (SYMBOL_CLASS (sym) == LOC_STATIC
+ && SYMBOL_VALUE_ADDRESS (sym) == address)
+ return sym;
+ }
+ }
+ }
+ }
+
+ return NULL;
+}
+
\f
/* Find the source file and line number for a given PC value and SECTION.
symbol *
find_function_alias_target (bound_minimal_symbol msymbol)
{
- if (!msymbol_is_text (msymbol.minsym))
+ CORE_ADDR func_addr;
+ if (!msymbol_is_function (msymbol.objfile, msymbol.minsym, &func_addr))
return NULL;
- CORE_ADDR addr = BMSYMBOL_VALUE_ADDRESS (msymbol);
- symbol *sym = find_pc_function (addr);
+ symbol *sym = find_pc_function (func_addr);
if (sym != NULL
&& SYMBOL_CLASS (sym) == LOC_BLOCK
- && BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) == addr)
+ && BLOCK_START (SYMBOL_BLOCK_VALUE (sym)) == func_addr)
return sym;
return NULL;
and <TYPENAME> or <OPERATOR>. */
const char *opend;
const char *opname = operator_chars (regexp, &opend);
- int errcode;
if (*opname)
{
symbol_name_matcher_ftype *name_match
= language_get_symbol_name_matcher (lang, lookup_name);
- return name_match (symbol_name, lookup_name, &match_res.match);
+ return name_match (symbol_name, lookup_name, &match_res);
}
/* See symtab.h. */
gdb::unique_xmalloc_ptr<char> completion (newobj);
- tracker.add_completion (std::move (completion));
+ /* Here we pass the match-for-lcd object to add_completion. Some
+ languages match the user text against substrings of symbol
+ names in some cases. E.g., in C++, "b push_ba" completes to
+ "std::vector::push_back", "std::string::push_back", etc., and
+ in this case we want the completion lowest common denominator
+ to be "push_back" instead of "std::". */
+ tracker.add_completion (std::move (completion),
+ &match_res.match_for_lcd);
}
}
}
}
+/* See symtab.h. */
+
+bool
+symbol_is_function_or_method (symbol *sym)
+{
+ switch (TYPE_CODE (SYMBOL_TYPE (sym)))
+ {
+ case TYPE_CODE_FUNC:
+ case TYPE_CODE_METHOD:
+ return true;
+ default:
+ return false;
+ }
+}
+
+/* See symtab.h. */
+
+bool
+symbol_is_function_or_method (minimal_symbol *msymbol)
+{
+ switch (MSYMBOL_TYPE (msymbol))
+ {
+ case mst_text:
+ case mst_text_gnu_ifunc:
+ case mst_solib_trampoline:
+ case mst_file_text:
+ return true;
+ default:
+ return false;
+ }
+}
+
/* Add matching symbols from SYMTAB to the current completion list. */
static void
add_symtab_completions (struct compunit_symtab *cust,
completion_tracker &tracker,
+ complete_symbol_mode mode,
const lookup_name_info &lookup_name,
const char *text, const char *word,
enum type_code code)
b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), i);
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
+ if (completion_skip_symbol (mode, sym))
+ continue;
+
if (code == TYPE_CODE_UNDEF
|| (SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN
&& TYPE_CODE (SYMBOL_TYPE (sym)) == code))
{
QUIT;
+ if (completion_skip_symbol (mode, msymbol))
+ continue;
+
completion_list_add_msymbol (tracker, msymbol, lookup_name,
sym_text, word);
/* Add completions for all currently loaded symbol tables. */
ALL_COMPUNITS (objfile, cust)
- add_symtab_completions (cust, tracker, lookup_name,
+ add_symtab_completions (cust, tracker, mode, lookup_name,
sym_text, word, code);
/* Look through the partial symtabs for all symbols which begin by
[&] (compunit_symtab *symtab) /* expansion notify */
{
add_symtab_completions (symtab,
- tracker, lookup_name,
+ tracker, mode, lookup_name,
sym_text, word, code);
},
ALL_DOMAIN);
iterate_over_symtabs (srcfile, [&] (symtab *s)
{
add_symtab_completions (SYMTAB_COMPUNIT (s),
- tracker, lookup_name,
+ tracker, mode, lookup_name,
sym_text, word, TYPE_CODE_UNDEF);
return false;
});
struct template_symbol *result;
result = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct template_symbol);
- initialize_objfile_symbol_1 (&result->base);
+ initialize_objfile_symbol_1 (result);
return result;
}