diff options
Diffstat (limited to 'gdb/dwarf2/read.c')
-rw-r--r-- | gdb/dwarf2/read.c | 66 |
1 files changed, 24 insertions, 42 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 3d7b6dd..71fd352 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -32,7 +32,7 @@ #include "dwarf2/aranges.h" #include "dwarf2/attribute.h" #include "dwarf2/comp-unit-head.h" -#include "dwarf2/cooked-index-storage.h" +#include "dwarf2/cooked-index-worker.h" #include "dwarf2/cooked-indexer.h" #include "dwarf2/cu.h" #include "dwarf2/index-cache.h" @@ -728,7 +728,7 @@ show_dwarf_synchronous (struct ui_file *file, int from_tty, /* local function prototypes */ static void build_type_psymtabs_reader (cutu_reader *reader, - cooked_index_storage *storage); + cooked_index_worker_result *storage); static void var_decode_location (struct attribute *attr, struct symbol *sym, @@ -2970,7 +2970,7 @@ cutu_reader::cutu_reader (dwarf2_per_cu &this_cu, dwarf2_cu *existing_cu, bool skip_partial, enum language pretend_language, - const abbrev_table_cache *cache) + const abbrev_table_cache *abbrev_cache) { struct objfile *objfile = per_objfile.objfile; struct dwarf2_section_info *section = this_cu.section; @@ -3030,7 +3030,7 @@ cutu_reader::cutu_reader (dwarf2_per_cu &this_cu, indexer. This assert is avoided in this case because (1) it is irrelevant, and (2) the get_cu method is not thread-safe. */ - gdb_assert (cache != nullptr + gdb_assert (abbrev_cache != nullptr || per_objfile.get_cu (&this_cu) == nullptr); m_new_cu = std::make_unique<dwarf2_cu> (&this_cu, &per_objfile); cu = m_new_cu.get (); @@ -3092,9 +3092,9 @@ cutu_reader::cutu_reader (dwarf2_per_cu &this_cu, gdb_assert (cu->header.abbrev_sect_off == abbrev_table->sect_off); else { - if (cache != nullptr) - abbrev_table = cache->find (abbrev_section, - cu->header.abbrev_sect_off); + if (abbrev_cache != nullptr) + abbrev_table = abbrev_cache->find (abbrev_section, + cu->header.abbrev_sect_off); if (abbrev_table == nullptr) { abbrev_section->read (objfile); @@ -3289,7 +3289,7 @@ get_type_unit_group_key (struct dwarf2_cu *cu, const struct attribute *stmt_list static void process_psymtab_comp_unit (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile, - cooked_index_storage *storage) + cooked_index_worker_result *storage) { cutu_reader *reader = storage->get_reader (this_cu); if (reader == nullptr) @@ -3326,7 +3326,7 @@ process_psymtab_comp_unit (dwarf2_per_cu *this_cu, static void build_type_psymtabs_reader (cutu_reader *reader, - cooked_index_storage *storage) + cooked_index_worker_result *storage) { struct dwarf2_cu *cu = reader->cu (); dwarf2_per_cu *per_cu = cu->per_cu; @@ -3379,7 +3379,7 @@ struct tu_abbrev_offset static void build_type_psymtabs (dwarf2_per_objfile *per_objfile, - cooked_index_storage *storage) + cooked_index_worker_result *storage) { struct tu_stats *tu_stats = &per_objfile->per_bfd->tu_stats; abbrev_table_up abbrev_table; @@ -3476,7 +3476,7 @@ print_tu_stats (dwarf2_per_objfile *per_objfile) static void process_skeletonless_type_unit (dwo_unit *dwo_unit, dwarf2_per_objfile *per_objfile, - cooked_index_storage *storage) + cooked_index_worker_result *storage) { dwarf2_per_bfd *per_bfd = per_objfile->per_bfd; @@ -3507,7 +3507,7 @@ process_skeletonless_type_unit (dwo_unit *dwo_unit, static void process_skeletonless_type_units (dwarf2_per_objfile *per_objfile, - cooked_index_storage *storage) + cooked_index_worker_result *storage) { /* Skeletonless TUs in DWP files without .gdb_index is not supported yet. */ if (get_dwp_file (per_objfile) == nullptr) @@ -3553,7 +3553,7 @@ private: /* After the last DWARF-reading task has finished, this function does the remaining work to finish the scan. */ - void done_reading (); + void done_reading () override; /* An iterator for the comp units. */ using unit_iterator = std::vector<dwarf2_per_cu_up>::iterator; @@ -3567,12 +3567,13 @@ private: /* A storage object for "leftovers" -- see the 'start' method, but essentially things not parsed during the normal CU parsing passes. */ - cooked_index_storage m_index_storage; + cooked_index_worker_result m_index_storage; }; void -cooked_index_worker_debug_info::process_cus (size_t task_number, unit_iterator first, - unit_iterator end) +cooked_index_worker_debug_info::process_cus (size_t task_number, + unit_iterator first, + unit_iterator end) { SCOPE_EXIT { bfd_thread_cleanup (); }; @@ -3580,7 +3581,7 @@ cooked_index_worker_debug_info::process_cus (size_t task_number, unit_iterator f complaint_interceptor complaint_handler; std::vector<gdb_exception> errors; - cooked_index_storage thread_storage; + cooked_index_worker_result thread_storage; for (auto inner = first; inner != end; ++inner) { dwarf2_per_cu *per_cu = inner->get (); @@ -3591,43 +3592,24 @@ cooked_index_worker_debug_info::process_cus (size_t task_number, unit_iterator f } catch (gdb_exception &except) { - errors.push_back (std::move (except)); + thread_storage.note_error (std::move (except)); } } - m_results[task_number] = result_type (thread_storage.release (), - complaint_handler.release (), - std::move (errors), - thread_storage.release_parent_map ()); + thread_storage.done_reading (complaint_handler.release ()); + m_results[task_number] = std::move (thread_storage); } void cooked_index_worker_debug_info::done_reading () { - /* Only handle the scanning results here. Complaints and exceptions - can only be dealt with on the main thread. */ - std::vector<cooked_index_shard_up> shards; - - for (auto &one_result : m_results) - { - shards.push_back (std::move (std::get<0> (one_result))); - m_all_parents_map.add_map (std::get<3> (one_result)); - } - /* This has to wait until we read the CUs, we need the list of DWOs. */ process_skeletonless_type_units (m_per_objfile, &m_index_storage); - shards.push_back (m_index_storage.release ()); - shards.shrink_to_fit (); - - m_all_parents_map.add_map (m_index_storage.release_parent_map ()); + m_results.push_back (std::move (m_index_storage)); - dwarf2_per_bfd *per_bfd = m_per_objfile->per_bfd; - cooked_index *table - = (gdb::checked_static_cast<cooked_index *> - (per_bfd->index_table.get ())); - table->set_contents (std::move (shards), &m_warnings, - &m_all_parents_map); + /* Call into the base class. */ + cooked_index_worker::done_reading (); } void |