/* See read.h. */
dwarf2_per_cu_data_up
-dwarf2_per_bfd::allocate_per_cu (sect_offset sect_off)
+dwarf2_per_bfd::allocate_per_cu (dwarf2_section_info *section,
+ sect_offset sect_off)
{
- dwarf2_per_cu_data_up result (new dwarf2_per_cu_data (this, sect_off));
+ dwarf2_per_cu_data_up result (new dwarf2_per_cu_data (this, section,
+ sect_off));
result->index = all_units.size ();
return result;
}
/* See read.h. */
signatured_type_up
-dwarf2_per_bfd::allocate_signatured_type (sect_offset sect_off, ULONGEST signature)
+dwarf2_per_bfd::allocate_signatured_type (dwarf2_section_info *section,
+ sect_offset sect_off,
+ ULONGEST signature)
{
- signatured_type_up result (new signatured_type (this, sect_off, signature));
+ auto result
+ = std::make_unique<signatured_type> (this, section, sect_off, signature);
result->index = all_units.size ();
result->is_debug_types = true;
tu_stats.nr_tus++;
int is_dwz,
sect_offset sect_off, ULONGEST length)
{
- dwarf2_per_cu_data_up the_cu = per_bfd->allocate_per_cu (sect_off);
+ dwarf2_per_cu_data_up the_cu = per_bfd->allocate_per_cu (section, sect_off);
the_cu->set_length (length);
- the_cu->section = section;
the_cu->is_dwz = is_dwz;
return the_cu;
}
Otherwise we find one. */
static struct signatured_type *
-add_type_unit (dwarf2_per_bfd *per_bfd, sect_offset sect_off, ULONGEST sig,
- void **slot)
+add_type_unit (dwarf2_per_bfd *per_bfd, dwarf2_section_info *section,
+ sect_offset sect_off, ULONGEST sig, void **slot)
{
if (per_bfd->all_units.size () == per_bfd->all_units.capacity ())
++per_bfd->tu_stats.nr_all_type_units_reallocs;
signatured_type_up sig_type_holder
- = per_bfd->allocate_signatured_type (sect_off, sig);
+ = per_bfd->allocate_signatured_type (section, sect_off, sig);
signatured_type *sig_type = sig_type_holder.get ();
per_bfd->all_units.emplace_back (sig_type_holder.release ());
gdb_assert (sig_entry->dwo_unit == NULL
|| sig_entry->dwo_unit == dwo_entry);
- sig_entry->section = dwo_entry->section;
sig_entry->set_length (dwo_entry->length, false);
sig_entry->reading_dwo_directly = 1;
sig_entry->type_offset_in_tu = dwo_entry->type_offset_in_tu;
the TU has an entry in .gdb_index, replace the recorded data from
.gdb_index with this TU. */
- signatured_type find_sig_entry (nullptr, sect_offset {}, sig);
+ signatured_type find_sig_entry (nullptr, nullptr, sect_offset {}, sig);
slot = htab_find_slot (per_bfd->signatured_types.get (), &find_sig_entry,
INSERT);
signatured_type *sig_entry = (struct signatured_type *) *slot;
/* If the global table doesn't have an entry for this TU, add one. */
if (sig_entry == NULL)
- sig_entry = add_type_unit (per_bfd, dwo_entry->sect_off, sig, slot);
+ sig_entry = add_type_unit (per_bfd, dwo_entry->section, dwo_entry->sect_off,
+ sig, slot);
if (sig_entry->dwo_unit == nullptr)
fill_in_sig_entry_from_dwo_entry (per_objfile, sig_entry, dwo_entry);
if (per_bfd->signatured_types == NULL)
per_bfd->signatured_types = allocate_signatured_type_table ();
- signatured_type find_sig_entry (nullptr, sect_offset {}, sig);
+ signatured_type find_sig_entry (nullptr, nullptr, sect_offset {}, sig);
slot = htab_find_slot (per_bfd->signatured_types.get (), &find_sig_entry,
INSERT);
signatured_type *sig_entry = (struct signatured_type *) *slot;
if (dwo_entry == NULL)
return NULL;
- sig_entry = add_type_unit (per_bfd, dwo_entry->sect_off, sig, slot);
+ sig_entry = add_type_unit (per_bfd, nullptr, dwo_entry->sect_off, sig, slot);
fill_in_sig_entry_from_dwo_entry (per_objfile, sig_entry, dwo_entry);
return sig_entry;
{
if (per_objfile->per_bfd->signatured_types == NULL)
return NULL;
- signatured_type find_entry (nullptr, sect_offset {}, sig);
+ signatured_type find_entry (nullptr, nullptr, sect_offset {}, sig);
return ((struct signatured_type *)
htab_find (per_objfile->per_bfd->signatured_types.get (),
&find_entry));
if (per_bfd->signatured_types == NULL)
per_bfd->signatured_types = allocate_signatured_type_table ();
- signatured_type find_entry (nullptr, sect_offset {}, dwo_unit->signature);
+ signatured_type find_entry (nullptr, nullptr, sect_offset {},
+ dwo_unit->signature);
slot = htab_find_slot (per_bfd->signatured_types.get (), &find_entry, INSERT);
/* If we've already seen this type there's nothing to do. What's happening
/* This does the job that create_all_units would have done for
this TU. */
signatured_type *entry
- = add_type_unit (per_bfd, dwo_unit->sect_off, dwo_unit->signature, slot);
+ = add_type_unit (per_bfd, dwo_unit->section, dwo_unit->sect_off,
+ dwo_unit->signature, slot);
fill_in_sig_entry_from_dwo_entry (per_objfile, entry, dwo_unit);
*slot = entry;
/* Save the compilation unit for later lookup. */
if (cu_header.unit_type != DW_UT_type)
- this_cu = per_objfile->per_bfd->allocate_per_cu (sect_off);
+ this_cu = per_objfile->per_bfd->allocate_per_cu (section, sect_off);
else
{
if (types_htab == nullptr)
types_htab = allocate_signatured_type_table ();
auto sig_type = per_objfile->per_bfd->allocate_signatured_type
- (sect_off, cu_header.signature);
+ (section, sect_off, cu_header.signature);
signatured_type *sig_ptr = sig_type.get ();
sig_type->type_offset_in_tu = cu_header.type_cu_offset_in_tu;
this_cu.reset (sig_type.release ());
this_cu->set_length (cu_header.get_length_with_initial ());
this_cu->is_dwz = is_dwz;
- this_cu->section = section;
/* Init this asap, to avoid a data race in the set_version in
cutu_reader::cutu_reader (which may be run in parallel for the cooked
index case). */
void **slot;
sect_offset sect_off = (sect_offset) (info_ptr - section.buffer);
- dwarf2_per_cu_data per_cu (per_bfd, sect_off);
+ dwarf2_per_cu_data per_cu (per_bfd, §ion, sect_off);
per_cu.is_debug_types = 0;
- per_cu.section = §ion;
cutu_reader reader (&per_cu, per_objfile, cu, &dwo_file);
if (!reader.dummy_p)
const auto create_dummy_per_cu = [] ()
{
return (dwarf2_per_cu_data_up
- (new dwarf2_per_cu_data (nullptr,sect_offset {})));
+ (new dwarf2_per_cu_data (nullptr, nullptr, sect_offset {})));
};
dwarf2_per_cu_data_up one = create_dummy_per_cu ();
struct dwarf2_per_cu_data
{
- dwarf2_per_cu_data (dwarf2_per_bfd *per_bfd, sect_offset sect_off)
+ dwarf2_per_cu_data (dwarf2_per_bfd *per_bfd, dwarf2_section_info *section,
+ sect_offset sect_off)
: sect_off (sect_off),
is_debug_types (false),
is_dwz (false),
mark (false),
files_read (false),
scanned (false),
+ section (section),
per_bfd (per_bfd)
{
}
struct signatured_type : public dwarf2_per_cu_data
{
- signatured_type (dwarf2_per_bfd *per_bfd, sect_offset sect_off,
- ULONGEST signature)
- : dwarf2_per_cu_data (per_bfd, sect_off),
+ signatured_type (dwarf2_per_bfd *per_bfd, dwarf2_section_info *section,
+ sect_offset sect_off, ULONGEST signature)
+ : dwarf2_per_cu_data (per_bfd, section, sect_off),
signature (signature)
{}
/* A convenience function to allocate a dwarf2_per_cu_data. The
returned object has its "index" field set properly. The object
is allocated on the dwarf2_per_bfd obstack. */
- dwarf2_per_cu_data_up allocate_per_cu (sect_offset sect_off);
+ dwarf2_per_cu_data_up allocate_per_cu (dwarf2_section_info *section,
+ sect_offset sect_off);
/* A convenience function to allocate a signatured_type. The
returned object has its "index" field set properly. The object
is allocated on the dwarf2_per_bfd obstack. */
- signatured_type_up allocate_signatured_type (sect_offset sect_off,
+ signatured_type_up allocate_signatured_type (dwarf2_section_info *section,
+ sect_offset sect_off,
ULONGEST signature);
/* Map all the DWARF section data needed when scanning