Re: [PATCH v2 41/42] Make mapped_debug_names independent of objfile

Simon Marchi
2020-05-25T19:53:20Z

On 2020-05-22 5:01 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Simon> Ultimately, the objfile only seems to be needed because we might need to
> Simon> read a string from the string section. For that, we might need to read
> Simon> in the section, and if it's a relocatable section, the objfile is needed
> Simon> in order to do the relocation. This pattern happens often (that we to
> Simon> pass an objfile only because a section might be read). I think it's a
> Simon> bit ugly, but I don't have a good alternative right now.
>
> A long time ago, I changed the DWARF reader to read all the sections
> lazily. Off and on I've wondered whether that was actually a mistake.
> For one thing, it requires passing stuff like this around. Also, it can
> slow down hot paths, since they need to call the method to make sure the
> section is mapped. There's also at least one bug in bugzilla related to
> this (if you unlink a .so, gdb can be unhappy).
>
> For my threading project, I removed this lazy reading. We should
> consider doing this sooner, perhaps. The idea here is just that, if gdb
> is going to read the debuginfo anyway, then loading at least the
> sections needed to read .debug_info makes sense.

I think it would be interesting indeed. Can we try to revive it after the
current patchset is merged?

Simon