From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 8E07C385840E for ; Mon, 22 Nov 2021 20:53:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8E07C385840E 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-out1.suse.de (Postfix) with ESMTPS id C9407218B0; Mon, 22 Nov 2021 20:52:59 +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 B26BF13B7E; Mon, 22 Nov 2021 20:52:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Up5XKisDnGFGGgAAMHmgww (envelope-from ); Mon, 22 Nov 2021 20:52:59 +0000 Subject: Re: [PATCH v2 00/32] Rewrite the DWARF "partial" reader To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20211104180907.2360627-1-tom@tromey.com> <4a288a6a-63c4-e36e-da20-01ae3fd0955c@suse.de> <87a6i31woz.fsf@tromey.com> <87mtlwx8p6.fsf@tromey.com> From: Tom de Vries Message-ID: <2e54aac8-8f1a-e9ac-9530-c5770ff9a379@suse.de> Date: Mon, 22 Nov 2021 21:52:59 +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: <87mtlwx8p6.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.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: Mon, 22 Nov 2021 20:53:02 -0000 On 11/22/21 8:59 PM, Tom Tromey wrote: > Tom> I'll send v3 of the series once I do some more testing... I plan to > Tom> regression test with a few different approaches (dwz, probably > Tom> split DWARF too). > > I think the branch is regression free in the normal case and when using > the cc-with-dwz-m board. > > I also tried the fission-dwp board, and I have a single regression. I'm > inclined to ignore this one, but I figured I'd describe it first in case > anyone wants to lobby for it to be fixed. > > First, the regression only affects one Ada test case, dgopt.exp, and > only when using fission-dwp. In this scenario, the executable has a > stub CU that looks like: > > <0><3f>: Abbrev Number: 1 (DW_TAG_compile_unit) > [...] > <50> DW_AT_stmt_list : 0x24d > [...] > <58> DW_AT_comp_dir : (indirect string, offset: 0x0): /home/tromey/gdb/build/gdb/testsuite/outputs/gdb.ada/dgopt > > Note there is no DW_AT_name. > > The corresponding .dwo file says: > > <0>: Abbrev Number: 1 (DW_TAG_compile_unit) > [...] > DW_AT_name : (indexed string: 0x1): /home/tromey/gdb/binutils-gdb/gdb/testsuite/gdb.ada/dgopt/x.adb > DW_AT_comp_dir : (indexed string: 0x2): /home/tromey/gdb/build/gdb/testsuite/outputs/gdb.ada/dgopt > > That is, this has the correct file name in DW_AT_name. This is why the > psymtab reader works -- the psymtab reader uses the line table, but also > uses this name for file name matches. > > The line table does not mention x.adb, but instead: > > The File Name Table (offset 0x26a): > Entry Dir Time Size Name > 1 0 0 0 x.adb.dg > > That is, the file name table here holds the name of a file that's > generated by the Ada compiler when run in a special mode. > > So, my inclination is to say that this is probably a compiler bug, or in > any case an obscure oddity that gdb shouldn't bother with. To my > knowledge, there aren't Ada users who also use Fission anyway. > I've looked at the readelf -w output for native, and I see the same, that is, a CU with: ... <14e2> DW_AT_name : /home/vries/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/dgopt/x.adb ... and a .debug_line entry with: ... The File Name Table (offset 0x361): Entry Dir Time Size Name 1 0 0 0 x.adb.dg ... At the gnat docs we find: ... -gnatD[=nn] ... The debugging information generated by the gcc -g switch will refer to the generated xxx.dg file. ... So, I'm inclined to say that it's a compiler bug that we have "DW_AT_name x.adb" rather than "DW_AT_name x.adb.dg". I'd file a gcc PR for this. Only, it's a compiler bug that the compiler doesn't stick to its own spec, but AFAIU this is valid DWARF. I tried a two-file test-case: ... $ cat test.c #include "test2.c" $ cat test2.c int main (void) { return 0; } $ gcc -g test.c ... and got the same structure. FWIW, it could be interesting to create a similar test-case with these sources and see if the same problem pops up for your branch with fission-dwp. Thanks, - Tom > I do think this could be fixed. It would require maybe storing a > file_and_directory in the dwarf2_per_cu_data. So if you think this is > important, I'd probably refactor to take this approach. > > TBH I had expected this scenario to make a .gdb_index -- that's what > fission-dwp is supposed to do, I think, via gold -- but this didn't > happen. So possibly this is another oddity in the Ada toolchain, or > maybe the gdb test suite. I'm not certain. > > Tom >