On 1/25/21 7:12 PM, Simon Marchi wrote: > > > 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. > That will probably need investigation. Let's first check if I applied the corrrect test case, see attached patch.txt. tried to do "readelf --debug-dump rnglists-sec-offset-dw32" and "readelf --debug-dump rnglists-sec-offset-dw64" I used GNU readelf (GNU Binutils) 2.35.1 I see a warning: readelf: Warnung: The .debug_rnglists section contains unsupported offset entry count: 2. what does that mean? Doesn't that indicate that the debug-info somehow wrong? > 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. > It happens pretty reliably when you have a function that contains an error handling that looks obvously "unlinkely" to the compiler, because it is guarded by an if-condition and calls abort(), while there are also code paths that don't call about. The parts that call abort are then in a separate cold section. Bernd.