From: Simon Marchi Date: Tue, 17 Jun 2025 16:27:52 +0000 (-0400) Subject: gdb/dwarf: rename get_cu -> get_unit X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b3f4f211e281ed449074938f7ee600c9757de4be;p=thirdparty%2Fbinutils-gdb.git gdb/dwarf: rename get_cu -> get_unit This method returns type units too, so "get_unit" is a better name. Change-Id: I6ec9de3f783637a3e206bcaaec96a4e00b4b7d31 Approved-By: Tom Tromey --- diff --git a/gdb/dwarf2/read-debug-names.c b/gdb/dwarf2/read-debug-names.c index e5f604a8eb6..4b3f385a950 100644 --- a/gdb/dwarf2/read-debug-names.c +++ b/gdb/dwarf2/read-debug-names.c @@ -241,7 +241,7 @@ mapped_debug_names_reader::scan_one_entry (const char *name, continue; } } - per_cu = per_objfile->per_bfd->get_cu (ull); + per_cu = per_objfile->per_bfd->get_unit (ull); break; case DW_IDX_type_unit: /* Don't crash on bad data. */ @@ -255,7 +255,7 @@ mapped_debug_names_reader::scan_one_entry (const char *name, } { int nr_cus = per_objfile->per_bfd->all_comp_units.size (); - per_cu = per_objfile->per_bfd->get_cu (nr_cus + ull); + per_cu = per_objfile->per_bfd->get_unit (nr_cus + ull); } break; case DW_IDX_die_offset: @@ -263,7 +263,7 @@ mapped_debug_names_reader::scan_one_entry (const char *name, /* In a per-CU index (as opposed to a per-module index), index entries without CU attribute implicitly refer to the single CU. */ if (per_cu == NULL) - per_cu = per_objfile->per_bfd->get_cu (0); + per_cu = per_objfile->per_bfd->get_unit (0); break; case DW_IDX_parent: parent = ull; @@ -466,7 +466,7 @@ check_signatured_type_table_from_debug_names bool found = false; for (; j < nr_cus_tus; j++) - if (per_bfd->get_cu (j)->sect_off == sect_off) + if (per_bfd->get_unit (j)->sect_off == sect_off) { found = true; break; @@ -477,7 +477,7 @@ check_signatured_type_table_from_debug_names " ignoring .debug_names.")); return false; } - per_bfd->all_comp_units_index_tus.push_back (per_bfd->get_cu (j)); + per_bfd->all_comp_units_index_tus.push_back (per_bfd->get_unit (j)); } return true; } @@ -719,7 +719,7 @@ check_cus_from_debug_names_list (dwarf2_per_bfd *per_bfd, map.dwarf5_byte_order)); bool found = false; for (; j < nr_cus; j++) - if (per_bfd->get_cu (j)->sect_off == sect_off) + if (per_bfd->get_unit (j)->sect_off == sect_off) { found = true; break; @@ -730,7 +730,7 @@ check_cus_from_debug_names_list (dwarf2_per_bfd *per_bfd, " ignoring .debug_names.")); return false; } - per_bfd->all_comp_units_index_cus.push_back (per_bfd->get_cu (j)); + per_bfd->all_comp_units_index_cus.push_back (per_bfd->get_unit (j)); } return true; } @@ -749,7 +749,7 @@ check_cus_from_debug_names_list (dwarf2_per_bfd *per_bfd, (map.cu_table_reordered + i * map.offset_size, map.offset_size, map.dwarf5_byte_order)); - if (sect_off != per_bfd->get_cu (i)->sect_off) + if (sect_off != per_bfd->get_unit (i)->sect_off) { warning (_("Section .debug_names has incorrect entry in CU table," " ignoring .debug_names.")); diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c index 2029c3e09b2..70110b70862 100644 --- a/gdb/dwarf2/read-gdb-index.c +++ b/gdb/dwarf2/read-gdb-index.c @@ -1113,7 +1113,7 @@ dw2_expand_marked_cus (dwarf2_per_objfile *per_objfile, offset_type idx, continue; } - dwarf2_per_cu *per_cu = per_objfile->per_bfd->get_cu (cu_index); + dwarf2_per_cu *per_cu = per_objfile->per_bfd->get_unit (cu_index); if (!dw2_expand_symtabs_matching_one (per_cu, per_objfile, file_matcher, expansion_notify, lang_matcher)) @@ -1426,7 +1426,7 @@ create_addrmap_from_gdb_index (dwarf2_per_objfile *per_objfile, continue; } - mutable_map.set_empty (lo, hi - 1, per_bfd->get_cu (cu_index)); + mutable_map.set_empty (lo, hi - 1, per_bfd->get_unit (cu_index)); } index->index_addrmap diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index aa6f6ea904a..0afc836056a 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1901,7 +1901,7 @@ dwarf2_base_index_functions::print_stats (struct objfile *objfile, for (int i = 0; i < total; ++i) { - dwarf2_per_cu *per_cu = per_objfile->per_bfd->get_cu (i); + dwarf2_per_cu *per_cu = per_objfile->per_bfd->get_unit (i); if (!per_objfile->symtab_set_p (per_cu)) ++count; diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index f895b424efb..a5cfb3144f7 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -515,8 +515,8 @@ struct dwarf2_per_bfd const char *filename () const { return bfd_get_filename (this->obfd); } - /* Return the CU given its index. */ - dwarf2_per_cu *get_cu (int index) const + /* Return the unit given its index. */ + dwarf2_per_cu *get_unit (int index) const { return this->all_units[index].get (); } @@ -525,7 +525,7 @@ struct dwarf2_per_bfd dwarf2_per_cu *get_index_cu (int index) const { if (this->all_comp_units_index_cus.empty ()) - return get_cu (index); + return get_unit (index); return this->all_comp_units_index_cus[index]; } @@ -710,7 +710,7 @@ public: dwarf2_per_cu *operator* () const { - return m_per_bfd->get_cu (m_index); + return m_per_bfd->get_unit (m_index); } bool operator== (const all_units_iterator &other) const