This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/2] Fix BZ 25065 - Ensure that physnames are computed for inherited DIEs
On 2019-10-16 11:54 p.m., Simon Marchi wrote:
> I think that what's confusing in all this is the fact that the method_info list is
> currently attached to a particular CU. Instead, I think it should be attached to the
> operation of processing of a CU, and used to collect all delayed method infos while
> processing that CU, even if some of these infos come from inherited DIEs from another
> CU. Concretely, it would mean to have a local instance of
> std::vector<delayed_method_info> in process_full_comp_unit/process_full_type_unit and to
> pass it by pointer/reference through the call stack to any code who might want to append
> to it. We wouldn't have to do anything special in inherit_abstract_dies, just pass this
> reference to the list down the stack. I don't know how feasible it would be in practice
> to do that change, maybe it's too much work or would end up ugly. I'll give it a try.
> But your patch gives essentially the same result, and works with what we have today.
A little follow up to the above.
I prototyped that change here in a WIP patch (so, not intended to be reviewed):
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/128
I got no regression in gdb.dwarf2. However, it's a bit invasive. If we want to pass other
objects in the same fashion, it will quickly become very heavy.
What we could do though, is to introduce a new type (e.g. struct dwarf2_cu_processing_context)
and pass that around instead. Its lifetime would be the duration of process_full_comp_unit /
process_full_type_unit, just like std::vector in the patch above, but could contain many fields.
I found something potentially problematic though (applies to both your and my patch). When we process
the delayed_method_info objects in compute_delayed_physnames, we call:
dwarf2_physname (mi.name, mi.die, cu);
mi.die could be a die coming from X's CU (to keep the example from my previous message), but the
cu in the call above is A's CU (the CU we are processing). I am pretty sure that this function
(and what it calls) expect the passed DIE to come from the passed CU. If they don't match, I guess
we could have some bad surprises.
Simon