mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-06 15:43:09 +00:00
gdb/dwarf: track compilation and type unit count
A subsequent commit will remove the all_comp_units and all_type_units array views, since it's not possible to assume that that all_units vector is segmented between comp and type units. Some callers still need to know the number of each kind, so track that separately. Change-Id: I712fbdfbf10b333c431b688b881cc0987e74f688 Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
@@ -1690,6 +1690,7 @@ dwarf2_per_bfd::allocate_per_cu (dwarf2_section_info *section,
|
|||||||
dwarf2_per_cu_up result (new dwarf2_per_cu (this, section, sect_off,
|
dwarf2_per_cu_up result (new dwarf2_per_cu (this, section, sect_off,
|
||||||
length, is_dwz));
|
length, is_dwz));
|
||||||
result->index = all_units.size ();
|
result->index = all_units.size ();
|
||||||
|
this->num_comp_units++;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1706,7 +1707,7 @@ dwarf2_per_bfd::allocate_signatured_type (dwarf2_section_info *section,
|
|||||||
= std::make_unique<signatured_type> (this, section, sect_off, length,
|
= std::make_unique<signatured_type> (this, section, sect_off, length,
|
||||||
is_dwz, signature);
|
is_dwz, signature);
|
||||||
result->index = all_units.size ();
|
result->index = all_units.size ();
|
||||||
tu_stats.nr_tus++;
|
this->num_type_units++;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3212,10 +3213,11 @@ private:
|
|||||||
|
|
||||||
void print_tu_stats (dwarf2_per_objfile *per_objfile)
|
void print_tu_stats (dwarf2_per_objfile *per_objfile)
|
||||||
{
|
{
|
||||||
struct tu_stats *tu_stats = &per_objfile->per_bfd->tu_stats;
|
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
|
||||||
|
tu_stats *tu_stats = &per_bfd->tu_stats;
|
||||||
|
|
||||||
dwarf_read_debug_printf ("Type unit statistics:");
|
dwarf_read_debug_printf ("Type unit statistics:");
|
||||||
dwarf_read_debug_printf (" %d TUs", tu_stats->nr_tus);
|
dwarf_read_debug_printf (" %d TUs", per_bfd->num_type_units);
|
||||||
dwarf_read_debug_printf (" %d uniq abbrev tables",
|
dwarf_read_debug_printf (" %d uniq abbrev tables",
|
||||||
tu_stats->nr_uniq_abbrev_tables);
|
tu_stats->nr_uniq_abbrev_tables);
|
||||||
dwarf_read_debug_printf (" %d symtabs from stmt_list entries",
|
dwarf_read_debug_printf (" %d symtabs from stmt_list entries",
|
||||||
@@ -3649,11 +3651,10 @@ read_comp_units_from_section (dwarf2_per_objfile *per_objfile,
|
|||||||
void
|
void
|
||||||
finalize_all_units (dwarf2_per_bfd *per_bfd)
|
finalize_all_units (dwarf2_per_bfd *per_bfd)
|
||||||
{
|
{
|
||||||
size_t nr_tus = per_bfd->tu_stats.nr_tus;
|
|
||||||
size_t nr_cus = per_bfd->all_units.size () - nr_tus;
|
|
||||||
gdb::array_view<dwarf2_per_cu_up> tmp = per_bfd->all_units;
|
gdb::array_view<dwarf2_per_cu_up> tmp = per_bfd->all_units;
|
||||||
per_bfd->all_comp_units = tmp.slice (0, nr_cus);
|
per_bfd->all_comp_units = tmp.slice (0, per_bfd->num_comp_units);
|
||||||
per_bfd->all_type_units = tmp.slice (nr_cus, nr_tus);
|
per_bfd->all_type_units
|
||||||
|
= tmp.slice (per_bfd->num_comp_units, per_bfd->num_type_units);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See read.h. */
|
/* See read.h. */
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ struct tu_stats
|
|||||||
int nr_symtab_sharers = 0;
|
int nr_symtab_sharers = 0;
|
||||||
int nr_stmt_less_type_units = 0;
|
int nr_stmt_less_type_units = 0;
|
||||||
int nr_all_type_units_reallocs = 0;
|
int nr_all_type_units_reallocs = 0;
|
||||||
int nr_tus = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct abbrev_table_cache;
|
struct abbrev_table_cache;
|
||||||
@@ -624,6 +623,10 @@ public:
|
|||||||
gdb::array_view<dwarf2_per_cu_up> all_comp_units;
|
gdb::array_view<dwarf2_per_cu_up> all_comp_units;
|
||||||
gdb::array_view<dwarf2_per_cu_up> all_type_units;
|
gdb::array_view<dwarf2_per_cu_up> all_type_units;
|
||||||
|
|
||||||
|
/* Number of compilation and type units in the ALL_UNITS vector. */
|
||||||
|
unsigned int num_comp_units = 0;
|
||||||
|
unsigned int num_type_units = 0;
|
||||||
|
|
||||||
std::vector<dwarf2_per_cu *> all_comp_units_index_cus;
|
std::vector<dwarf2_per_cu *> all_comp_units_index_cus;
|
||||||
std::vector<dwarf2_per_cu *> all_comp_units_index_tus;
|
std::vector<dwarf2_per_cu *> all_comp_units_index_tus;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user