diff options
author | Tom Tromey <tom@tromey.com> | 2023-03-30 08:41:17 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-09-07 12:24:21 -0600 |
commit | b7a92724c5bd926e094ede860049c1067f0584cf (patch) | |
tree | 10c7ff4050bc9e86896692ae4bf733f56ecd0316 /gdb/block.h | |
parent | def2803789208a617c429b5dcf2026decb25ce0c (diff) | |
download | fsf-binutils-gdb-b7a92724c5bd926e094ede860049c1067f0584cf.zip fsf-binutils-gdb-b7a92724c5bd926e094ede860049c1067f0584cf.tar.gz fsf-binutils-gdb-b7a92724c5bd926e094ede860049c1067f0584cf.tar.bz2 |
Simplify block_find_symbol
block_find_symbol takes a callback function, but only two callbacks
are ever passed to it -- and they are similar enough that it seems
cleaner to just have block_find_symbol do the work itself. Also,
block_find_symbol can take a lookup_name_info as an argument,
following the general idea of pushing the construction of these
objects as high in the call chain as feasible.
Regression tested on x86-64 Fedora 38.
Tested-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
Diffstat (limited to 'gdb/block.h')
-rw-r--r-- | gdb/block.h | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/gdb/block.h b/gdb/block.h index f132d35..3a197e6 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -556,39 +556,15 @@ extern struct symbol *block_lookup_symbol_primary (const struct block *block, const char *name, const domain_enum domain); -/* The type of the MATCHER argument to block_find_symbol. */ - -typedef int (block_symbol_matcher_ftype) (struct symbol *, void *); - -/* Find symbol NAME in BLOCK and in DOMAIN that satisfies MATCHER. - DATA is passed unchanged to MATCHER. - BLOCK must be STATIC_BLOCK or GLOBAL_BLOCK. */ +/* Find symbol NAME in BLOCK and in DOMAIN. This will return a + matching symbol whose type is not a "opaque", see TYPE_IS_OPAQUE. + If STUB is non-NULL, an otherwise matching symbol whose type is a + opaque will be stored here. */ extern struct symbol *block_find_symbol (const struct block *block, - const char *name, + const lookup_name_info &name, const domain_enum domain, - block_symbol_matcher_ftype *matcher, - void *data); - -/* A matcher function for block_find_symbol to find only symbols with - non-opaque types. */ - -extern int block_find_non_opaque_type (struct symbol *sym, void *data); - -/* A matcher function for block_find_symbol to prefer symbols with - non-opaque types. The way to use this function is as follows: - - struct symbol *with_opaque = NULL; - struct symbol *sym - = block_find_symbol (block, name, domain, - block_find_non_opaque_type_preferred, &with_opaque); - - At this point if SYM is non-NULL then a non-opaque type has been found. - Otherwise, if WITH_OPAQUE is non-NULL then an opaque type has been found. - Otherwise, the symbol was not found. */ - -extern int block_find_non_opaque_type_preferred (struct symbol *sym, - void *data); + struct symbol **stub); /* Given a vector of pairs, allocate and build an obstack allocated blockranges struct for a block. */ |