From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ij15GMAr+GBnNgAAWB0awg (envelope-from ) for ; Wed, 21 Jul 2021 10:14:24 -0400 Received: by simark.ca (Postfix, from userid 112) id 534901EDFB; Wed, 21 Jul 2021 10:14:24 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=1.0 required=5.0 tests=FORGED_MUA_MOZILLA, FREEMAIL_FROM,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=no 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 B76031E4A3 for ; Wed, 21 Jul 2021 10:14:23 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B437D385382C for ; Wed, 21 Jul 2021 14:14:22 +0000 (GMT) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2087.outbound.protection.outlook.com [40.92.90.87]) by sourceware.org (Postfix) with ESMTPS id 564803854821 for ; Wed, 21 Jul 2021 14:13:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 564803854821 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=hotmail.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=hotmail.de ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zf7Qjc3y/glZk9Jn+qmeKirM5MWMW6SA1gKZwAQ6F1LKy8Gq0WsjFnUA5QaXPUw1Vj7vBEAmoBrLHBZ6efgmAnRhAuoMB7cESKKc46C3RVese1Ym7qonFX4rBfOLSD6kvvH5ydFpSqohYLzl3ZzZU6ysEL1hUaQhvmMtwnkizGTgj9vtEBofiWZo2z2iI2H13Eq1PUCuwGYf7CKWiU4pP4rNMk5oN9951/hv6YbP6LMdtLKXm2la7szJY/YUlJx17nRODYg45PSCT5EWuW3P1C2jWUJ95B+CqAamOyUMcck6RwJ/jiuCfcJv2HpLBYAyz3e3y8Zetx5hTDJKUnU92w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1Ih53AG8sB5gcdDtfaYvqsPVJwn0VUWPFKx8wsGW5HI=; b=m9lfMSuS1cji9yYAhgEn6PL86L0cHkXONmg9h14LkuUMKeb9nNKnPfB59hzzzkrMguED1eDwBHN0JR9lRA5ny7x0f3wQoMBBRYOfx2e06PUB8DB9I++kk1jltg5tLA4qhM7/6yLp5HckCTWaC4T1XViICMv7kUrAJZPgwNmTRQcxUKfbUvkgDfyouNOdvG6RHNJLziQthznRVeCzGQ5ueLZ0Zfl29YX+W9gGXMijunm5DHuUQuI/975oZ9gwSNjs5umGGrmhgQboqqhTOPCaplrGE+PSbpCLxHGXIHD43KKwaW8zSe9wPTAfmTx3ifeMJz87QSv/RrHBKIckZXu+hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from AM6EUR05FT034.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc11::4b) by AM6EUR05HT069.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc11::301) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.24; Wed, 21 Jul 2021 14:13:38 +0000 Received: from AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM (2a01:111:e400:fc11::49) by AM6EUR05FT034.mail.protection.outlook.com (2a01:111:e400:fc11::321) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 14:13:38 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:A3AA55DF1633187F138F3CA31313D7B6CAC16234AD6F97AAA771FACB21865EDF; UpperCasedChecksum:7D9F22FA126EF1E98E847FFAC2EFBA12DF228B214F0BB4FEFD3ACE168434F3EB; SizeAsReceived:7787; Count:47 Received: from AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM ([fe80::3d30:d151:570a:8a16]) by AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM ([fe80::3d30:d151:570a:8a16%7]) with mapi id 15.20.4331.034; Wed, 21 Jul 2021 14:13:38 +0000 Subject: Re: [PATCH][gdb/testsuite] Fix gdb.cp/step-and-next-inline.exp with gcc-11 To: Tom de Vries , gdb-patches@sourceware.org References: <20210721083134.GA7560@delia.home> From: Bernd Edlinger Message-ID: Date: Wed, 21 Jul 2021 16:13:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 In-Reply-To: <20210721083134.GA7560@delia.home> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TMN: [vLH72VbiqpgvVoE+SvgW45LkYNHARN4o] X-ClientProxiedBy: AM4PR0302CA0022.eurprd03.prod.outlook.com (2603:10a6:205:2::35) To AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:364::23) X-Microsoft-Original-Message-ID: <2ff42b64-7f0c-1b76-6a4e-07014acf2e7c@hotmail.de> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.101] (88.76.118.196) by AM4PR0302CA0022.eurprd03.prod.outlook.com (2603:10a6:205:2::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 14:13:37 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 0135ac7c-21cc-4ec7-3816-08d94c51bbf0 X-MS-TrafficTypeDiagnostic: AM6EUR05HT069: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s1oWgRunmU7ugzCxwaU3y+gXOj2amf4uYLz6n4bpzI8I9RJRUmG/aRpKZ1fHxJSP3uPe4ZcGMVFritlJVhz+0lQOmbEX0k5tnYjIjMxCfgvvYFuXNkc9vx7LQ9BQTjeT9f0LvPCuYL3pn/mrLmU9eR25qzFI4nZRWa6HRE9js5ylnmcKRHPKnOcTVBdzDZ1fPElS4UqkMVzwa8TSC0ki4+FzLLvyUZZIDqRGjdZBkmLsT7ga/MZg26Un/yB3VEbq9llhhndnon+QchQBRUh5YL7D0El0Z8Qnnkm7kU2k3UHlk+l4AXVkxtNTSbXo5YdXGTVYYiEI+6gIxuIOlFGy8DZvaqbPbSY4Rj4EbMKvebDVVp1ddwZ9H+8Mf50+oGBJ0PJDpE1zdfeox8sjtHKy/DYexJGIbEy4y1vr7cdLkikVFrNTApzz6XlvQt/t/iSORcOfOSdZgnVMVYF1G0Jngbi+xpNvi/rIjEA8DtXXJeg= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0k3zi5hE6EIORxJitsT/umhw9VY87NS70JHPB39lynYFDhdaisjEZtMledvseKEDyialkoQj5RfJg2uCzw/VXq4c47EV7qEUruZN7FG8wVopVkwAHQZoA0wS2FUsJnNX8FU1aqEAvhB3p6PRKw7OUg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0135ac7c-21cc-4ec7-3816-08d94c51bbf0 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 14:13:38.2543 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: AM6EUR05FT034.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6EUR05HT069 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: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 7/21/21 10:31 AM, Tom de Vries wrote: > Hi, > > When running test-case gdb.cp/step-and-next-inline.exp with gcc-11, I run > into: > ... > KPASS: gdb.cp/step-and-next-inline.exp: no_header: next step 1 \ > (PRMS symtab/25507) > FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 2 > KPASS: gdb.cp/step-and-next-inline.exp: no_header: next step 3 \ > (PRMS symtab/25507) > ... > > [ Note that I get the same result with gcc-11 and target board > unix/gdb:debug_flags=-gdwarf-4, so this is not a dwarf 4 vs 5 issue. ] > > With gcc-10, I have this trace: > ... > 64 get_alias_set (&xx); > get_alias_set (t=0x601038 ) at step-and-next-inline.cc:51 > 51 if (t != NULL > 40 if (t->x != i) > 52 && TREE_TYPE (t).z != 1 > 43 return x; > 53 && TREE_TYPE (t).z != 2 > 43 return x; > 54 && TREE_TYPE (t).z != 3) > 43 return x; > main () at step-and-next-inline.cc:65 > 65 return 0; > ... > and with gcc-11, I have instead: > ... > 64 get_alias_set (&xx); > get_alias_set (t=0x601038 ) at step-and-next-inline.cc:51 > 51 if (t != NULL > 52 && TREE_TYPE (t).z != 1 > 43 return x; > 53 && TREE_TYPE (t).z != 2 > 43 return x; > 54 && TREE_TYPE (t).z != 3) > 43 return x; > main () at step-and-next-inline.cc:65 > 65 return 0; > ... > and with clang-10, I have instead: > ... > 64 get_alias_set (&xx); > get_alias_set (t=0x601034 ) at step-and-next-inline.cc:51 > 51 if (t != NULL > 52 && TREE_TYPE (t).z != 1 > 53 && TREE_TYPE (t).z != 2 > 54 && TREE_TYPE (t).z != 3) > 51 if (t != NULL > 57 } > main () at step-and-next-inline.cc:65 > 65 return 0; > ... > > The test-case tries to verify that we don't step into inlined function > tree_check (lines 40-43) (so, with the clang trace we get that right). > > The test-case then tries to kfail the problems when using gcc, but this is > done in such a way that the testing still gets out of sync after a failure. > That is: the "next step 2" check that is supposed to match > "TREE_TYPE (t).z != 2" is actually matching "TREE_TYPE (t).z != 1": > ... > (gdb) next^M > 52 && TREE_TYPE (t).z != 1^M > (gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: next step 2 > ... > > Fix this by issuing extra nexts to arrive at the required lines. > > Tested on x86_64-linux, with gcc-8, gcc-9, gcc-10, gcc-11, clang-8, clang-10 > and clang-12. > > Any comments? > Note that I've posted a patch series that would fix this test case for all gcc/clang versions I've tested, although I admit I've tested fewer versions than you. * Improve debugging of optimized code https://sourceware.org/pipermail/gdb-patches/2021-January/175617.html (2021-05-31) v2 posted at: [0/4] https://sourceware.org/pipermail/gdb-patches/2021-May/179367.html [1/4] https://sourceware.org/pipermail/gdb-patches/2021-May/179368.html [2/4] https://sourceware.org/pipermail/gdb-patches/2021-May/179370.html [3/4] https://sourceware.org/pipermail/gdb-patches/2021-May/179369.html Thanks Bernd. > Thanks, > - Tom > > [gdb/testsuite] Fix gdb.cp/step-and-next-inline.exp with gcc-11 > > gdb/testsuite/ChangeLog: > > 2021-07-20 Tom de Vries > > * gdb.cp/step-and-next-inline.cc (tree_check, get_alias_set, main): > Tag closing brace with comment. > * gdb.cp/step-and-next-inline.h: Update to keep identical with > step-and-next-inline.cc. > * gdb.cp/step-and-next-inline.exp: Issue extra next when required. > > --- > gdb/testsuite/gdb.cp/step-and-next-inline.cc | 6 +- > gdb/testsuite/gdb.cp/step-and-next-inline.exp | 89 ++++++++++++++++++++++++--- > gdb/testsuite/gdb.cp/step-and-next-inline.h | 2 +- > 3 files changed, 84 insertions(+), 13 deletions(-) > > diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.cc b/gdb/testsuite/gdb.cp/step-and-next-inline.cc > index 6f0a7fbda9e..26b29d01777 100644 > --- a/gdb/testsuite/gdb.cp/step-and-next-inline.cc > +++ b/gdb/testsuite/gdb.cp/step-and-next-inline.cc > @@ -41,7 +41,7 @@ tree_check (tree *t, int i) > abort(); > tree *x = t; > return x; > -} > +} // tree-check > > #endif /* USE_NEXT_INLINE_H */ > > @@ -54,7 +54,7 @@ get_alias_set (tree *t) > && TREE_TYPE (t).z != 3) > return 0; > return 1; > -} > +} // get_alias_set > > tree xx; > > @@ -63,4 +63,4 @@ main() > { > get_alias_set (&xx); > return 0; > -} > +} // main > diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.exp b/gdb/testsuite/gdb.cp/step-and-next-inline.exp > index 85f7b8d5af1..13d801bb539 100644 > --- a/gdb/testsuite/gdb.cp/step-and-next-inline.exp > +++ b/gdb/testsuite/gdb.cp/step-and-next-inline.exp > @@ -67,29 +67,100 @@ proc do_test { use_header } { > gdb_test "step" ".*" "step into get_alias_set" > gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \ > "not in inline 1" > + > # It's possible that this first failure (when not using a header > # file) is GCC's fault, though the remaining failures would best > # be fixed by adding location views support (though it could be > # that some easier heuristic could be figured out). Still, it is > # not certain that the first failure wouldn't also be fixed by > # having location view support, so for now it is tagged as such. > - if {[test_compiler_info gcc*] && !$use_header} { > - setup_kfail "*-*-*" symtab/25507 > + set have_kfail [expr [test_compiler_info gcc*] && !$use_header] > + > + set ok 1 > + gdb_test_multiple "next" "next step 1" { > + -re -wrap "if \\(t->x != i\\)" { > + set ok 0 > + send_gdb "next\n" > + exp_continue > + } > + -re -wrap ".*TREE_TYPE.* != 1" { > + if { $ok } { > + pass $gdb_test_name > + } else { > + if { $have_kfail } { > + setup_kfail "*-*-*" symtab/25507 > + } > + fail $gdb_test_name > + } > + } > } > - gdb_test "next" ".*TREE_TYPE.*" "next step 1" > gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \ > "not in inline 2" > - gdb_test "next" ".*TREE_TYPE.*" "next step 2" > + > + set ok 1 > + gdb_test_multiple "next" "next step 2" { > + -re -wrap "return x;" { > + set ok 0 > + send_gdb "next\n" > + exp_continue > + } > + -re -wrap ".*TREE_TYPE.* != 2" { > + if { $ok } { > + pass $gdb_test_name > + } else { > + if { $have_kfail } { > + setup_kfail "*-*-*" symtab/25507 > + } > + fail $gdb_test_name > + } > + } > + } > gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \ > "not in inline 3" > - if {[test_compiler_info gcc*] && !$use_header} { > - setup_kfail "*-*-*" symtab/25507 > + > + set ok 1 > + gdb_test_multiple "next" "next step 3" { > + -re -wrap "return x;" { > + set ok 0 > + send_gdb "next\n" > + exp_continue > + } > + -re -wrap ".*TREE_TYPE.* != 3\\)" { > + if { $ok } { > + pass $gdb_test_name > + } else { > + if { $have_kfail } { > + setup_kfail "*-*-*" symtab/25507 > + } > + fail $gdb_test_name > + } > + } > } > - gdb_test "next" ".*TREE_TYPE.*" "next step 3" > gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \ > "not in inline 4" > - if {!$use_header} { setup_kfail "*-*-*" symtab/25507 } > - gdb_test "next" "return 0.*" "next step 4" > + > + set ok 1 > + gdb_test_multiple "next" "next step 4" { > + -re -wrap "(if \\(t != NULL|\} // get_alias_set)" { > + send_gdb "next\n" > + exp_continue > + } > + -re -wrap "return x;" { > + set ok 0 > + send_gdb "next\n" > + exp_continue > + } > + -re -wrap "return 0.*" { > + if { $ok } { > + pass $gdb_test_name > + } else { > + if { $have_kfail } { > + setup_kfail "*-*-*" symtab/25507 > + } > + fail $gdb_test_name > + } > + } > + } > gdb_test "bt" \ > "\\s*\\#0\\s+(main|get_alias_set)\[^\r\]*${srcfile}:.*" \ > "not in inline 5" > diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.h b/gdb/testsuite/gdb.cp/step-and-next-inline.h > index 8eb4b71d3cc..bf45d8a388c 100644 > --- a/gdb/testsuite/gdb.cp/step-and-next-inline.h > +++ b/gdb/testsuite/gdb.cp/step-and-next-inline.h > @@ -35,4 +35,4 @@ tree_check (tree *t, int i) > abort(); > tree *x = t; > return x; > -} > +} // tree_check >