[PATCH][gdb/symtab] Handle DW_AT_ranges with DW_FORM_sec_off in partial DIE
Simon Marchi
simon.marchi@polymtl.ca
Mon Jan 25 18:12:06 GMT 2021
On 2021-01-25 12:42 p.m., Bernd Edlinger wrote:
> On 1/25/21 5:36 PM, Simon Marchi wrote:
>>> Yes, unfortunately I have not any experience with writing such assembly
>>> tests, but I am always impressed when one of you does it though :-)
>>>
>>> Nevertheless, the test case seems to be stable from gcc-4.8 .. gcc-11,
>>> that it fails without the patch and passes with the patch.
>>>
>>> So is it okay to push my partial symbols test as-is?
>>
>> My patch here adds a test that uses DW_FORM_sec_offset to point
>> to a .debug_rnglists (DWARF5) section. Maybe that's sufficient,
>> but if not I could probably do a DWARF4 equivalent.
>>
>> https://sourceware.org/pipermail/gdb-patches/2021-January/175229.html
>>
>
> Yeah, the hardest part on a one-line change like this is always the test case.
>
> So, I tried this patch on current trunk, but it fails:
>
> Running /home/ed/gnu/gdb-build-1/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.dwarf2/rnglists-multiple-cus.exp ...
> ERROR: Couldn't load rnglists-multiple-cus-dw32 into GDB (GDB internal error).
> ERROR: Couldn't load rnglists-multiple-cus-dw64 into GDB (GDB internal error).
> Running /home/ed/gnu/gdb-build-1/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.dwarf2/rnglists-sec-offset.exp ...
> FAIL: gdb.dwarf2/rnglists-sec-offset.exp: is_64=false: p/x &foo
> FAIL: gdb.dwarf2/rnglists-sec-offset.exp: is_64=true: p/x &foo
>
> This probably means that your test tests more than this single-line change alone?
Hmm, with current master (so with Tom's patch merged),
gdb.dwarf2/rnglists-sec-offset.exp passes for me.
But gdb.dwarf2/rnglists-multiple-cus.exp is expected to fail if you don't
have the other patches in my series.
> I always thought that the partial symbols are replaced by the
> full symbols as soon as the first item from the CU is accessed, say "main".
> Can you explain how that can be?
> I was never able to get a reproducer for partial symbols with only one CU.
The bug fixed by this patch triggers as soon as you have a function
(DW_TAG_subprogram) with a DW_AT_ranges, I don't think it matters whether
there is one or more CUs. But perhaps it's difficult to force the compiler
to emit a function with DW_AT_ranges (so, with a non-contiguous range) when
using a single CU.
Simon
More information about the Gdb-patches
mailing list