From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gztDCk4JoWE0MgAAWB0awg (envelope-from ) for ; Fri, 26 Nov 2021 11:20:30 -0500 Received: by simark.ca (Postfix, from userid 112) id 192B81F0CD; Fri, 26 Nov 2021 11:20:30 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.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 89A201F0CD for ; Fri, 26 Nov 2021 11:20:29 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0B32D3857C6D for ; Fri, 26 Nov 2021 16:20:29 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 5678B3858D39 for ; Fri, 26 Nov 2021 16:20:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5678B3858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [172.16.0.95] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 5E47C1EDF0; Fri, 26 Nov 2021 11:20:17 -0500 (EST) Subject: Re: [PATCH] [gdb/testsuite] Add gdb.base/include-main.exp To: Tom de Vries , gdb-patches@sourceware.org References: <20211126094852.32283-1-tdevries@suse.de> From: Simon Marchi Message-ID: Date: Fri, 26 Nov 2021 11:20:16 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211126094852.32283-1-tdevries@suse.de> Content-Type: text/plain; charset=utf-8 Content-Language: tl 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: , Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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 we name it something like "include-main-includee.c", without affecting the intent of the test? Simon