From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YEyEHz8VoWEXNAAAWB0awg (envelope-from ) for ; Fri, 26 Nov 2021 12:11:27 -0500 Received: by simark.ca (Postfix, from userid 112) id 7ECC11F0CE; Fri, 26 Nov 2021 12:11:27 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D77571E940 for ; Fri, 26 Nov 2021 12:11:26 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4F2333857C4E for ; Fri, 26 Nov 2021 17:11:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F2333857C4E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1637946686; bh=1uQ+X3263HqONv/Oi4s6VJI3sciv+hZFXqFW1pufgSk=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ENxPgd+JghXY61sZ7oPpX0W6U65Uu6ahLQ07xMXNZE0K7NXdd3hlTWn/VF/NJlGqF 6SLPCa1SoqH5RuEnUfXBYWxxbYB7pVzIiJUAsDBHNdaQLYJXiXnbNOEiT75QTpknw4 oke1/5s9Ow3X/sXT6fKsm/EuFvF8u0Y9EWEP4G4I= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id A31AD3858D39 for ; Fri, 26 Nov 2021 17:11:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A31AD3858D39 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 AC95F1FC9E; Fri, 26 Nov 2021 17:11:06 +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 86C8A13491; Fri, 26 Nov 2021 17:11:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6I7iHioVoWGCFgAAMHmgww (envelope-from ); Fri, 26 Nov 2021 17:11:06 +0000 Subject: Re: [PATCH] [gdb/testsuite] Add gdb.base/include-main.exp To: Simon Marchi , gdb-patches@sourceware.org References: <20211126094852.32283-1-tdevries@suse.de> Message-ID: <1e731166-3636-e537-b063-d4b1deb92645@suse.de> Date: Fri, 26 Nov 2021 18:11:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 11/26/21 5:20 PM, Simon Marchi wrote: > On 2021-11-26 4:48 a.m., Tom de Vries via Gdb-patches wrote: >> The test-case gdb.ada/dgopt.exp uses the -gnatD switch, in combination with >> -gnatG. >> >> This causes the source file $src/gdb/testsuite/gdb.ada/dgopt/x.adb to be >> expanded into $build/gdb/testsuite/outputs/gdb.ada/dgopt/x.adb.dg, and the >> debug information should refer to the x.adb.dg file. >> >> That is the case for the .debug_line part: >> ... >> The Directory Table is empty. >> >> The File Name Table (offset 0x1c): >> Entry Dir Time Size Name >> 1 0 0 0 x.adb.dg >> ... >> but not for the .debug_info part: >> ... >> <11> DW_AT_name : $src/gdb/testsuite/gdb.ada/dgopt/x.adb >> <15> DW_AT_comp_dir : $build/gdb/testsuite/outputs/gdb.ada/dgopt >> ... >> >> Filed as PR gcc/103436. >> >> In C we can generate similar debug information, using a source file that does >> not contain any code, but includes another one that does: >> ... >> $ cat gdb/testsuite/gdb.base/include-main.c >> #include "main.c" >> ... >> such that in the .debug_line part we have: >> ... >> The Directory Table (offset 0x1c): >> 1 /home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base >> >> The File Name Table (offset 0x57): >> Entry Dir Time Size Name >> 1 1 0 0 main.c >> ... >> and in the .debug_info part: >> ... >> <11> DW_AT_name : $src/gdb/testsuite/gdb.base/include-main.c >> <15> DW_AT_comp_dir : $build/gdb/testsuite >> ... >> >> Add a C test-case that mimics gdb.ada/dgopt.exp, that is: >> - generate debug info as described above, >> - issue a list of a line in include-main.c, while the corresponding >> CU is not expanded yet. >> >> Tested on x86_64-linux. >> --- >> gdb/testsuite/gdb.base/include-main.c | 18 ++++++++++ >> gdb/testsuite/gdb.base/include-main.exp | 47 +++++++++++++++++++++++++ >> gdb/testsuite/gdb.base/main.c | 22 ++++++++++++ > > I'm not a fan of having a file with the generic name "main.c" there. Could you explain why not? I don't understand why we'd need to duplicate a file that can easily be reused. It even helps one to recognize quickly (once you known the contents of the file) that the test-case that is being investigated does not require a specific executable, just based on the fact it uses "main.c". Thanks, - Tom > Could we name it something like "include-main-includee.c", without > affecting the intent of the test? > > Simon >