diff options
author | Tom Tromey <tom@tromey.com> | 2023-03-30 23:00:26 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-01-28 10:58:16 -0700 |
commit | ccf41c248737eb6650211481366c4e1156ce01ae (patch) | |
tree | 55933f48a150085e0df7728b4f82047977559a88 /gdb/python/py-symbol.c | |
parent | 6c0152149476085e6c4c5c812bfc3a06fff7c938 (diff) | |
download | binutils-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/python/py-symbol.c')
-rw-r--r-- | gdb/python/py-symbol.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c index a7d010f..2fb6837 100644 --- a/gdb/python/py-symbol.c +++ b/gdb/python/py-symbol.c @@ -432,8 +432,8 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw) try { - symbol = lookup_symbol (name, block, (domain_enum) domain, - &is_a_field_of_this).symbol; + domain_search_flags flags = from_scripting_domain (domain); + symbol = lookup_symbol (name, block, flags, &is_a_field_of_this).symbol; } catch (const gdb_exception &except) { @@ -481,7 +481,8 @@ gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw) try { - symbol = lookup_global_symbol (name, NULL, (domain_enum) domain).symbol; + domain_search_flags flags = from_scripting_domain (domain); + symbol = lookup_global_symbol (name, NULL, flags).symbol; } catch (const gdb_exception &except) { @@ -542,13 +543,14 @@ gdbpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw) try { + domain_search_flags flags = from_scripting_domain (domain); + if (block != nullptr) symbol - = lookup_symbol_in_static_block (name, block, - (domain_enum) domain).symbol; + = lookup_symbol_in_static_block (name, block, flags).symbol; if (symbol == nullptr) - symbol = lookup_static_symbol (name, (domain_enum) domain).symbol; + symbol = lookup_static_symbol (name, flags).symbol; } catch (const gdb_exception &except) { @@ -592,6 +594,8 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw) try { + domain_search_flags flags = from_scripting_domain (domain); + /* Expand any symtabs that contain potentially matching symbols. */ lookup_name_info lookup_name (name, symbol_name_match_type::FULL); expand_symtabs_matching (NULL, lookup_name, NULL, NULL, @@ -613,7 +617,7 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw) if (block != nullptr) { symbol *symbol = lookup_symbol_in_static_block - (name, block, (domain_enum) domain).symbol; + (name, block, flags).symbol; if (symbol != nullptr) { @@ -675,7 +679,9 @@ gdbpy_initialize_symbols (void) #define DOMAIN(X) \ if (PyModule_AddIntConstant (gdb_module, "SYMBOL_" #X "_DOMAIN", \ - X ## _DOMAIN) < 0) \ + to_scripting_domain (X ## _DOMAIN)) < 0 \ + || PyModule_AddIntConstant (gdb_module, "SEARCH_" #X "_DOMAIN", \ + to_scripting_domain (SEARCH_ ## X ## _DOMAIN)) < 0) \ return -1; #include "sym-domains.def" #undef DOMAIN |