Re: [PATCH 01/13] gdb/dwarf: change read_loclist_index complaints into errors

Tom Tromey
2021-02-25T19:20:33Z

>> If this is the case, then considering the difference in usage between
>> the two, having a wrong loclist information can still provide a
>> correct line table information, but having a wrong rnglist
>> information in my mind creates a more serious issue.

>> On the other hand, how much can one trust in the information
>> correctness if either of those are wrong.

Simon> Indeed, `error` throws an exception that gets handled... I don't know
Simon> where. If you are reading partial symtabs, it probably goes up to
Simon> dwarf2_build_psymtabs, so it stops the processing for the whole object
Simon> file.

FWIW there is at least one bug open about this behavior.

It's not completely clear what would be best. One idea I consider
sometimes is to throw out just the known-bad CU, but try to read the
remaining ones. This might not be too difficult to implement.

Simon> I think it's correct from the read_rnglists_index and read_loclist_index
Simon> functions point of view to throw if they encounter invalid data and
Simon> can't return something meaningful. If we want to make error handling a
Simon> bit more granular, we could catch the error in the caller
Simon> (read_attribute_reprocess), make it display a complaint, and continue as
Simon> if the attribute wasn't present.

Things like this could be considered on a case-by-case basis as well.

Simon> However, I don't intend to do this at the moment, because it would be
Simon> quite a lot of work to do and test properly, in the end to accomodate an
Simon> hypothetical buggy compiler. Maybe if/when we have a concrete instance
Simon> of a widely available compiler producing such buggy debug info, we can
Simon> revisit this idea.

For the plan of just rejecting an individual bad CU, the problem isn't
so much consistently bad compilers as that, when one does trip across
bad DWARF, it makes the entire result unusable -- even if the bug is
localized somehow.

Tom