aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 02f5d4f..cd2bc8f 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2023,13 +2023,14 @@ lookup_language_this (const struct language_defn *lang,
lang->name (), host_address_to_string (block),
objfile_debug_name (block->objfile ()));
+ lookup_name_info this_name (lang->name_of_this (),
+ symbol_name_match_type::SEARCH_NAME);
+
while (block)
{
struct symbol *sym;
- sym = block_lookup_symbol (block, lang->name_of_this (),
- symbol_name_match_type::SEARCH_NAME,
- SEARCH_VFT);
+ sym = block_lookup_symbol (block, this_name, SEARCH_VFT);
if (sym != NULL)
{
symbol_lookup_debug_printf_v
@@ -2264,7 +2265,8 @@ lookup_symbol_in_block (const char *name, symbol_name_match_type match_type,
domain_name (domain).c_str ());
}
- sym = block_lookup_symbol (block, name, match_type, domain);
+ lookup_name_info lookup_name (name, match_type);
+ sym = block_lookup_symbol (block, lookup_name, domain);
if (sym)
{
symbol_lookup_debug_printf_v ("lookup_symbol_in_block (...) = %s",
@@ -2438,7 +2440,8 @@ lookup_symbol_via_quick_fns (struct objfile *objfile,
block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
name, domain_name (domain).c_str ());
- cust = objfile->lookup_symbol (block_index, name, domain);
+ lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
+ cust = objfile->lookup_symbol (block_index, lookup_name, domain);
if (cust == NULL)
{
symbol_lookup_debug_printf_v
@@ -2448,8 +2451,7 @@ lookup_symbol_via_quick_fns (struct objfile *objfile,
bv = cust->blockvector ();
block = bv->block (block_index);
- result.symbol = block_lookup_symbol (block, name,
- symbol_name_match_type::FULL, domain);
+ result.symbol = block_lookup_symbol (block, lookup_name, domain);
if (result.symbol == NULL)
error_in_psymtab_expansion (block_index, name, cust);
@@ -2703,7 +2705,7 @@ lookup_transparent_type (const char *name)
static struct type *
basic_lookup_transparent_type_quick (struct objfile *objfile,
enum block_enum block_index,
- const char *name)
+ const lookup_name_info &name)
{
struct compunit_symtab *cust;
const struct blockvector *bv;
@@ -2717,10 +2719,9 @@ basic_lookup_transparent_type_quick (struct objfile *objfile,
bv = cust->blockvector ();
block = bv->block (block_index);
- lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
- sym = block_find_symbol (block, lookup_name, SEARCH_STRUCT_DOMAIN, nullptr);
+ sym = block_find_symbol (block, name, SEARCH_STRUCT_DOMAIN, nullptr);
if (sym == nullptr)
- error_in_psymtab_expansion (block_index, name, cust);
+ error_in_psymtab_expansion (block_index, name.c_str (), cust);
gdb_assert (!TYPE_IS_OPAQUE (sym->type ()));
return sym->type ();
}
@@ -2732,19 +2733,17 @@ basic_lookup_transparent_type_quick (struct objfile *objfile,
static struct type *
basic_lookup_transparent_type_1 (struct objfile *objfile,
enum block_enum block_index,
- const char *name)
+ const lookup_name_info &name)
{
const struct blockvector *bv;
const struct block *block;
const struct symbol *sym;
- lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
for (compunit_symtab *cust : objfile->compunits ())
{
bv = cust->blockvector ();
block = bv->block (block_index);
- sym = block_find_symbol (block, lookup_name, SEARCH_STRUCT_DOMAIN,
- nullptr);
+ sym = block_find_symbol (block, name, SEARCH_STRUCT_DOMAIN, nullptr);
if (sym != nullptr)
{
gdb_assert (!TYPE_IS_OPAQUE (sym->type ()));
@@ -2766,6 +2765,8 @@ basic_lookup_transparent_type (const char *name)
{
struct type *t;
+ lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
+
/* Now search all the global symbols. Do the symtab's first, then
check the psymtab's. If a psymtab indicates the existence
of the desired name as a global, then do psymtab-to-symtab
@@ -2773,14 +2774,16 @@ basic_lookup_transparent_type (const char *name)
for (objfile *objfile : current_program_space->objfiles ())
{
- t = basic_lookup_transparent_type_1 (objfile, GLOBAL_BLOCK, name);
+ t = basic_lookup_transparent_type_1 (objfile, GLOBAL_BLOCK,
+ lookup_name);
if (t)
return t;
}
for (objfile *objfile : current_program_space->objfiles ())
{
- t = basic_lookup_transparent_type_quick (objfile, GLOBAL_BLOCK, name);
+ t = basic_lookup_transparent_type_quick (objfile, GLOBAL_BLOCK,
+ lookup_name);
if (t)
return t;
}
@@ -2794,14 +2797,16 @@ basic_lookup_transparent_type (const char *name)
for (objfile *objfile : current_program_space->objfiles ())
{
- t = basic_lookup_transparent_type_1 (objfile, STATIC_BLOCK, name);
+ t = basic_lookup_transparent_type_1 (objfile, STATIC_BLOCK,
+ lookup_name);
if (t)
return t;
}
for (objfile *objfile : current_program_space->objfiles ())
{
- t = basic_lookup_transparent_type_quick (objfile, STATIC_BLOCK, name);
+ t = basic_lookup_transparent_type_quick (objfile, STATIC_BLOCK,
+ lookup_name);
if (t)
return t;
}