diff options
author | Tom Tromey <tom@tromey.com> | 2023-03-02 15:05:17 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-01-28 10:58:16 -0700 |
commit | c92d4de16a0650ae973cfecf9c563893757a01f1 (patch) | |
tree | 806dfef283b95bdfb261587255a6e8338d3dcfd6 /gdb/dwarf2 | |
parent | 25f31e1820dcec2f0c073c28cbf88646c7c2af97 (diff) | |
download | gdb-c92d4de16a0650ae973cfecf9c563893757a01f1.zip gdb-c92d4de16a0650ae973cfecf9c563893757a01f1.tar.gz gdb-c92d4de16a0650ae973cfecf9c563893757a01f1.tar.bz2 |
Replace search_domain with domain_search_flags
This patch changes gdb to replace search_domain with
domain_search_flags everywhere. search_domain is removed.
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r-- | gdb/dwarf2/cooked-index.c | 36 | ||||
-rw-r--r-- | gdb/dwarf2/cooked-index.h | 26 | ||||
-rw-r--r-- | gdb/dwarf2/read-gdb-index.c | 33 | ||||
-rw-r--r-- | gdb/dwarf2/read.c | 4 |
4 files changed, 55 insertions, 44 deletions
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index d5a21ee..4831acc 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -198,6 +198,42 @@ test_compare () /* See cooked-index.h. */ +bool +cooked_index_entry::matches (domain_search_flags kind) const +{ + /* Just reject type declarations. */ + if ((flags & IS_TYPE_DECLARATION) != 0) + return false; + + if ((kind & SEARCH_VAR_DOMAIN) != 0 + && (tag == DW_TAG_variable + || tag == DW_TAG_constant + || tag == DW_TAG_enumerator)) + return true; + + if ((kind & SEARCH_STRUCT_DOMAIN) != 0 + && (tag == DW_TAG_structure_type + || tag == DW_TAG_class_type + || tag == DW_TAG_union_type + || tag == DW_TAG_enumeration_type)) + return true; + + if ((kind & SEARCH_MODULE_DOMAIN) != 0 && tag == DW_TAG_module) + return true; + + if ((kind & SEARCH_TYPE_DOMAIN) != 0 && tag_is_type (tag)) + return true; + + if ((kind & SEARCH_FUNCTION_DOMAIN) != 0 + && (tag == DW_TAG_subprogram + || tag == DW_TAG_entry_point)) + return true; + + return false; +} + +/* See cooked-index.h. */ + const char * cooked_index_entry::full_name (struct obstack *storage, bool for_main) const { diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h index 86fbb8f..b49e0b1 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -160,29 +160,7 @@ struct cooked_index_entry : public allocate_on_obstack } /* Return true if this entry matches KIND. */ - bool matches (enum search_domain kind) const - { - /* Just reject type declarations. */ - if ((flags & IS_TYPE_DECLARATION) != 0) - return false; - - switch (kind) - { - case VARIABLES_DOMAIN: - return (tag == DW_TAG_variable - || tag == DW_TAG_constant - || tag == DW_TAG_enumerator); - case FUNCTIONS_DOMAIN: - return (tag == DW_TAG_subprogram - || tag == DW_TAG_entry_point); - case TYPES_DOMAIN: - return tag_is_type (tag); - case MODULES_DOMAIN: - return tag == DW_TAG_module; - } - - return true; - } + bool matches (domain_search_flags kind) const; /* Construct the fully-qualified name of this entry and return a pointer to it. If allocation is needed, it will be done on @@ -798,7 +776,7 @@ struct cooked_index_functions : public dwarf2_base_index_functions gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify, block_search_flags search_flags, domain_enum domain, - enum search_domain kind) override; + domain_search_flags kind) override; struct compunit_symtab *find_pc_sect_compunit_symtab (struct objfile *objfile, struct bound_minimal_symbol msymbol, diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c index 3f10aa7..091aa62 100644 --- a/gdb/dwarf2/read-gdb-index.c +++ b/gdb/dwarf2/read-gdb-index.c @@ -147,7 +147,7 @@ struct dwarf2_gdb_index : public dwarf2_base_index_functions gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify, block_search_flags search_flags, domain_enum domain, - enum search_domain kind) override; + domain_search_flags kind) override; }; /* This dumps minimal information about the index. @@ -176,7 +176,7 @@ dw2_expand_marked_cus gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher, gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify, block_search_flags search_flags, - search_domain kind) + domain_search_flags kind) { offset_type vec_len, vec_idx; bool global_seen = false; @@ -227,27 +227,24 @@ dw2_expand_marked_cus continue; } - switch (kind) + domain_search_flags mask = 0; + switch (symbol_kind) { - case VARIABLES_DOMAIN: - if (symbol_kind != GDB_INDEX_SYMBOL_KIND_VARIABLE) - continue; - break; - case FUNCTIONS_DOMAIN: - if (symbol_kind != GDB_INDEX_SYMBOL_KIND_FUNCTION) - continue; + case GDB_INDEX_SYMBOL_KIND_VARIABLE: + mask = SEARCH_VAR_DOMAIN; break; - case TYPES_DOMAIN: - if (symbol_kind != GDB_INDEX_SYMBOL_KIND_TYPE) - continue; + case GDB_INDEX_SYMBOL_KIND_FUNCTION: + mask = SEARCH_FUNCTION_DOMAIN; break; - case MODULES_DOMAIN: - if (symbol_kind != GDB_INDEX_SYMBOL_KIND_OTHER) - continue; + case GDB_INDEX_SYMBOL_KIND_TYPE: + mask = SEARCH_TYPE_DOMAIN; break; - default: + case GDB_INDEX_SYMBOL_KIND_OTHER: + mask = SEARCH_MODULE_DOMAIN; break; } + if ((kind & mask) == 0) + continue; } /* Don't crash on bad data. */ @@ -276,7 +273,7 @@ dwarf2_gdb_index::expand_symtabs_matching gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify, block_search_flags search_flags, domain_enum domain, - enum search_domain kind) + domain_search_flags kind) { dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 82f969a..bc56c10 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1638,7 +1638,7 @@ struct readnow_functions : public dwarf2_base_index_functions gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify, block_search_flags search_flags, domain_enum domain, - enum search_domain kind) override + domain_search_flags kind) override { return true; } @@ -16625,7 +16625,7 @@ cooked_index_functions::expand_symtabs_matching gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify, block_search_flags search_flags, domain_enum domain, - enum search_domain kind) + domain_search_flags kind) { dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); |