From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH v2 06/17] Move cooked_index_functions to cooked-index.h
Date: Wed, 17 Jan 2024 09:39:34 -0700 [thread overview]
Message-ID: <20240117-debug-names-fix-v2-6-dbd5971a9c31@tromey.com> (raw)
In-Reply-To: <20240117-debug-names-fix-v2-0-dbd5971a9c31@tromey.com>
This moves the declaration of cooked_index_functions to
cooked-index.h. This makes it visible for use by the rewritten
.debug_names reader, and it also lets us move the implementation of
make_quick_functions into cooked-index.c, where it really belongs.
---
gdb/dwarf2/cooked-index.c | 6 +++
gdb/dwarf2/cooked-index.h | 94 +++++++++++++++++++++++++++++++++++++++++++
gdb/dwarf2/read.c | 100 ----------------------------------------------
3 files changed, 100 insertions(+), 100 deletions(-)
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index 54c622977b1..542ec2fd69f 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -616,6 +616,12 @@ cooked_index::get_main () const
return best_entry;
}
+quick_symbol_functions_up
+cooked_index::make_quick_functions () const
+{
+ return quick_symbol_functions_up (new cooked_index_functions);
+}
+
/* See cooked-index.h. */
void
diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index 6caa8132f53..24c83b56e05 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -737,4 +737,98 @@ class cooked_index : public dwarf_scanner_base
dwarf2_per_bfd *m_per_bfd;
};
+/* An implementation of quick_symbol_functions for the cooked DWARF
+ index. */
+
+struct cooked_index_functions : public dwarf2_base_index_functions
+{
+ cooked_index *wait (struct objfile *objfile, bool allow_quit)
+ {
+ dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
+ cooked_index *table
+ = (gdb::checked_static_cast<cooked_index *>
+ (per_objfile->per_bfd->index_table.get ()));
+ table->wait (cooked_state::MAIN_AVAILABLE, allow_quit);
+ return table;
+ }
+
+ dwarf2_per_cu_data *find_per_cu (dwarf2_per_bfd *per_bfd,
+ unrelocated_addr adjusted_pc) override;
+
+ struct compunit_symtab *find_compunit_symtab_by_address
+ (struct objfile *objfile, CORE_ADDR address) override;
+
+ bool has_unexpanded_symtabs (struct objfile *objfile) override
+ {
+ wait (objfile, true);
+ return dwarf2_base_index_functions::has_unexpanded_symtabs (objfile);
+ }
+
+ struct symtab *find_last_source_symtab (struct objfile *objfile) override
+ {
+ wait (objfile, true);
+ return dwarf2_base_index_functions::find_last_source_symtab (objfile);
+ }
+
+ void forget_cached_source_info (struct objfile *objfile) override
+ {
+ wait (objfile, true);
+ dwarf2_base_index_functions::forget_cached_source_info (objfile);
+ }
+
+ void print_stats (struct objfile *objfile, bool print_bcache) override
+ {
+ wait (objfile, true);
+ dwarf2_base_index_functions::print_stats (objfile, print_bcache);
+ }
+
+ void dump (struct objfile *objfile) override
+ {
+ cooked_index *index = wait (objfile, true);
+ gdb_printf ("Cooked index in use:\n");
+ gdb_printf ("\n");
+ index->dump (objfile->arch ());
+ }
+
+ void expand_all_symtabs (struct objfile *objfile) override
+ {
+ wait (objfile, true);
+ dwarf2_base_index_functions::expand_all_symtabs (objfile);
+ }
+
+ bool expand_symtabs_matching
+ (struct objfile *objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags,
+ domain_enum domain,
+ enum search_domain kind) override;
+
+ struct compunit_symtab *find_pc_sect_compunit_symtab
+ (struct objfile *objfile, struct bound_minimal_symbol msymbol,
+ CORE_ADDR pc, struct obj_section *section, int warn_if_readin) override
+ {
+ wait (objfile, true);
+ return (dwarf2_base_index_functions::find_pc_sect_compunit_symtab
+ (objfile, msymbol, pc, section, warn_if_readin));
+ }
+
+ void map_symbol_filenames
+ (struct objfile *objfile,
+ gdb::function_view<symbol_filename_ftype> fun,
+ bool need_fullname) override
+ {
+ wait (objfile, true);
+ return (dwarf2_base_index_functions::map_symbol_filenames
+ (objfile, fun, need_fullname));
+ }
+
+ void compute_main_name (struct objfile *objfile) override
+ {
+ wait (objfile, false);
+ }
+};
+
#endif /* GDB_DWARF2_COOKED_INDEX_H */
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index cac194df617..8010c0141f5 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -16651,100 +16651,6 @@ cooked_indexer::make_index (cutu_reader *reader)
}
}
-/* An implementation of quick_symbol_functions for the cooked DWARF
- index. */
-
-struct cooked_index_functions : public dwarf2_base_index_functions
-{
- cooked_index *wait (struct objfile *objfile, bool allow_quit)
- {
- dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- cooked_index *table
- = (gdb::checked_static_cast<cooked_index *>
- (per_objfile->per_bfd->index_table.get ()));
- table->wait (cooked_state::MAIN_AVAILABLE, allow_quit);
- return table;
- }
-
- dwarf2_per_cu_data *find_per_cu (dwarf2_per_bfd *per_bfd,
- unrelocated_addr adjusted_pc) override;
-
- struct compunit_symtab *find_compunit_symtab_by_address
- (struct objfile *objfile, CORE_ADDR address) override;
-
- bool has_unexpanded_symtabs (struct objfile *objfile) override
- {
- wait (objfile, true);
- return dwarf2_base_index_functions::has_unexpanded_symtabs (objfile);
- }
-
- struct symtab *find_last_source_symtab (struct objfile *objfile) override
- {
- wait (objfile, true);
- return dwarf2_base_index_functions::find_last_source_symtab (objfile);
- }
-
- void forget_cached_source_info (struct objfile *objfile) override
- {
- wait (objfile, true);
- dwarf2_base_index_functions::forget_cached_source_info (objfile);
- }
-
- void print_stats (struct objfile *objfile, bool print_bcache) override
- {
- wait (objfile, true);
- dwarf2_base_index_functions::print_stats (objfile, print_bcache);
- }
-
- void dump (struct objfile *objfile) override
- {
- cooked_index *index = wait (objfile, true);
- gdb_printf ("Cooked index in use:\n");
- gdb_printf ("\n");
- index->dump (objfile->arch ());
- }
-
- void expand_all_symtabs (struct objfile *objfile) override
- {
- wait (objfile, true);
- dwarf2_base_index_functions::expand_all_symtabs (objfile);
- }
-
- bool expand_symtabs_matching
- (struct objfile *objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info *lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain kind) override;
-
- struct compunit_symtab *find_pc_sect_compunit_symtab
- (struct objfile *objfile, struct bound_minimal_symbol msymbol,
- CORE_ADDR pc, struct obj_section *section, int warn_if_readin) override
- {
- wait (objfile, true);
- return (dwarf2_base_index_functions::find_pc_sect_compunit_symtab
- (objfile, msymbol, pc, section, warn_if_readin));
- }
-
- void map_symbol_filenames
- (struct objfile *objfile,
- gdb::function_view<symbol_filename_ftype> fun,
- bool need_fullname) override
- {
- wait (objfile, true);
- return (dwarf2_base_index_functions::map_symbol_filenames
- (objfile, fun, need_fullname));
- }
-
- void compute_main_name (struct objfile *objfile) override
- {
- wait (objfile, false);
- }
-};
-
dwarf2_per_cu_data *
cooked_index_functions::find_per_cu (dwarf2_per_bfd *per_bfd,
unrelocated_addr adjusted_pc)
@@ -16919,12 +16825,6 @@ start_debug_info_reader (dwarf2_per_objfile *per_objfile)
idx->start_reading ();
}
-quick_symbol_functions_up
-cooked_index::make_quick_functions () const
-{
- return quick_symbol_functions_up (new cooked_index_functions);
-}
-
\f
/* Read the .debug_loclists or .debug_rnglists header (they are the same format)
--
2.43.0
next prev parent reply other threads:[~2024-01-17 16:39 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 16:39 [PATCH v2 00/17] Rewrite .debug_names reader and writer Tom Tromey
2024-01-17 16:39 ` [PATCH v2 01/17] Refactor 'maint set dwarf synchronous' handling Tom Tromey
2024-01-17 16:39 ` [PATCH v2 02/17] Refactor quick-function installation in DWARF reader Tom Tromey
2024-01-17 16:39 ` [PATCH v2 03/17] Remove IS_ENUM_CLASS from cooked_index_flag Tom Tromey
2024-01-17 16:39 ` [PATCH v2 04/17] Document GDB extensions to DWARF .debug_names Tom Tromey
2024-01-17 16:39 ` [PATCH v2 05/17] Add language to cooked_index_entry Tom Tromey
2024-01-17 16:39 ` Tom Tromey [this message]
2024-01-17 16:39 ` [PATCH v2 07/17] Do not write the index cache from an index Tom Tromey
2024-01-17 16:39 ` [PATCH v2 08/17] Change cooked_index_worker to abstract base class Tom Tromey
2024-01-17 16:39 ` [PATCH v2 09/17] Remove cooked_index_worker::start_reading Tom Tromey
2024-01-17 16:39 ` [PATCH v2 10/17] Empty hash table fix in .debug_names reader Tom Tromey
2024-01-17 16:39 ` [PATCH v2 11/17] Fix dw2-zero-range.exp when an index is in use Tom Tromey
2024-01-17 16:39 ` [PATCH v2 12/17] Explicitly expand CUs in dw2-inline-with-lexical-scope.exp Tom Tromey
2024-01-17 16:39 ` [PATCH v2 13/17] Remove some .debug_names tests Tom Tromey
2024-01-17 16:39 ` [PATCH v2 14/17] Allow other results in DW_TAG_entry_point test Tom Tromey
2024-01-17 16:39 ` [PATCH v2 15/17] Rewrite .debug_names reader Tom Tromey
2024-01-17 16:39 ` [PATCH v2 16/17] Export dwarf5_augmentation Tom Tromey
2024-01-17 16:39 ` [PATCH v2 17/17] Rewrite .debug_names writer Tom Tromey
2024-01-18 10:05 ` [PATCH v2 00/17] Rewrite .debug_names reader and writer Tom de Vries
2024-01-18 15:42 ` Tom Tromey
2024-01-18 20:33 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240117-debug-names-fix-v2-6-dbd5971a9c31@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).