return per_cu->v.quick->compunit_symtab;
}
-/* Return the CU/TU given its index.
+/* See declaration. */
- This is intended for loops like:
+dwarf2_per_cu_data *
+dwarf2_per_objfile::get_cutu (int index)
+{
+ if (index >= this->n_comp_units)
+ {
+ index -= this->n_comp_units;
+ gdb_assert (index < this->n_type_units);
+ return &this->all_type_units[index]->per_cu;
+ }
- for (i = 0; i < (dwarf2_per_objfile->n_comp_units
- + dwarf2_per_objfile->n_type_units); ++i)
- {
- struct dwarf2_per_cu_data *per_cu = dw2_get_cutu (i);
+ return this->all_comp_units[index];
+}
- ...;
- }
-*/
+/* See declaration. */
-static struct dwarf2_per_cu_data *
-dw2_get_cutu (struct dwarf2_per_objfile *dwarf2_per_objfile,
- int index)
+dwarf2_per_cu_data *
+dwarf2_per_objfile::get_cu (int index)
{
- if (index >= dwarf2_per_objfile->n_comp_units)
- {
- index -= dwarf2_per_objfile->n_comp_units;
- gdb_assert (index < dwarf2_per_objfile->n_type_units);
- return &dwarf2_per_objfile->all_type_units[index]->per_cu;
- }
+ gdb_assert (index >= 0 && index < this->n_comp_units);
- return dwarf2_per_objfile->all_comp_units[index];
+ return this->all_comp_units[index];
}
-/* Return the CU given its index.
- This differs from dw2_get_cutu in that it's for when you know INDEX
- refers to a CU. */
+/* See declaration. */
-static struct dwarf2_per_cu_data *
-dw2_get_cu (struct dwarf2_per_objfile *dwarf2_per_objfile, int index)
+signatured_type *
+dwarf2_per_objfile::get_tu (int index)
{
- gdb_assert (index >= 0 && index < dwarf2_per_objfile->n_comp_units);
+ gdb_assert (index >= 0 && index < this->n_type_units);
- return dwarf2_per_objfile->all_comp_units[index];
+ return this->all_type_units[index];
}
/* Return a new dwarf2_per_cu_data allocated on OBJFILE's
lo = gdbarch_adjust_dwarf2_addr (gdbarch, lo + baseaddr);
hi = gdbarch_adjust_dwarf2_addr (gdbarch, hi + baseaddr);
addrmap_set_empty (mutable_map, lo, hi - 1,
- dw2_get_cutu (dwarf2_per_objfile, cu_index));
+ dwarf2_per_objfile->get_cu (cu_index));
}
objfile->psymtabs_addrmap = addrmap_create_fixed (mutable_map,
debug_info_offset_to_per_cu;
for (int cui = 0; cui < dwarf2_per_objfile->n_comp_units; ++cui)
{
- dwarf2_per_cu_data *per_cu = dw2_get_cutu (dwarf2_per_objfile, cui);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cu (cui);
const auto insertpair
= debug_info_offset_to_per_cu.emplace (per_cu->sect_off, per_cu);
if (!insertpair.second)
struct dwarf2_per_objfile *dwarf2_per_objfile
= get_dwarf2_per_objfile (objfile);
int index = dwarf2_per_objfile->n_comp_units - 1;
- dwarf2_per_cu_data *dwarf_cu = dw2_get_cutu (dwarf2_per_objfile, index);
+ dwarf2_per_cu_data *dwarf_cu = dwarf2_per_objfile->get_cu (index);
compunit_symtab *cust = dw2_instantiate_symtab (dwarf_cu);
if (cust == NULL)
for (int i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
{
int j;
- struct dwarf2_per_cu_data *per_cu = dw2_get_cu (dwarf2_per_objfile, i);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cu (i);
struct quick_file_names *file_data;
/* We only need to look at symtabs not already expanded. */
offset_type cu_index_and_attrs =
MAYBE_SWAP (iter->vec[iter->next + 1]);
offset_type cu_index = GDB_INDEX_CU_VALUE (cu_index_and_attrs);
- struct dwarf2_per_cu_data *per_cu;
int want_static = iter->block_index != GLOBAL_BLOCK;
/* This value is only valid for index versions >= 7. */
int is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (cu_index_and_attrs);
continue;
}
- per_cu = dw2_get_cutu (dwarf2_per_objfile, cu_index);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cutu (cu_index);
/* Skip if already read in. */
if (per_cu->v.quick->compunit_symtab)
for (int i = 0; i < total; ++i)
{
- struct dwarf2_per_cu_data *per_cu = dw2_get_cutu (dwarf2_per_objfile, i);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cutu (i);
if (!per_cu->v.quick->compunit_symtab)
++count;
for (int i = 0; i < total_units; ++i)
{
- struct dwarf2_per_cu_data *per_cu
- = dw2_get_cutu (dwarf2_per_objfile, i);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cutu (i);
dw2_instantiate_symtab (per_cu);
}
for (int i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
{
int j;
- struct dwarf2_per_cu_data *per_cu = dw2_get_cutu (dwarf2_per_objfile, i);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cu (i);
struct quick_file_names *file_data;
/* We only need to look at symtabs not already expanded. */
vec_len = MAYBE_SWAP (vec[0]);
for (vec_idx = 0; vec_idx < vec_len; ++vec_idx)
{
- struct dwarf2_per_cu_data *per_cu;
offset_type cu_index_and_attrs = MAYBE_SWAP (vec[vec_idx + 1]);
/* This value is only valid for index versions >= 7. */
int is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (cu_index_and_attrs);
continue;
}
- per_cu = dw2_get_cutu (dwarf2_per_objfile, cu_index);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cutu (cu_index);
dw2_expand_symtabs_matching_one (per_cu, file_matcher,
expansion_notify);
}
for (int i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
{
int j;
- struct dwarf2_per_cu_data *per_cu = dw2_get_cu (dwarf2_per_objfile, i);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cu (i);
struct quick_file_names *file_data;
void **slot;
for (int i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
{
- dwarf2_per_cu_data *per_cu = dw2_get_cutu (dwarf2_per_objfile, i);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cu (i);
if (per_cu->v.quick->compunit_symtab)
{
for (int i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
{
- dwarf2_per_cu_data *per_cu = dw2_get_cu (dwarf2_per_objfile, i);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cu (i);
struct quick_file_names *file_data;
void **slot;
objfile_name (dwarf2_per_objfile->objfile));
continue;
}
- per_cu = dw2_get_cutu (dwarf2_per_objfile, ull);
+ per_cu = dwarf2_per_objfile->get_cutu (ull);
break;
case DW_IDX_type_unit:
/* Don't crash on bad data. */
objfile_name (dwarf2_per_objfile->objfile));
continue;
}
- per_cu = dw2_get_cutu (dwarf2_per_objfile,
- dwarf2_per_objfile->n_comp_units + ull);
+ per_cu = &dwarf2_per_objfile->get_tu (ull)->per_cu;
break;
case DW_IDX_GNU_internal:
if (!m_map.augmentation_is_gdb)
for (i = 0; i < (dwarf2_per_objfile->n_comp_units
+ dwarf2_per_objfile->n_type_units); ++i)
{
- dwarf2_per_cu_data *per_cu = dw2_get_cutu (dwarf2_per_objfile, i);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cutu (i);
per_cu->v.quick = OBSTACK_ZALLOC (&objfile->objfile_obstack,
struct dwarf2_per_cu_quick_data);
for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
{
- struct dwarf2_per_cu_data *per_cu = dw2_get_cutu (dwarf2_per_objfile, i);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cu (i);
struct partial_symtab *pst = per_cu->v.psymtab;
int j;
for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
{
- struct dwarf2_per_cu_data *per_cu = dw2_get_cutu (dwarf2_per_objfile, i);
+ dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cu (i);
process_psymtab_comp_unit (per_cu, 0, language_minimal);
}