]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/dwarf: rename get_cu -> get_unit
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 17 Jun 2025 16:27:52 +0000 (12:27 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 17 Jun 2025 18:51:42 +0000 (14:51 -0400)
This method returns type units too, so "get_unit" is a better name.

Change-Id: I6ec9de3f783637a3e206bcaaec96a4e00b4b7d31
Approved-By: Tom Tromey <tom@tromey.com>
gdb/dwarf2/read-debug-names.c
gdb/dwarf2/read-gdb-index.c
gdb/dwarf2/read.c
gdb/dwarf2/read.h

index e5f604a8eb6c7de95b168b08e8058bad4d69d983..4b3f385a950fa1bcdf0976796ac3dc648bdb3d4a 100644 (file)
@@ -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."));
index 2029c3e09b24bc9ec287447cd725c21804b83cfb..70110b708626f622bd827a31a912660e20f01e92 100644 (file)
@@ -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
index aa6f6ea904a08b2f84eb7e220bb34d23c9844b2a..0afc836056acf8858de3fdb682f969828157f74f 100644 (file)
@@ -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;
index f895b424efb4bf670b66196b358edb1ea33d566e..a5cfb3144f785ab4283ff2d49afc4b7153ae669b 100644 (file)
@@ -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