[PATCH] gdb: reset/recompute objfile section offsets in reread_symbols

Tom Tromey tom@tromey.com
Wed May 20 19:36:12 GMT 2020


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

Simon> This patch fixes this by making reread_symbols clear the
Simon> `section_offsets` vector, and re-create it by calling `sym_offsets`.
Simon> This is analogous to what syms_from_objfile_1 does.  I didn't seem
Simon> absolutely necessary, but I also made it clear the various
Simon> `sect_index_*` fields, since their values no longer make sense (they
Simon> describe the old executable, and are indices in the now cleared
Simon> sections/section_offsets arrays).

This makes sense to me.

Simon> I don't really like the approach taken by reread_symbols, trying to
Simon> reset everything manually on the objfile object, instead of, for
Simon> example, creating a new one from scratch.

A long time ago, Jan had a patch to do exactly this.
I couldn't easily find it; there was some opposition to it at the time,
but I still think it's a better approach.

thanks,
Tom


More information about the Gdb-patches mailing list