From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id vLGjFyr6wWBeKAAAWB0awg (envelope-from ) for ; Thu, 10 Jun 2021 07:40:26 -0400 Received: by simark.ca (Postfix, from userid 112) id 532151F163; Thu, 10 Jun 2021 07:40:26 -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.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED 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 348D81E813 for ; Thu, 10 Jun 2021 07:40:25 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 52B6A3AAA0A9 for ; Thu, 10 Jun 2021 11:40:24 +0000 (GMT) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id B6C06398B427 for ; Thu, 10 Jun 2021 11:38:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B6C06398B427 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A52A71FD37 for ; Thu, 10 Jun 2021 11:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623325107; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=ZmNeF7LLnajlB+27fmPhxM62rYfk6IdoHW4/kdmd1cY=; b=geHm82jBmIxaZjPJlqhtVvOXvDut4Wtw1uNcRhUlRi7TA5CMa1mZ7OzXP8AQniLc2czbwq 1Hs77PsFXyvNXuLxSw5LoJUw1XQTTmG24WD9u0Py4YD4Y/IbNE27fhHmJaJJHndSNEKMM/ qxxkeaqmyrh6FZ0wQDDSKlsGl8ZaGes= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623325107; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=ZmNeF7LLnajlB+27fmPhxM62rYfk6IdoHW4/kdmd1cY=; b=a+NfInTBVBShm2XgE+HiBpLXY9px+7h7r2x08DqsLjzPCXVRirIWJtoyWQV+Tzr1axHbV3 vJWosLnPXENC0qBQ== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 87757118DD for ; Thu, 10 Jun 2021 11:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623325107; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=ZmNeF7LLnajlB+27fmPhxM62rYfk6IdoHW4/kdmd1cY=; b=geHm82jBmIxaZjPJlqhtVvOXvDut4Wtw1uNcRhUlRi7TA5CMa1mZ7OzXP8AQniLc2czbwq 1Hs77PsFXyvNXuLxSw5LoJUw1XQTTmG24WD9u0Py4YD4Y/IbNE27fhHmJaJJHndSNEKMM/ qxxkeaqmyrh6FZ0wQDDSKlsGl8ZaGes= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623325107; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=ZmNeF7LLnajlB+27fmPhxM62rYfk6IdoHW4/kdmd1cY=; b=a+NfInTBVBShm2XgE+HiBpLXY9px+7h7r2x08DqsLjzPCXVRirIWJtoyWQV+Tzr1axHbV3 vJWosLnPXENC0qBQ== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id J14LILP5wWDtAwAALh3uQQ (envelope-from ) for ; Thu, 10 Jun 2021 11:38:27 +0000 Date: Thu, 10 Jun 2021 13:38:26 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix timeout in gdb.mi/user-selected-context-sync.exp with gcc-11 Message-ID: <20210610113824.GA31858@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) 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" Hi, When running test-case gdb.mi/user-selected-context-sync.exp with gcc-11, we get: ... continue^M Continuing.^M FAIL: gdb.mi/user-selected-context-sync.exp: mode=all-stop: test_setup: \ inferior 1: continue to breakpoint: continue thread 1.2 to infinite \ loop breakpoint (timeout) ... This is a regression since commit aa33ea68330 "testsuite, mi: avoid a clang bug in 'user-selected-context-sync.exp'", which fixes a similar hang when using clang. The source before the commit contains: ... while (1); ... and after the commit: ... int spin = 1; while (spin); ... [ FWIW, I've filed a PR gcc/101011 - Inconsistent debug info for "while (1);" to mention that gcc-11 has different behaviour for these two loops. ] The problem is that: - the test-case expects the behaviour that a breakpoint set on the while line will trigger on every iteration, and - that is not guaranteed by either version of the loop. Fix this by using a while loop with a dummy body: ... volatile int dummy = 0; while (1) dummy = !dummy; ... and setting the breakpoint in the body. Tested on x86_64-linux with clang 10.0.1, gcc-4.8, gcc 7.5.0 and gcc 11.1.1. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix timeout in gdb.mi/user-selected-context-sync.exp with gcc-11 gdb/testsuite/ChangeLog: 2021-06-10 Tom de Vries * gdb.mi/user-selected-context-sync.c (child_sub_function, main): Rewrite while (1) using dummy loop body. --- gdb/testsuite/gdb.mi/user-selected-context-sync.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.c b/gdb/testsuite/gdb.mi/user-selected-context-sync.c index 9818f30277f..ebb55f87e2c 100644 --- a/gdb/testsuite/gdb.mi/user-selected-context-sync.c +++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.c @@ -27,10 +27,10 @@ static pthread_barrier_t barrier; static void child_sub_function (void) { - /* Deliberately spin on a variable instead of plain 'while (1)' to - avoid the Clang bug https://bugs.llvm.org/show_bug.cgi?id=49614. */ - int spin = 1; - while (spin); /* thread loop line */ + volatile int dummy = 0; + while (1) + /* Dummy loop body to allow setting breakpoint. */ + dummy = !dummy; /* thread loop line */ } static void * @@ -60,10 +60,10 @@ main (void) pthread_barrier_wait (&barrier); - /* Deliberately spin on a variable instead of plain 'while (1)' to - avoid the Clang bug https://bugs.llvm.org/show_bug.cgi?id=49614. */ - int spin = 1; - while (spin); /* main break line */ + volatile int dummy = 0; + while (1) + /* Dummy loop body to allow setting breakpoint. */ + dummy = !dummy; /* main break line */ return 0; }