Re: [PATCH v2] gdb/dwarf: dump cooked index contents in cooked_index_functions::dump

Tom Tromey
2023-01-31T14:46:54Z

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> See the patch below for a quick prototype.
Simon> quick_symbol_functions::read_partial_symbols now returns a bool, and if
Simon> it returns false (failure), objfile::require_partial_symbols removes
Simon> that quick symbol instance from the qf list.

I'm working to get rid of this lazy symbol stuff. So I'd rather not add
another meaning to it. You can see the WIP on t/bg-dwarf-reading, but
the basic idea is that instead of delaying the reading of DWARF, start
the reading early and just delay the completion of it. I haven't sent
this yet because it currently crashes, I think it will benefit from
being rebased on the write-index-in-background patch.

All the other methods in cooked_index_functions already do:

dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
if (per_objfile->per_bfd->index_table == nullptr)
return;

So maybe this would be an ok choice for dump.

As an aside the code is doing:

if (per_bfd->index_table == nullptr)
return nullptr;
cooked_index_vector *table
= (gdb::checked_static_cast<cooked_index_vector *>
(per_bfd->index_table.get ()));

It seems to me that it would be fine if checked_static_cast passed
through null in this case -- that is, do not assert when the result is
null if the parameter is also null.

Tom