From patchwork Thu Nov 17 11:38:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 60746 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7C7373986412 for ; Thu, 17 Nov 2022 11:38:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C7373986412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668685118; bh=qgVPwkQw/xd16cGH4Sk1q93tt19tkxbzHqSid6A7ano=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=O/LMNSZ9q6ioCI714ZGGgZJbnfk3XTmBu43EnA1noMLrXTNaYsBel9pqQdoSEn++2 ndridLtHNdNJ4pKPxC+ZHvW73cahxQdE7zD+YI7u/ovg+dDTAYbHe4EwDFV+Z94ak8 HcP+2760y8VlT2hr5YCDfeFbLBlgUyIJ/y+hfpJ8= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 0DC2F398243F for ; Thu, 17 Nov 2022 11:38:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0DC2F398243F Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-413-HIqwxjWzMWeOWzwcNJzCIw-1; Thu, 17 Nov 2022 06:38:12 -0500 X-MC-Unique: HIqwxjWzMWeOWzwcNJzCIw-1 Received: by mail-wm1-f71.google.com with SMTP id v188-20020a1cacc5000000b003cf76c4ae66so2664722wme.7 for ; Thu, 17 Nov 2022 03:38:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qgVPwkQw/xd16cGH4Sk1q93tt19tkxbzHqSid6A7ano=; b=C++WGWZKsGnS97rx2SpaIIM7JFq8SpXO/f7Uuf4oN4u8J829W6Y587oMqdtnUT4Wry JkDFI0h456YUfgo/MzWxhbMp3ULs/ujwUjiGzQosuSZLnuCmmMczFOlCwGBKacrGj0q4 FPu+LySE0E5Dw9bvmg5nFY8cgPhZc0xBUWFljRP7PZ2hxGZr1ZIDFqtdMpp8ZBKP9ARK RtGLIwKB6vQLd2otp/SNuKcK0h5/67YAjiNjP7+0elTwlJn/o+DU0GYQJRqmFD5gGtkb Vo6u4YR68XiBysfwoak0jfYx87u2/ay+wVLMaZPww7fgMavnrtpTkcsIEwpVm8TxoLpD 8m1Q== X-Gm-Message-State: ANoB5pkkZ5/Y3FQOdTaY26xGYPhic1Z+7szN04xxpQHh2FosE6Se/LpG JaMv2RNb02vwdhr7/FTktKiIGlgylBl9VDd0QIVnV21ygIye8z1ELlQa58SqWWogisb+V/FCejg wBazO/nvUhybH/B6L1/TqTH90SVp8tOfbSn/pGiXjqmPcSAtUQ+KhuOWuy/EDqtpGLBWdAEBQ+w == X-Received: by 2002:a05:6000:1105:b0:22e:3498:9adb with SMTP id z5-20020a056000110500b0022e34989adbmr1292875wrw.335.1668685091373; Thu, 17 Nov 2022 03:38:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf70dy7Ui3iORHRT9MdjYyO1CDnL0uhQD0SYy0i6htogkIE3C1ltD+Bgc2JNwQ0hlC878PDqxg== X-Received: by 2002:a05:6000:1105:b0:22e:3498:9adb with SMTP id z5-20020a056000110500b0022e34989adbmr1292867wrw.335.1668685091176; Thu, 17 Nov 2022 03:38:11 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id n9-20020a05600c3b8900b003c6bbe910fdsm7173402wms.9.2022.11.17.03.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 03:38:10 -0800 (PST) To: gdb-patches@sourceware.org Cc: Tom Tromey , Andrew Burgess Subject: [PATCHv2 1/2] gdb/testsuite: rename source file gdb.debuginfod/main.c Date: Thu, 17 Nov 2022 11:38:05 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: <87wn7uuakv.fsf@tromey.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" The test gdb.debuginfod/fetch_src_and_symbols.exp uses a source file named main.c. I can't see any particular reason why the file is named as such. Usually test source files are named after the test script. This commit just renames the source file inline with the test script, and updates the call to standard_testfile (removing the reference to main.c). There's no particular reason for this change other than seeing the file named main.c made me thing that the source file must be shared with some other test (it isn't). There should be no change in what is tested after this commit. --- .../gdb.debuginfod/{main.c => fetch_src_and_symbols.c} | 0 gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename gdb/testsuite/gdb.debuginfod/{main.c => fetch_src_and_symbols.c} (100%) diff --git a/gdb/testsuite/gdb.debuginfod/main.c b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c similarity index 100% rename from gdb/testsuite/gdb.debuginfod/main.c rename to gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp index b57b3201cf7..8b3c2cf709e 100644 --- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp +++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp @@ -15,7 +15,7 @@ # Test debuginfod functionality -standard_testfile main.c +standard_testfile load_lib dwarf.exp load_lib debuginfod-support.exp From patchwork Thu Nov 17 11:38:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 60747 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E384A3986421 for ; Thu, 17 Nov 2022 11:39:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E384A3986421 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668685145; bh=spalav899JQFBl0fggnmLQIxIf4zejim7//0z5ao560=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Qdmp225W/mxBWBK5fzIvKs62gv4Z5dUUlC6D6sHmMiMK2yFzaSVNJ2wHobvb3YPZf 1zyPySanWoBKfY+XczoDf0XISJWHfX7yl7qo3NdXwfNvgGcVfqG7gFHz3tk3e0JyR+ TS4A835AuNu36hAfGy0MtWiL/VaXGVZ9L5jf1CL8= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 68A77398640B for ; Thu, 17 Nov 2022 11:38:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 68A77398640B Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-371-Kh6_BhmwNQ2qGTWbXbc5Og-1; Thu, 17 Nov 2022 06:38:14 -0500 X-MC-Unique: Kh6_BhmwNQ2qGTWbXbc5Og-1 Received: by mail-wm1-f71.google.com with SMTP id c1-20020a7bc001000000b003cfe40fca79so209566wmb.6 for ; Thu, 17 Nov 2022 03:38:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=spalav899JQFBl0fggnmLQIxIf4zejim7//0z5ao560=; b=4Vq0q5iwe8T0dUjocpvG9/oaKaufsq7/Q1d6HFpYT54cof9ECE7jUz91wr2d8Zo8ZL jpbk4nkswd8fdcJ53JOPveoxjd3pxquDMiaIvnZkKHARoNZkRbyCa7yfnvHqFx0TdC99 sTyJj7PwMR+aBKWq6RyzKKUnBYBCtMRvSJHruWtiYNERwYk+tF4XlMiI9ufyLS/+tHBv j6gLUTRxTft9D0a0XryTKgyaOD4v7BEl/iDss5lAGnS5S3rpOBUlVwoyhkEXydMroI5E 82ropWiSm0K/mB2LZnHzjvXbLCETz/yOncn5iYgihuVmR985QHhDWRDy4ri3QHlCUNcx Iq7Q== X-Gm-Message-State: ANoB5pn+BJsVQzrO/REoO4cxmukuWrjP0CPR50FrRW3A06Ym2ZmAmtqv FUYaI4W3qej8f68ag1xMJuuMpqbj0IPPu4JkSz4jCy6E+dbHyXPxoZJumoJfCwZWcBn4BEpsthL 4sOIoUb9QUxYb0KqQp42PlZqOHu8FkrXjM3rkUzOSqw61mwmXtUvJ6YUxp3iVAoyD1Ou68nN31g == X-Received: by 2002:adf:f612:0:b0:22e:5d66:dc5d with SMTP id t18-20020adff612000000b0022e5d66dc5dmr1229682wrp.175.1668685092732; Thu, 17 Nov 2022 03:38:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Cf8+eYh/n7ZmU1cJwko4xFkXAEGdFO1A7B/Jps62Am4500+xmMz3up1nit3mcWiViItFYJQ== X-Received: by 2002:adf:f612:0:b0:22e:5d66:dc5d with SMTP id t18-20020adff612000000b0022e5d66dc5dmr1229666wrp.175.1668685092538; Thu, 17 Nov 2022 03:38:12 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id o18-20020a05600c4fd200b003cfa26c410asm5962681wmq.20.2022.11.17.03.38.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 03:38:12 -0800 (PST) To: gdb-patches@sourceware.org Cc: Tom Tromey , Andrew Burgess Subject: [PATCHv2 2/2] gdb/testsuite: fix gdb.debuginfod/fetch_src_and_symbols.exp with Clang Date: Thu, 17 Nov 2022 11:38:06 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: <87wn7uuakv.fsf@tromey.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" The gdb.debuginfod/fetch_src_and_symbols.exp test is showing a single failure when run with some older versions of Clang, e.g. 9.0.1. The problem appears to be with Clang's generated line table. The test source looks like this: int main() { asm ("main_label: .globl main_label"); return 0; } In GDB, when we 'start', we expect to stop at the 'return 0;' line. This is the behaviour when the compiler is gcc, or later versions of Clang. However, with Clang 9.0.2, I see GDB stop on the 'asm' line. In this commit I'll fix this issue by placing a breakpoint on the return line, and then using gdb_continue_to_breakpoint to ensure we have stopped in the correct place. Of course, using gdb_continue_to_breakpoint will only work if we are not already stopped at the breakpoint location, so I've added some filler work before the 'return 0;' line. With this done we can use gdb_continue_to_breakpoint in all cases. As a result of adding the new filler work, one of the later tests, that used the 'list' command, no longer see the correct expected output (the top line of the source file is no longer included in the output). I've fixed this by listing a known specific line, the test is checking that GDB managed to find the source file, it doesn't matter which source line we list, as long as we can list something. --- gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c | 5 ++++- gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c index 412bd53edda..7215e3c6484 100644 --- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c +++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c @@ -15,11 +15,14 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +volatile int global_var = 0; + /* Dummy main function. */ int main() { asm ("main_label: .globl main_label"); - return 0; + ++global_var; + return 0; /* Breakpoint here. */ } diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp index 8b3c2cf709e..e95526a069f 100644 --- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp +++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp @@ -161,6 +161,10 @@ proc_with_prefix no_url { } { if ![runto_main] { return -1 } + + gdb_breakpoint [gdb_get_line_number "Breakpoint here"] + gdb_continue_to_breakpoint "stop at last line of main" + gdb_test "generate-core-file $::corefile" "Saved corefile $::corefile" \ "file [file tail $::corefile] gen" file rename -force ${binfile}2 $debugdir @@ -217,7 +221,8 @@ proc_with_prefix local_url { } { gdb_test_no_output "set substitute-path $outputdir /dev/null" \ "set substitute-path" gdb_test "br main" "Breakpoint 1 at.*file.*" - gdb_test "l" ".*This program is distributed in the hope.*" + set lineno [gdb_get_line_number "Breakpoint here"] + gdb_test "list $lineno" "return 0;\[^\r\n\]+Breakpoint here\\. .*" # GDB should now find the executable file. clean_restart