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,
\f
-/* 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;
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;
}
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:
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 ();
{
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;
}
{
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;
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));
}
}
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);
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);
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);
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);
dwarf2_per_cu_data *,
gdb::hash_enum<sect_offset>>
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
= 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);
}
index. */
if (per_bfd->types.size () > 1)
{
- per_bfd->all_comp_units.clear ();
+ per_bfd->all_units.clear ();
return 0;
}
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;
}
{
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)
{
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 ();
}
&& 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));
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)
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)
{
}
/* 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));
/* 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;
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;
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 ()))
}
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))
{
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 ()))
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;
}
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;
}
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 */))
if (!create_cus_from_debug_names (per_bfd, *map, dwz_map))
{
- per_bfd->all_comp_units.clear ();
+ per_bfd->all_units.clear ();
return false;
}
index. */
if (per_bfd->types.size () > 1)
{
- per_bfd->all_comp_units.clear ();
+ per_bfd->all_units.clear ();
return false;
}
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;
}
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)
{
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);
}
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;
{
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;
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)
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<tu_abbrev_offset> 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)
{
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);
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<std::unique_ptr<cooked_index>> 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 ());
/* 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)
{
using result_type = std::pair<std::unique_ptr<cooked_index>,
std::vector<gdb_exception>>;
std::vector<result_type> 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<gdb_exception> errors;
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));
}
}
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,
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;
dwarf2_find_containing_comp_unit
(sect_offset sect_off,
unsigned int offset_in_dwz,
- const std::vector<dwarf2_per_cu_data_up> &all_comp_units)
+ const std::vector<dwarf2_per_cu_data_up> &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))
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)
{
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 ());