aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-03-30 23:00:26 -0600
committerTom Tromey <tom@tromey.com>2024-01-28 10:58:16 -0700
commitccf41c248737eb6650211481366c4e1156ce01ae (patch)
tree55933f48a150085e0df7728b4f82047977559a88 /gdb/compile
parent6c0152149476085e6c4c5c812bfc3a06fff7c938 (diff)
downloadbinutils-ccf41c248737eb6650211481366c4e1156ce01ae.zip
binutils-ccf41c248737eb6650211481366c4e1156ce01ae.tar.gz
binutils-ccf41c248737eb6650211481366c4e1156ce01ae.tar.bz2
Use domain_search_flags in lookup_symbol et al
This changes lookup_symbol and associated APIs to accept domain_search_flags rather than a domain_enum. Note that this introduces some new constants to Python and Guile. I chose to break out the documentation patch for this, because the internals here do not change until a later patch, and it seemed simpler to patch the docs just once, rather than twice.
Diffstat (limited to 'gdb/compile')
-rw-r--r--gdb/compile/compile-c-symbols.c17
-rw-r--r--gdb/compile/compile-cplus-symbols.c13
-rw-r--r--gdb/compile/compile-cplus-types.c8
-rw-r--r--gdb/compile/compile-object-load.c6
4 files changed, 23 insertions, 21 deletions
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 9e15709..804a0a0 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -210,7 +210,7 @@ convert_one_symbol (compile_c_instance *context,
static void
convert_symbol_sym (compile_c_instance *context, const char *identifier,
- struct block_symbol sym, domain_enum domain)
+ struct block_symbol sym, domain_search_flags domain)
{
int is_local_symbol;
@@ -325,19 +325,19 @@ gcc_convert_symbol (void *datum,
{
compile_c_instance *context
= static_cast<compile_c_instance *> (datum);
- domain_enum domain;
+ domain_search_flags domain;
int found = 0;
switch (request)
{
case GCC_C_ORACLE_SYMBOL:
- domain = VAR_DOMAIN;
+ domain = SEARCH_VFT;
break;
case GCC_C_ORACLE_TAG:
- domain = STRUCT_DOMAIN;
+ domain = SEARCH_STRUCT_DOMAIN;
break;
case GCC_C_ORACLE_LABEL:
- domain = LABEL_DOMAIN;
+ domain = SEARCH_LABEL_DOMAIN;
break;
default:
gdb_assert_not_reached ("Unrecognized oracle request.");
@@ -355,7 +355,7 @@ gcc_convert_symbol (void *datum,
convert_symbol_sym (context, identifier, sym, domain);
found = 1;
}
- else if (domain == VAR_DOMAIN)
+ else if (request == GCC_C_ORACLE_SYMBOL)
{
struct bound_minimal_symbol bmsym;
@@ -398,8 +398,9 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
struct symbol *sym;
/* We only need global functions here. */
- sym = lookup_symbol (identifier, NULL, VAR_DOMAIN, NULL).symbol;
- if (sym != NULL && sym->aclass () == LOC_BLOCK)
+ sym = lookup_symbol (identifier, nullptr, SEARCH_FUNCTION_DOMAIN,
+ nullptr).symbol;
+ if (sym != nullptr)
{
if (compile_debug)
gdb_printf (gdb_stdlog,
diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c
index dbdabe9..9d8e801 100644
--- a/gdb/compile/compile-cplus-symbols.c
+++ b/gdb/compile/compile-cplus-symbols.c
@@ -227,7 +227,7 @@ convert_one_symbol (compile_cplus_instance *instance,
static void
convert_symbol_sym (compile_cplus_instance *instance,
const char *identifier, struct block_symbol sym,
- domain_enum domain)
+ domain_search_flags domain)
{
/* If we found a symbol and it is not in the static or global
scope, then we should first convert any static or global scope
@@ -355,12 +355,12 @@ gcc_cplus_convert_symbol (void *datum,
This will find variables in the current scope. */
struct block_symbol sym
- = lookup_symbol (identifier, instance->block (), VAR_DOMAIN, nullptr);
+ = lookup_symbol (identifier, instance->block (), SEARCH_VFT, nullptr);
if (sym.symbol != nullptr)
{
found = true;
- convert_symbol_sym (instance, identifier, sym, VAR_DOMAIN);
+ convert_symbol_sym (instance, identifier, sym, SEARCH_VFT);
}
/* Then use linespec.c's multi-symbol search. This should find
@@ -378,7 +378,7 @@ gcc_cplus_convert_symbol (void *datum,
{
found = true;
convert_symbol_sym (instance, identifier, it,
- it.symbol->domain ());
+ to_search_flags (it.symbol->domain ()));
}
}
@@ -437,9 +437,10 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
try
{
struct symbol *sym
- = lookup_symbol (identifier, nullptr, VAR_DOMAIN, nullptr).symbol;
+ = lookup_symbol (identifier, nullptr, SEARCH_FUNCTION_DOMAIN,
+ nullptr).symbol;
- if (sym != nullptr && sym->aclass () == LOC_BLOCK)
+ if (sym != nullptr)
{
if (compile_debug)
gdb_printf (gdb_stdlog,
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index 90ce3f1..c8a2551 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -154,7 +154,7 @@ type_name_to_scope (const char *type_name, const struct block *block)
/* Look up the resulting name. */
struct block_symbol bsymbol
- = lookup_symbol (lookup_name.c_str (), block, VAR_DOMAIN, nullptr);
+ = lookup_symbol (lookup_name.c_str (), block, SEARCH_VFT, nullptr);
if (bsymbol.symbol != nullptr)
{
@@ -384,7 +384,7 @@ compile_cplus_instance::new_scope (const char *type_name, struct type *type)
scope_component comp
= {
decl_name (type->name ()).get (),
- lookup_symbol (type->name (), block (), VAR_DOMAIN, nullptr)
+ lookup_symbol (type->name (), block (), SEARCH_VFT, nullptr)
};
scope.push_back (comp);
}
@@ -617,7 +617,7 @@ compile_cplus_convert_struct_or_union_members
const char *physname = type->field (i).loc_physname ();
struct block_symbol sym
= lookup_symbol (physname, instance->block (),
- VAR_DOMAIN, nullptr);
+ SEARCH_VFT, nullptr);
if (sym.symbol == nullptr)
{
@@ -729,7 +729,7 @@ compile_cplus_convert_struct_or_union_methods (compile_cplus_instance *instance,
gcc_type method_type;
struct block_symbol sym
= lookup_symbol (TYPE_FN_FIELD_PHYSNAME (methods, j),
- instance->block (), VAR_DOMAIN, nullptr);
+ instance->block (), SEARCH_VFT, nullptr);
if (sym.symbol == nullptr)
{
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index b2cc3a1..e26f0f4 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -437,7 +437,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
gdb_val_sym = block_lookup_symbol (block,
COMPILE_I_EXPR_VAL,
symbol_name_match_type::SEARCH_NAME,
- VAR_DOMAIN);
+ SEARCH_VFT);
if (gdb_val_sym == NULL)
continue;
@@ -463,7 +463,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
gdb_ptr_type_sym = block_lookup_symbol (block, COMPILE_I_EXPR_PTR_TYPE,
symbol_name_match_type::SEARCH_NAME,
- VAR_DOMAIN);
+ SEARCH_VFT);
if (gdb_ptr_type_sym == NULL)
error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE);
gdb_ptr_type = gdb_ptr_type_sym->type ();
@@ -652,7 +652,7 @@ compile_object_load (const compile_file_names &file_names,
func_sym = lookup_global_symbol_from_objfile (objfile,
GLOBAL_BLOCK,
GCC_FE_WRAPPER_FUNCTION,
- VAR_DOMAIN).symbol;
+ SEARCH_VFT).symbol;
if (func_sym == NULL)
error (_("Cannot find function \"%s\" in compiled module \"%s\"."),
GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile));