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

Tom Tromey
2018-01-10T16:32:07Z

>>>>> "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.

Tom