Allow passing a block to lookup_global_symbol_from_objfile

This has no behavior change in itself, but allows a future patch
to add a function to the Python API to look up symbols in the
static block.

gdb/ChangeLog:

2019-07-24  Christian Biesinger  <cbiesinger@google.com>

	* compile/compile-object-load.c (compile_object_load): Pass GLOBAL_SCOPE.
	* solib-spu.c (spu_lookup_lib_symbol): Pass GLOBAL_SCOPE.
	* solib-svr4.c (elf_lookup_lib_symbol): Pass GLOBAL_SCOPE.
	* symtab.c (lookup_global_symbol_from_objfile): Add a scope parameter.
	* symtab.h (lookup_global_symbol_from_objfile): Likewise.
This commit is contained in:
Christian Biesinger
2019-06-25 15:45:41 -05:00
parent 75b493d0f9
commit 442853af24
6 changed files with 23 additions and 5 deletions

View File

@@ -2224,15 +2224,18 @@ lookup_symbol_in_block (const char *name, symbol_name_match_type match_type,
struct block_symbol
lookup_global_symbol_from_objfile (struct objfile *main_objfile,
enum block_enum block_index,
const char *name,
const domain_enum domain)
{
gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK);
for (objfile *objfile : main_objfile->separate_debug_objfiles ())
{
struct block_symbol result
= lookup_symbol_in_objfile (objfile, GLOBAL_BLOCK, name, domain);
= lookup_symbol_in_objfile (objfile, block_index, name, domain);
if (result.symbol != NULL)
if (result.symbol != nullptr)
return result;
}