DISABLE_COPY_AND_ASSIGN (cooked_index);
/* Start reading the DWARF. */
- void start_reading ();
+ void start_reading () override;
/* Called by cooked_index_worker to set the contents of this index
and transition to the MAIN_AVAILABLE state. WARN is used to
virtual ~dwarf_scanner_base () = default;
DISABLE_COPY_AND_ASSIGN (dwarf_scanner_base);
+ /* Start the reading. This is only really relevant to the cooked
+ index; see cooked-index.h. */
+ virtual void start_reading ()
+ { }
+
/* Return a quick_symbol_functions instance that refers back to this
dwarf_scanner_base. */
virtual quick_symbol_functions_up make_quick_functions () const = 0;
map.shard = std::make_unique<cooked_index_shard> ();
map.shard->install_addrmap (&addrmap);
- cooked_index *idx
- = new debug_names_index (per_objfile,
- (std::make_unique<cooked_index_debug_names>
- (per_objfile, std::move (map))));
- per_bfd->index_table.reset (idx);
-
- idx->start_reading ();
+ auto cidn = (std::make_unique<cooked_index_debug_names>
+ (per_objfile, std::move (map)));
+ auto idx = std::make_unique<debug_names_index> (per_objfile,
+ std::move (cidn));
+ per_bfd->start_reading (std::move (idx));
return true;
}
section.read (objfile);
}
+/* See dwarf2/read.h. */
+
+void
+dwarf2_per_bfd::start_reading (std::unique_ptr<dwarf_scanner_base> new_table)
+{
+ gdb_assert (index_table == nullptr);
+ index_table = std::move (new_table);
+ index_table->start_reading ();
+}
+
\f
/* DWARF quick_symbol_functions support. */
scanning; and then start the scanning. */
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
std::unique_ptr<cooked_index_worker> worker
- (new cooked_index_debug_info (per_objfile));
- cooked_index *idx = new cooked_index (per_objfile, std::move (worker));
- per_bfd->index_table.reset (idx);
- /* Don't start reading until after 'index_table' is set. This
- avoids races. */
- idx->start_reading ();
+ = std::make_unique<cooked_index_debug_info> (per_objfile);
+ per_bfd->start_reading (std::make_unique<cooked_index> (per_objfile,
+ std::move (worker)));
}
\f
.debug_info. */
void map_info_sections (struct objfile *objfile);
+ /* Set the 'index_table' member and then call start_reading on
+ it. */
+ void start_reading (std::unique_ptr<dwarf_scanner_base> new_table);
+
private:
/* This function is mapped across the sections and remembers the
offset and size of each of the debugging sections we are