From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by sourceware.org (Postfix) with ESMTPS id 39E473858002 for ; Mon, 29 Mar 2021 14:04:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 39E473858002 IronPort-SDR: VDfvtNf1P1YoqBHlCTctfLvMT4jSzdOTNkG+9iEx7SLnHL1vx/9nEbr21zr4cqd3yOIE3rKaiM IYtuKceTs1ag== X-IronPort-AV: E=McAfee;i="6000,8403,9938"; a="255551566" X-IronPort-AV: E=Sophos;i="5.81,288,1610438400"; d="scan'208";a="255551566" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2021 07:04:01 -0700 IronPort-SDR: Iqo4WgAIuM1iZMUug/vLOA0Flx9YXReGTvpGAgpGUzCid22Bcz8NQEGNMDamdbAF4tz3xfW14D ERsE4kNX1RFw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,288,1610438400"; d="scan'208";a="383573896" Received: from irvmail001.ir.intel.com ([10.43.11.63]) by fmsmga007.fm.intel.com with ESMTP; 29 Mar 2021 07:04:00 -0700 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 12TE3xKW003496; Mon, 29 Mar 2021 15:03:59 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id 12TE3xTO004520; Mon, 29 Mar 2021 16:03:59 +0200 Received: (from taktemur@localhost) by ulvlx001.iul.intel.com with LOCAL id 12TE3w9Y004515; Mon, 29 Mar 2021 16:03:58 +0200 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org Subject: [PATCH] testsuite, mi: avoid a clang bug in 'user-selected-context-sync.exp' Date: Mon, 29 Mar 2021 16:03:35 +0200 Message-Id: <1617026615-4257-1-git-send-email-tankut.baris.aktemur@intel.com> X-Mailer: git-send-email 1.7.0.7 X-Spam-Status: No, score=-12.4 required=5.0 tests=AC_FROM_MANY_DOTS, BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Mon, 29 Mar 2021 14:04:05 -0000 This test causes several timeouts for Clang, taking too long time to finish. The reason is, for an infinite loop of the form while(1); /* suppose this is line 30. */ Clang generates code that looks like 0x00000000004004d4 <+4>: jmp 0x4004d9 0x00000000004004d9 <+9>: jmp 0x4004d9 So, the real loop is the instruction at address 0x4004d9. But a breakpoint that's defined at the loop line (assume line 30 in this case) is inserted at address 0x4004d4. (gdb) break 30 Breakpoint 1 at 0x4004d4: file test.c, line 30. Therefore, continuing a thread that was spinning on the loop does not hit the breakpoint. The bug is reported at https://bugs.llvm.org/show_bug.cgi?id=49614 Tweak the infinite loop to spin on a variable to avoid this bug. The test is unrelated to the bug. gdb/testsuite/ChangeLog: 2021-03-29 Tankut Baris Aktemur * gdb.mi/user-selected-context-sync.exp: Spin on a variable in the infinite loop to avoid a Clang bug. --- gdb/testsuite/gdb.mi/user-selected-context-sync.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.c b/gdb/testsuite/gdb.mi/user-selected-context-sync.c index 500a118a2dc..0f8a966f69d 100644 --- a/gdb/testsuite/gdb.mi/user-selected-context-sync.c +++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.c @@ -27,7 +27,8 @@ static pthread_barrier_t barrier; static void child_sub_function (void) { - while (1); /* thread loop line */ + int spin = 1; + while (spin); /* thread loop line */ } static void * @@ -57,7 +58,8 @@ main (void) pthread_barrier_wait (&barrier); - while (1); /* main break line */ + int spin = 1; + while (spin); /* main break line */ return 0; } -- 2.17.1