From: Tom Tromey Date: Thu, 2 Jan 2025 22:15:32 +0000 (-0700) Subject: Pass lookup_name_info to block_lookup_symbol_primary X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4a4ebdf9ddd5b3892c764b6a409a1e99209fa2e9;p=thirdparty%2Fbinutils-gdb.git Pass lookup_name_info to block_lookup_symbol_primary This changes block_lookup_symbol_primary to accept a lookup_name_info. This follows the general trend of hoisting these objects to the outermost layer where they make sense -- somewhat reducing the cost of using them. Acked-By: Simon Marchi --- diff --git a/gdb/block.c b/gdb/block.c index b653abccb77..35ea5f36923 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -718,17 +718,16 @@ block_lookup_symbol (const struct block *block, const lookup_name_info &name, /* See block.h. */ struct symbol * -block_lookup_symbol_primary (const struct block *block, const char *name, +block_lookup_symbol_primary (const struct block *block, + const lookup_name_info &name, const domain_search_flags domain) { - lookup_name_info lookup_name (name, symbol_name_match_type::FULL); - /* Verify BLOCK is STATIC_BLOCK or GLOBAL_BLOCK. */ gdb_assert (block->superblock () == NULL || block->superblock ()->superblock () == NULL); symbol *other = nullptr; - for (symbol *sym : block_iterator_range (block, &lookup_name)) + for (symbol *sym : block_iterator_range (block, &name)) { /* With the fix for PR gcc/debug/91507, we get for: ... diff --git a/gdb/block.h b/gdb/block.h index 76fa203697c..f8cd41441bf 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -636,7 +636,7 @@ extern struct symbol *block_lookup_symbol (const struct block *block, extern struct symbol *block_lookup_symbol_primary (const struct block *block, - const char *name, + const lookup_name_info &name, const domain_search_flags domain); /* Find symbol NAME in BLOCK and in DOMAIN. This will return a diff --git a/gdb/symtab.c b/gdb/symtab.c index ae004b9411b..d9356cea141 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2356,6 +2356,7 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile, block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK" : "STATIC_BLOCK", name, domain_name (domain).c_str ()); + lookup_name_info lookup_name (name, symbol_name_match_type::FULL); struct block_symbol other; other.symbol = NULL; for (compunit_symtab *cust : objfile->compunits ()) @@ -2366,7 +2367,7 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile, bv = cust->blockvector (); block = bv->block (block_index); - result.symbol = block_lookup_symbol_primary (block, name, domain); + result.symbol = block_lookup_symbol_primary (block, lookup_name, domain); result.block = block; if (result.symbol == NULL) continue;