Re: [PATCH v2 28/42] Remove dwarf2_per_cu_data::objfile ()

Tom de Vries
2020-05-27T21:08:39Z

On 27-05-2020 22:03, Simon Marchi wrote:
> On 2020-05-27 12:27 p.m., Tom de Vries wrote:
>> On 12-05-2020 23:12, Simon Marchi via Gdb-patches wrote:
>>> @@ -724,10 +721,13 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
>>> caller_frame = get_prev_frame (frame);
>>>
>>> parameter = dwarf_expr_reg_to_entry_parameter (frame, kind, kind_u,
>>> - &caller_per_cu);
>>> + &caller_per_cu,
>>> + &caller_per_objfile);
>>> data_src = deref_size == -1 ? parameter->value : parameter->data_value;
>>> size = deref_size == -1 ? parameter->value_size : parameter->data_value_size;
>>>
>>> + gdb_assert (this->per_objfile == caller_per_objfile);
>>> +
>>
>> Hi,
>>
>> I'm running into this assert here:
>> ...
>> (gdb) PASS: gdb.base/catch-load.exp: plain load: catch load
>> continue^M
>> Continuing.^M
>> ^M
>> Catchpoint 3^M
>> Inferior loaded
>> /data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.base/catch-load/catch-load-so.so^M
>> dl_open_worker (/data/gdb_versions/devel/src/gdb/dwarf2/loc.c:729:
>> internal-error: virtual void
>> dwarf_evaluate_loc_desc::push_dwarf_reg_entry_value(call_site_parameter_kind,
>> call_site_parameter_u, int): Assertion `this->per_objfile ==
>> caller_per_objfile' failed.^M
>> A problem internal to GDB has been detected,^M
>> further debugging may prove unreliable.^M
>> Quit this debugging session? (y or n) FAIL: gdb.base/catch-load.exp:
>> plain load: continue (GDB internal error)
>
> I don't see this failure. Is it with a particular board file? Or maybe
> gcc-version specific?
>

No, this is with native, and reproduced with gcc 7.5.0, gcc 4.8.5, gcc
10.1.1 and clang 5.0.2.

> It looks related to what we have discussed here:
>
> https://sourceware.org/pipermail/gdb-patches/2020-May/168906.html
>
> I think the fix would be to temporarily override this->per_objfile to be
> caller_per_objfile (with a scoped_restore). But I'd like to be able to
> reproduce it to understand what's happening.

I think maybe installing debug info for glibc and building with
--with-separate-debug-dir=/usr/lib/debug may do the trick.

Thanks,
- Tom