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/block.c | |
parent | 6c0152149476085e6c4c5c812bfc3a06fff7c938 (diff) | |
download | gdb-ccf41c248737eb6650211481366c4e1156ce01ae.zip gdb-ccf41c248737eb6650211481366c4e1156ce01ae.tar.gz gdb-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/block.c')
-rw-r--r-- | gdb/block.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/gdb/block.c b/gdb/block.c index 4b9307e..0bdd0f9 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -630,26 +630,32 @@ block_iterator_next (struct block_iterator *iterator) /* See block.h. */ bool -best_symbol (struct symbol *a, const domain_enum domain) +best_symbol (struct symbol *a, const domain_search_flags domain) { - return (a->domain () == domain - && a->aclass () != LOC_UNRESOLVED); + if (a->aclass () == LOC_UNRESOLVED) + return false; + + if ((domain & SEARCH_VAR_DOMAIN) != 0) + return a->domain () == VAR_DOMAIN; + + return a->matches (domain); } /* See block.h. */ struct symbol * -better_symbol (struct symbol *a, struct symbol *b, const domain_enum domain) +better_symbol (struct symbol *a, struct symbol *b, + const domain_search_flags domain) { if (a == NULL) return b; if (b == NULL) return a; - if (a->domain () == domain && b->domain () != domain) + if (a->matches (domain) && !b->matches (domain)) return a; - if (b->domain () == domain && a->domain () != domain) + if (b->matches (domain) && !a->matches (domain)) return b; if (a->aclass () != LOC_UNRESOLVED && b->aclass () == LOC_UNRESOLVED) @@ -675,7 +681,7 @@ better_symbol (struct symbol *a, struct symbol *b, const domain_enum domain) struct symbol * block_lookup_symbol (const struct block *block, const char *name, symbol_name_match_type match_type, - const domain_enum domain) + const domain_search_flags domain) { lookup_name_info lookup_name (name, match_type); @@ -730,7 +736,7 @@ block_lookup_symbol (const struct block *block, const char *name, struct symbol * block_lookup_symbol_primary (const struct block *block, const char *name, - const domain_enum domain) + const domain_search_flags domain) { struct symbol *sym, *other; struct mdict_iterator mdict_iter; @@ -792,7 +798,7 @@ block_lookup_symbol_primary (const struct block *block, const char *name, struct symbol * block_find_symbol (const struct block *block, const lookup_name_info &name, - const domain_enum domain, struct symbol **stub) + const domain_search_flags domain, struct symbol **stub) { /* Verify BLOCK is STATIC_BLOCK or GLOBAL_BLOCK. */ gdb_assert (block->superblock () == NULL |