From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 01C3A3858408 for ; Thu, 11 Nov 2021 12:23:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 01C3A3858408 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 35E2D1FD56; Thu, 11 Nov 2021 12:23:16 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0B70D13D8F; Thu, 11 Nov 2021 12:23:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cQCBATQLjWHZcQAAMHmgww (envelope-from ); Thu, 11 Nov 2021 12:23:16 +0000 Subject: Re: [PATCH v2 00/32] Rewrite the DWARF "partial" reader To: Tom Tromey , gdb-patches@sourceware.org References: <20211104180907.2360627-1-tom@tromey.com> <4a288a6a-63c4-e36e-da20-01ae3fd0955c@suse.de> From: Tom de Vries Message-ID: <2b4549c1-0e6a-eb9f-ade4-99b4c145b245@suse.de> Date: Thu, 11 Nov 2021 13:23:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <4a288a6a-63c4-e36e-da20-01ae3fd0955c@suse.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Nov 2021 12:23:19 -0000 On 11/6/21 1:25 PM, Tom de Vries via Gdb-patches wrote: > 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 > > 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] > ... > OK, I see now what is going wrong. The compilation unit offsets are: ... $ readelf --dwarf-depth 0 -wi ./a.out | grep @ Compilation Unit @ offset 0x0: Compilation Unit @ offset 0x1f: Compilation Unit @ offset 0x4d: Compilation Unit @ offset 0x87: Compilation Unit @ offset 0xa9: Compilation Unit @ offset 0xf5: Compilation Unit @ offset 0x1ce: $ readelf --dwarf-depth 0 -wi ./c.out | grep @ Compilation Unit @ offset 0x0: Compilation Unit @ offset 0x38: Compilation Unit @ offset 0x5e: Compilation Unit @ offset 0x2aa: Compilation Unit @ offset 0x330: ... and at the moment of the warning we have: ... (gdb) p (*per_bfd->all_comp_units[0])->sect_off $42 = 0 (gdb) p (*per_bfd->all_comp_units[1])->sect_off $43 = (unknown: 0x1f) (gdb) p (*per_bfd->all_comp_units[7])->sect_off $44 = 0 (gdb) p (*per_bfd->all_comp_units[8])->sect_off $45 = (unknown: 0x38) ... So, the CUs of a.out and c.out end up in the same vector, and that triggers the duplicate offset warning. Thanks, - Tom