[PATCH v2 00/32] Rewrite the DWARF "partial" reader

Tom de Vries tdevries@suse.de
Sat Nov 6 12:25:10 GMT 2021


On 11/4/21 7:08 PM, Tom Tromey wrote:
> Here is v2 of my series to rewrit the DWARF partial symbol reader.
> 
> You can find v1 here:
> 
>     https://sourceware.org/pipermail/gdb-patches/2021-August/181624.html
> 
> This update addresses all the review comments.  I believe it fixes all
> the problems that Tom de Vries found.
> 
> I regression tested this on x86-64 Fedora 34.
> 

I regression tested this on openSUSE Leap 15.2 x86_64 and got only known
FAILs:
...
FAIL: gdb.base/step-over-syscall.exp: clone: displaced=off: single step
over clone (timeout)
FAIL: gdb.cp/no-dmgl-verbose.exp: setting breakpoint at 'f(std::string)'
FAIL: gdb.go/package.exp: setting breakpoint at package2.Foo
FAIL: gdb.go/package.exp: going to first breakpoint (the program exited)
...

So that looks great :)

Then I tried an experiment with parsing all .debug files installed on
the system which happens to be 636 files, totaling at 4.8 GB.

More concretely, I ran this command in a file loop:
...
$ for f in $(find /usr/lib/debug/ -name "*.debug" | grep -v build-id);
do echo "Loading $f"; gdb -q -batch $f; done 2>&1 | tee LOG
...

My idea was to compare execution times, but instead I ran into some
trouble (while using master instead, everything worked fine).

This triggered a fair amount of times:
...
$ grep -c "has duplicate debug_info_offset 0x0, ignoring .debug_aranges" LOG
40
...
as well as:
...
$ grep -c "DW_FORM_GNU_strp_alt used without .debug_str" LOG
16
...

I managed to reproduce both with a hello world, like so:
...
$ cat ./hello.c
#include <stdio.h>

int
main (void)
{
  printf
("hello00000000000000000000000000000000000000000000000000000000000000000000\n");
  return 0;
}
$ gcc ./hello.c -g
$ cp a.out b.out
$ dwz -m c.out a.out b.out
$ gdb -q -batch a.out

warning: Section .debug_aranges in /home/vries/gdb_versions/devel/a.out
has duplicate debug_info_offset 0x0, ignoring .debug_aranges.
DW_FORM_GNU_strp_alt used without .debug_str section [in module
/home/vries/gdb_versions/devel/c.out]
...

The latter may or may not trigger, and disappears with "maint set
worker-thread 0".

The exec seems sane.

The .debug_aranges section does not have duplicates, and does not
contain a .debug_info offset 0x0:
...
$ readelf -wr a.out | egrep "debug_aranges|Offset into"
Contents of the .debug_aranges section:
  Offset into .debug_info:  0x1f
  Offset into .debug_info:  0x4d
  Offset into .debug_info:  0x87
  Offset into .debug_info:  0xa9
  Offset into .debug_info:  0xf5
  Offset into .debug_info:  0x1ce
...

The a.out indeed doesn't have a .debug_str, but the .gnu_debuglink file
c.out does:
...
$ readelf -S -W a.out | grep debug_str
$
$ readelf -S -W c.out | grep debug_str
  [ 5] .debug_str        PROGBITS        0000000000000000 0005a1 0005fe
01  MS  0   0  1
$
...

I managed to reproduce both problems using system compiler gcc 7.5.0 and
gcc 11.2.1. [ If you have trouble reproducing this, maybe the target
boards cc-with-dwz and cc-with-dwz-m will help. ]

Thanks,
- Tom

> Let me know what you think.
> 
> Tom
> 
> 


More information about the Gdb-patches mailing list