Re: [RFA 5/6] Remove objfile argument from add_dyn_prop

Yao Qi
2018-01-16T16:00:55Z

On Wed, Jan 10, 2018 at 4:32 PM, Tom Tromey <tom@tromey.com> wrote:
>>>>>> "Yao" == Yao Qi <qiyaoltc@gmail.com> writes:
>
> Yao> Tom Tromey <tom@tromey.com> writes:
>>> @@ -25116,7 +25116,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
>>> if (attr_form_is_block (attr))
>>> {
>>> if (attr_to_dynamic_prop (attr, die, cu, &prop))
>>> - add_dyn_prop (DYN_PROP_ALLOCATED, prop, type, objfile);
>>> + add_dyn_prop (DYN_PROP_ALLOCATED, prop, type);
>>> }
>
> Yao> Before the patch, the objfile is
> Yao> cu-> per_cu->dwarf2_per_objfile->objfile, but after the patch, the
> Yao> objfile is TYPE_OBJFILE (type), are they equivalent?
>
> If they were not the same, then that was already a bug, because
> types generally have the restriction that they can only point to static
> data or to other objects allocated on the same objfile. Cross-objfile
> pointers are not allowed, to avoid dangling pointers when an objfile is
> destroyed.
>
> Now, a given invocation of the DWARF reader generally deals with a
> single objfile. So I believe they were the same. But if they were not,
> then this patch actually improves the situation.
>

OK, patch is good to me then.

--
Yao (齐尧)