From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id DA8243817F43 for ; Sun, 18 Sep 2022 08:10:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DA8243817F43 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 024EE225FA for ; Sun, 18 Sep 2022 08:10:22 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CE49813A6B for ; Sun, 18 Sep 2022 08:10:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id XCphMW3SJmMTLwAAMHmgww (envelope-from ) for ; Sun, 18 Sep 2022 08:10:21 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 1/2] [gdb/symtab] Rename all_comp_units to all_units Date: Sun, 18 Sep 2022 10:10:20 +0200 Message-Id: <20220918081021.19721-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_STOCKGEN, OBFU_UNSUB_UL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Sep 2022 08:10:28 -0000 Mechanically rename all_comp_units to all_units: ... $ sed -i 's/all_comp_units/all_units/' gdb/dwarf2/* ... Tested on x86_64-linux. --- gdb/dwarf2/index-write.c | 20 +++--- gdb/dwarf2/read.c | 150 +++++++++++++++++++-------------------- gdb/dwarf2/read.h | 4 +- 3 files changed, 87 insertions(+), 87 deletions(-) diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c index b6d8dddafd3..09f14953bf8 100644 --- a/gdb/dwarf2/index-write.c +++ b/gdb/dwarf2/index-write.c @@ -1025,7 +1025,7 @@ class debug_names static bool check_dwarf64_offsets (dwarf2_per_objfile *per_objfile) { - for (const auto &per_cu : per_objfile->per_bfd->all_comp_units) + for (const auto &per_cu : per_objfile->per_bfd->all_units) { if (to_underlying (per_cu->sect_off) >= (static_cast (1) << 32)) @@ -1176,28 +1176,28 @@ write_gdbindex (dwarf2_per_objfile *per_objfile, in the index file). This will later be needed to write the address table. */ cu_index_map cu_index_htab; - cu_index_htab.reserve (per_objfile->per_bfd->all_comp_units.size ()); + cu_index_htab.reserve (per_objfile->per_bfd->all_units.size ()); /* Store out the .debug_type CUs, if any. */ data_buf types_cu_list; /* The CU list is already sorted, so we don't need to do additional work here. Also, the debug_types entries do not appear in - all_comp_units, but only in their own hash table. */ + all_units, but only in their own hash table. */ int counter = 0; int types_counter = 0; - for (int i = 0; i < per_objfile->per_bfd->all_comp_units.size (); ++i) + for (int i = 0; i < per_objfile->per_bfd->all_units.size (); ++i) { dwarf2_per_cu_data *per_cu - = per_objfile->per_bfd->all_comp_units[i].get (); + = per_objfile->per_bfd->all_units[i].get (); int &this_counter = per_cu->is_debug_types ? types_counter : counter; const auto insertpair = cu_index_htab.emplace (per_cu, this_counter); gdb_assert (insertpair.second); - /* The all_comp_units list contains CUs read from the objfile as well as + /* The all_units list contains CUs read from the objfile as well as from the eventual dwz file. We need to place the entry in the corresponding index. */ data_buf &cu_list = (per_cu->is_debug_types @@ -1264,16 +1264,16 @@ write_debug_names (dwarf2_per_objfile *per_objfile, /* The CU list is already sorted, so we don't need to do additional work here. Also, the debug_types entries do not appear in - all_comp_units, but only in their own hash table. */ + all_units, but only in their own hash table. */ data_buf cu_list; data_buf types_cu_list; debug_names nametable (per_objfile, dwarf5_is_dwarf64, dwarf5_byte_order); int counter = 0; int types_counter = 0; - for (int i = 0; i < per_objfile->per_bfd->all_comp_units.size (); ++i) + for (int i = 0; i < per_objfile->per_bfd->all_units.size (); ++i) { dwarf2_per_cu_data *per_cu - = per_objfile->per_bfd->all_comp_units[i].get (); + = per_objfile->per_bfd->all_units[i].get (); int &this_counter = per_cu->is_debug_types ? types_counter : counter; data_buf &this_list = per_cu->is_debug_types ? types_cu_list : cu_list; @@ -1286,7 +1286,7 @@ write_debug_names (dwarf2_per_objfile *per_objfile, } /* Verify that all units are represented. */ - gdb_assert (counter == (per_objfile->per_bfd->all_comp_units.size () + gdb_assert (counter == (per_objfile->per_bfd->all_units.size () - per_objfile->per_bfd->tu_stats.nr_tus)); gdb_assert (types_counter == per_objfile->per_bfd->tu_stats.nr_tus); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index ceb14511f8b..024d901b520 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1201,7 +1201,7 @@ static void prepare_one_comp_unit (struct dwarf2_cu *cu, static struct type *set_die_type (struct die_info *, struct type *, struct dwarf2_cu *, bool = false); -static void create_all_comp_units (dwarf2_per_objfile *per_objfile); +static void create_all_units (dwarf2_per_objfile *per_objfile); static void load_full_comp_unit (dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, @@ -1384,21 +1384,21 @@ line_header_eq_voidp (const void *item_lhs, const void *item_rhs) -/* An iterator for all_comp_units that is based on index. This - approach makes it possible to iterate over all_comp_units safely, +/* An iterator for all_units that is based on index. This + approach makes it possible to iterate over all_units safely, when some caller in the loop may add new units. */ -class all_comp_units_iterator +class all_units_iterator { public: - all_comp_units_iterator (dwarf2_per_bfd *per_bfd, bool start) + all_units_iterator (dwarf2_per_bfd *per_bfd, bool start) : m_per_bfd (per_bfd), - m_index (start ? 0 : per_bfd->all_comp_units.size ()) + m_index (start ? 0 : per_bfd->all_units.size ()) { } - all_comp_units_iterator &operator++ () + all_units_iterator &operator++ () { ++m_index; return *this; @@ -1409,13 +1409,13 @@ class all_comp_units_iterator return m_per_bfd->get_cu (m_index); } - bool operator== (const all_comp_units_iterator &other) const + bool operator== (const all_units_iterator &other) const { return m_index == other.m_index; } - bool operator!= (const all_comp_units_iterator &other) const + bool operator!= (const all_units_iterator &other) const { return m_index != other.m_index; } @@ -1426,24 +1426,24 @@ class all_comp_units_iterator size_t m_index; }; -/* A range adapter for the all_comp_units_iterator. */ -class all_comp_units_range +/* A range adapter for the all_units_iterator. */ +class all_units_range { public: - all_comp_units_range (dwarf2_per_bfd *per_bfd) + all_units_range (dwarf2_per_bfd *per_bfd) : m_per_bfd (per_bfd) { } - all_comp_units_iterator begin () + all_units_iterator begin () { - return all_comp_units_iterator (m_per_bfd, true); + return all_units_iterator (m_per_bfd, true); } - all_comp_units_iterator end () + all_units_iterator end () { - return all_comp_units_iterator (m_per_bfd, false); + return all_units_iterator (m_per_bfd, false); } private: @@ -1467,7 +1467,7 @@ dwarf2_per_bfd::dwarf2_per_bfd (bfd *obfd, const dwarf2_debug_sections *names, dwarf2_per_bfd::~dwarf2_per_bfd () { - for (auto &per_cu : all_comp_units) + for (auto &per_cu : all_units) { per_cu->imported_symtabs_free (); per_cu->free_cached_file_names (); @@ -2096,7 +2096,7 @@ dwarf2_per_bfd::allocate_per_cu () { dwarf2_per_cu_data_up result (new dwarf2_per_cu_data); result->per_bfd = this; - result->index = all_comp_units.size (); + result->index = all_units.size (); return result; } @@ -2107,7 +2107,7 @@ dwarf2_per_bfd::allocate_signatured_type (ULONGEST signature) { signatured_type_up result (new signatured_type (signature)); result->per_bfd = this; - result->index = all_comp_units.size (); + result->index = all_units.size (); result->is_debug_types = true; tu_stats.nr_tus++; return result; @@ -2151,7 +2151,7 @@ create_cus_from_index_list (dwarf2_per_bfd *per_bfd, dwarf2_per_cu_data_up per_cu = create_cu_from_index_list (per_bfd, section, is_dwz, sect_off, length); - per_bfd->all_comp_units.push_back (std::move (per_cu)); + per_bfd->all_units.push_back (std::move (per_cu)); } } @@ -2163,8 +2163,8 @@ create_cus_from_index (dwarf2_per_bfd *per_bfd, const gdb_byte *cu_list, offset_type cu_list_elements, const gdb_byte *dwz_list, offset_type dwz_elements) { - gdb_assert (per_bfd->all_comp_units.empty ()); - per_bfd->all_comp_units.reserve ((cu_list_elements + dwz_elements) / 2); + gdb_assert (per_bfd->all_units.empty ()); + per_bfd->all_units.reserve ((cu_list_elements + dwz_elements) / 2); create_cus_from_index_list (per_bfd, cu_list, cu_list_elements, &per_bfd->info, 0); @@ -2210,7 +2210,7 @@ create_signatured_type_table_from_index slot = htab_find_slot (sig_types_hash.get (), sig_type.get (), INSERT); *slot = sig_type.get (); - per_bfd->all_comp_units.emplace_back (sig_type.release ()); + per_bfd->all_units.emplace_back (sig_type.release ()); } per_bfd->signatured_types = std::move (sig_types_hash); @@ -2258,7 +2258,7 @@ create_signatured_type_table_from_debug_names slot = htab_find_slot (sig_types_hash.get (), sig_type.get (), INSERT); *slot = sig_type.get (); - per_objfile->per_bfd->all_comp_units.emplace_back (sig_type.release ()); + per_objfile->per_bfd->all_units.emplace_back (sig_type.release ()); } per_objfile->per_bfd->signatured_types = std::move (sig_types_hash); @@ -2301,7 +2301,7 @@ create_addrmap_from_index (dwarf2_per_objfile *per_objfile, continue; } - if (cu_index >= per_bfd->all_comp_units.size ()) + if (cu_index >= per_bfd->all_units.size ()) { complaint (_(".gdb_index address table has invalid CU number %u"), (unsigned) cu_index); @@ -2336,7 +2336,7 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, dwarf2_per_cu_data *, gdb::hash_enum> debug_info_offset_to_per_cu; - for (const auto &per_cu : per_bfd->all_comp_units) + for (const auto &per_cu : per_bfd->all_units) { /* A TU will not need aranges, and skipping them here is an easy way of ignoring .debug_types -- and possibly seeing a @@ -2349,7 +2349,7 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, = debug_info_offset_to_per_cu.emplace (per_cu->sect_off, per_cu.get ()); - /* Assume no duplicate offsets in all_comp_units. */ + /* Assume no duplicate offsets in all_units. */ gdb_assert (insertpair.second); } @@ -2709,7 +2709,7 @@ dwarf2_read_gdb_index index. */ if (per_bfd->types.size () > 1) { - per_bfd->all_comp_units.clear (); + per_bfd->all_units.clear (); return 0; } @@ -2726,7 +2726,7 @@ dwarf2_read_gdb_index per_bfd->index_table = std::move (map); per_bfd->quick_file_names_table = - create_quick_file_names_table (per_bfd->all_comp_units.size ()); + create_quick_file_names_table (per_bfd->all_units.size ()); return 1; } @@ -2881,7 +2881,7 @@ dwarf2_base_index_functions::find_last_source_symtab (struct objfile *objfile) { dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); dwarf2_per_cu_data *dwarf_cu - = per_objfile->per_bfd->all_comp_units.back ().get (); + = per_objfile->per_bfd->all_units.back ().get (); compunit_symtab *cust = dw2_instantiate_symtab (dwarf_cu, per_objfile, false); if (cust == NULL) @@ -2918,7 +2918,7 @@ dwarf2_base_index_functions::forget_cached_source_info { dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); - for (auto &per_cu : per_objfile->per_bfd->all_comp_units) + for (auto &per_cu : per_objfile->per_bfd->all_units) per_cu->free_cached_file_names (); } @@ -2993,7 +2993,7 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter, && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE); /* Don't crash on bad data. */ - if (cu_index >= per_objfile->per_bfd->all_comp_units.size ()) + if (cu_index >= per_objfile->per_bfd->all_units.size ()) { complaint (_(".gdb_index entry has bad CU index" " [in module %s]"), objfile_name (per_objfile->objfile)); @@ -3074,7 +3074,7 @@ dwarf2_base_index_functions::print_stats (struct objfile *objfile, return; dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); - int total = per_objfile->per_bfd->all_comp_units.size (); + int total = per_objfile->per_bfd->all_units.size (); int count = 0; for (int i = 0; i < total; ++i) @@ -3108,7 +3108,7 @@ void dwarf2_base_index_functions::expand_all_symtabs (struct objfile *objfile) { dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); - int total_units = per_objfile->per_bfd->all_comp_units.size (); + int total_units = per_objfile->per_bfd->all_units.size (); for (int i = 0; i < total_units; ++i) { @@ -4071,7 +4071,7 @@ dw2_expand_marked_cus } /* Don't crash on bad data. */ - if (cu_index >= per_objfile->per_bfd->all_comp_units.size ()) + if (cu_index >= per_objfile->per_bfd->all_units.size ()) { complaint (_(".gdb_index entry has bad CU index" " [in module %s]"), objfile_name (per_objfile->objfile)); @@ -4109,7 +4109,7 @@ dw_expand_symtabs_matching_file_matcher /* The rule is CUs specify all the files, including those used by any TU, so there's no need to scan TUs here. */ - for (const auto &per_cu : per_objfile->per_bfd->all_comp_units) + for (const auto &per_cu : per_objfile->per_bfd->all_units) { QUIT; @@ -4208,7 +4208,7 @@ dwarf2_gdb_index::expand_symtabs_matching if (lookup_name == nullptr) { for (dwarf2_per_cu_data *per_cu - : all_comp_units_range (per_objfile->per_bfd)) + : all_units_range (per_objfile->per_bfd)) { QUIT; @@ -4326,7 +4326,7 @@ dwarf2_base_index_functions::map_symbol_filenames reuse the file names data from a currently unexpanded CU, in this case we don't want to report the files from the unexpanded CU. */ - for (const auto &per_cu : per_objfile->per_bfd->all_comp_units) + for (const auto &per_cu : per_objfile->per_bfd->all_units) { if (!per_cu->is_debug_types && per_objfile->symtab_set_p (per_cu.get ())) @@ -4337,7 +4337,7 @@ dwarf2_base_index_functions::map_symbol_filenames } for (dwarf2_per_cu_data *per_cu - : all_comp_units_range (per_objfile->per_bfd)) + : all_units_range (per_objfile->per_bfd)) { /* We only need to look at symtabs not already expanded. */ if (per_cu->is_debug_types || per_objfile->symtab_set_p (per_cu)) @@ -4397,7 +4397,7 @@ dwarf2_base_index_functions::has_unexpanded_symtabs (struct objfile *objfile) { dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); - for (const auto &per_cu : per_objfile->per_bfd->all_comp_units) + for (const auto &per_cu : per_objfile->per_bfd->all_units) { /* Is this already expanded? */ if (per_objfile->symtab_set_p (per_cu.get ())) @@ -4625,7 +4625,7 @@ create_cus_from_debug_names_list (dwarf2_per_bfd *per_bfd, dwarf2_per_cu_data_up per_cu = create_cu_from_index_list (per_bfd, §ion, is_dwz, sect_off, 0); - per_bfd->all_comp_units.push_back (std::move (per_cu)); + per_bfd->all_units.push_back (std::move (per_cu)); } return true; } @@ -4664,7 +4664,7 @@ create_cus_from_debug_names_list (dwarf2_per_bfd *per_bfd, dwarf2_per_cu_data_up per_cu = create_cu_from_index_list (per_bfd, §ion, is_dwz, sect_off_prev, length); - per_bfd->all_comp_units.push_back (std::move (per_cu)); + per_bfd->all_units.push_back (std::move (per_cu)); } sect_off_prev = sect_off_next; } @@ -4680,8 +4680,8 @@ create_cus_from_debug_names (dwarf2_per_bfd *per_bfd, const mapped_debug_names &map, const mapped_debug_names &dwz_map) { - gdb_assert (per_bfd->all_comp_units.empty ()); - per_bfd->all_comp_units.reserve (map.cu_count + dwz_map.cu_count); + gdb_assert (per_bfd->all_units.empty ()); + per_bfd->all_units.reserve (map.cu_count + dwz_map.cu_count); if (!create_cus_from_debug_names_list (per_bfd, map, per_bfd->info, false /* is_dwz */)) @@ -4731,7 +4731,7 @@ dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile) if (!create_cus_from_debug_names (per_bfd, *map, dwz_map)) { - per_bfd->all_comp_units.clear (); + per_bfd->all_units.clear (); return false; } @@ -4741,7 +4741,7 @@ dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile) index. */ if (per_bfd->types.size () > 1) { - per_bfd->all_comp_units.clear (); + per_bfd->all_units.clear (); return false; } @@ -4758,7 +4758,7 @@ dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile) per_bfd->index_table = std::move (map); per_bfd->quick_file_names_table = - create_quick_file_names_table (per_bfd->all_comp_units.size ()); + create_quick_file_names_table (per_bfd->all_units.size ()); return true; } @@ -5017,7 +5017,7 @@ dw2_debug_names_iterator::next () case DW_IDX_compile_unit: { /* Don't crash on bad data. */ - int nr_cus = (per_bfd->all_comp_units.size () + int nr_cus = (per_bfd->all_units.size () - per_bfd->tu_stats.nr_tus); if (ull >= nr_cus) { @@ -5041,7 +5041,7 @@ dw2_debug_names_iterator::next () continue; } { - int nr_cus = (per_bfd->all_comp_units.size () + int nr_cus = (per_bfd->all_units.size () - per_bfd->tu_stats.nr_tus); per_cu = per_bfd->get_cu (nr_cus + ull); } @@ -5254,7 +5254,7 @@ dwarf2_debug_names_index::expand_symtabs_matching if (lookup_name == nullptr) { for (dwarf2_per_cu_data *per_cu - : all_comp_units_range (per_objfile->per_bfd)) + : all_units_range (per_objfile->per_bfd)) { QUIT; @@ -5365,9 +5365,9 @@ dwarf2_initialize_objfile (struct objfile *objfile) { dwarf_read_debug_printf ("readnow requested"); - create_all_comp_units (per_objfile); + create_all_units (per_objfile); per_bfd->quick_file_names_table - = create_quick_file_names_table (per_bfd->all_comp_units.size ()); + = create_quick_file_names_table (per_bfd->all_units.size ()); objfile->qf.emplace_front (new readnow_functions); return; @@ -5662,15 +5662,15 @@ create_debug_types_hash_table (dwarf2_per_objfile *per_objfile, static struct signatured_type * add_type_unit (dwarf2_per_objfile *per_objfile, ULONGEST sig, void **slot) { - if (per_objfile->per_bfd->all_comp_units.size () - == per_objfile->per_bfd->all_comp_units.capacity ()) + if (per_objfile->per_bfd->all_units.size () + == per_objfile->per_bfd->all_units.capacity ()) ++per_objfile->per_bfd->tu_stats.nr_all_type_units_reallocs; signatured_type_up sig_type_holder = per_objfile->per_bfd->allocate_signatured_type (sig); signatured_type *sig_type = sig_type_holder.get (); - per_objfile->per_bfd->all_comp_units.emplace_back + per_objfile->per_bfd->all_units.emplace_back (sig_type_holder.release ()); if (slot == NULL) @@ -6942,12 +6942,12 @@ build_type_psymtabs (dwarf2_per_objfile *per_objfile, dwarf_read_debug_printf ("Building type unit groups ..."); - /* Sort in a separate table to maintain the order of all_comp_units + /* Sort in a separate table to maintain the order of all_units for .gdb_index: TU indices directly index all_type_units. */ std::vector sorted_by_abbrev; sorted_by_abbrev.reserve (per_objfile->per_bfd->tu_stats.nr_tus); - for (const auto &cu : per_objfile->per_bfd->all_comp_units) + for (const auto &cu : per_objfile->per_bfd->all_units) { if (cu->is_debug_types) { @@ -7032,7 +7032,7 @@ process_skeletonless_type_unit (void **slot, void *info) if (*slot != NULL) return 1; - /* This does the job that create_all_comp_units would have done for + /* This does the job that create_all_units would have done for this TU. */ signatured_type *entry = add_type_unit (data->per_objfile, dwo_unit->signature, slot); @@ -7096,12 +7096,12 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile) per_bfd->map_info_sections (objfile); cooked_index_storage index_storage; - create_all_comp_units (per_objfile); + create_all_units (per_objfile); build_type_psymtabs (per_objfile, &index_storage); std::vector> indexes; per_bfd->quick_file_names_table - = create_quick_file_names_table (per_bfd->all_comp_units.size ()); + = create_quick_file_names_table (per_bfd->all_units.size ()); if (!per_bfd->debug_aranges.empty ()) read_addrmap_from_aranges (per_objfile, &per_bfd->debug_aranges, index_storage.get_addrmap ()); @@ -7110,7 +7110,7 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile) /* Ensure that complaints are handled correctly. */ complaint_interceptor complaint_handler; - using iter_type = decltype (per_bfd->all_comp_units.begin ()); + using iter_type = decltype (per_bfd->all_units.begin ()); auto task_size_ = [] (iter_type iter) { @@ -7127,8 +7127,8 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile) using result_type = std::pair, std::vector>; std::vector results - = gdb::parallel_for_each (1, per_bfd->all_comp_units.begin (), - per_bfd->all_comp_units.end (), + = gdb::parallel_for_each (1, per_bfd->all_units.begin (), + per_bfd->all_units.end (), [=] (iter_type iter, iter_type end) { std::vector errors; @@ -7255,7 +7255,7 @@ read_comp_units_from_section (dwarf2_per_objfile *per_objfile, this_cu->set_version (cu_header.version); info_ptr = info_ptr + this_cu->length (); - per_objfile->per_bfd->all_comp_units.push_back (std::move (this_cu)); + per_objfile->per_bfd->all_units.push_back (std::move (this_cu)); } } @@ -7263,10 +7263,10 @@ read_comp_units_from_section (dwarf2_per_objfile *per_objfile, This is only done for -readnow and building partial symtabs. */ static void -create_all_comp_units (dwarf2_per_objfile *per_objfile) +create_all_units (dwarf2_per_objfile *per_objfile) { htab_up types_htab; - gdb_assert (per_objfile->per_bfd->all_comp_units.empty ()); + gdb_assert (per_objfile->per_bfd->all_units.empty ()); read_comp_units_from_section (per_objfile, &per_objfile->per_bfd->info, &per_objfile->per_bfd->abbrev, 0, @@ -18649,7 +18649,7 @@ cooked_index_functions::expand_symtabs_matching if (lookup_name == nullptr) { for (dwarf2_per_cu_data *per_cu - : all_comp_units_range (per_objfile->per_bfd)) + : all_units_range (per_objfile->per_bfd)) { QUIT; @@ -23542,18 +23542,18 @@ static int dwarf2_find_containing_comp_unit (sect_offset sect_off, unsigned int offset_in_dwz, - const std::vector &all_comp_units) + const std::vector &all_units) { int low, high; low = 0; - high = all_comp_units.size () - 1; + high = all_units.size () - 1; while (high > low) { struct dwarf2_per_cu_data *mid_cu; int mid = low + (high - low) / 2; - mid_cu = all_comp_units[mid].get (); + mid_cu = all_units[mid].get (); if (mid_cu->is_dwz > offset_in_dwz || (mid_cu->is_dwz == offset_in_dwz && mid_cu->sect_off + mid_cu->length () > sect_off)) @@ -23574,8 +23574,8 @@ dwarf2_find_containing_comp_unit (sect_offset sect_off, dwarf2_per_bfd *per_bfd) { int low = dwarf2_find_containing_comp_unit - (sect_off, offset_in_dwz, per_bfd->all_comp_units); - dwarf2_per_cu_data *this_cu = per_bfd->all_comp_units[low].get (); + (sect_off, offset_in_dwz, per_bfd->all_units); + dwarf2_per_cu_data *this_cu = per_bfd->all_units[low].get (); if (this_cu->is_dwz != offset_in_dwz || this_cu->sect_off > sect_off) { @@ -23585,13 +23585,13 @@ dwarf2_find_containing_comp_unit (sect_offset sect_off, sect_offset_str (sect_off), bfd_get_filename (per_bfd->obfd)); - gdb_assert (per_bfd->all_comp_units[low-1]->sect_off + gdb_assert (per_bfd->all_units[low-1]->sect_off <= sect_off); - return per_bfd->all_comp_units[low - 1].get (); + return per_bfd->all_units[low - 1].get (); } else { - if (low == per_bfd->all_comp_units.size () - 1 + if (low == per_bfd->all_units.size () - 1 && sect_off >= this_cu->sect_off + this_cu->length ()) error (_("invalid dwarf2 offset %s"), sect_offset_str (sect_off)); gdb_assert (sect_off < this_cu->sect_off + this_cu->length ()); diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index c2f86a9d367..ce4fe52f4a2 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -433,7 +433,7 @@ struct dwarf2_per_bfd /* Return the CU given its index. */ dwarf2_per_cu_data *get_cu (int index) const { - return this->all_comp_units[index].get (); + return this->all_units[index].get (); } /* A convenience function to allocate a dwarf2_per_cu_data. The @@ -489,7 +489,7 @@ struct dwarf2_per_bfd /* Table of all the compilation units. This is used to locate the target compilation unit of a particular reference. */ - std::vector all_comp_units; + std::vector all_units; /* Table of struct type_unit_group objects. The hash key is the DW_AT_stmt_list value. */ base-commit: 4e38ed582cb9a2e09141126c2e0a527816e702e6 -- 2.35.3