std::vector<const addrmap *> addrmaps = this->get_addrmaps ();
for (i = 0; i < addrmaps.size (); ++i)
{
- const addrmap &addrmap = *addrmaps[i];
+ const addrmap *addrmap = addrmaps[i];
- gdb_printf (" [%zu] ((addrmap *) %p)\n", i, &addrmap);
+ gdb_printf (" [%zu] ((addrmap *) %p)\n", i, addrmap);
gdb_printf ("\n");
- addrmap.foreach ([arch] (CORE_ADDR start_addr, const void *obj)
+ if (addrmap == nullptr)
+ continue;
+
+ addrmap->foreach ([arch] (CORE_ADDR start_addr, const void *obj)
{
QUIT;
found. */
dwarf2_per_cu_data *lookup (unrelocated_addr addr)
{
+ if (m_addrmap == nullptr)
+ return nullptr;
+
return (static_cast<dwarf2_per_cu_data *>
(m_addrmap->find ((CORE_ADDR) addr)));
}
dwarf2_per_cu_data *lookup (unrelocated_addr addr) override;
/* Return a new vector of all the addrmaps used by all the indexes
- held by this object. */
+ held by this object.
+
+ Elements of the vector may be nullptr. */
std::vector<const addrmap *> get_addrmaps ();
/* Return the entry that is believed to represent the program's
/* Dump the address map. */
data_buf addr_vec;
for (auto map : table->get_addrmaps ())
- write_address_map (map, addr_vec, cu_index_htab);
+ if (map != nullptr)
+ write_address_map (map, addr_vec, cu_index_htab);
/* Ensure symbol hash is built domestically. */
symtab.sort ();