From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by sourceware.org (Postfix) with ESMTPS id C63EA384D6DC for ; Fri, 16 Dec 2022 12:41:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C63EA384D6DC Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f48.google.com with SMTP id h12so2336757wrv.10 for ; Fri, 16 Dec 2022 04:41:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YjhJAFCn1lSsqwRGgCsnebvYcxoZy5XVpKJ/ej4/lr8=; b=NH/9BHsjuupLGTeUiJKEl/7EZflWsnJIgG4TptLbwLHYj3pXmdJoK1YAzBS3s11Ok6 hsaFVRLtzUaHf4xbrEtB44Ia5SEWsbJp4U3YV+RF4vorM83qLlut8dYn2ksWO5r1w8tO 4VNBiyw0IhdnB0KxQRF6zHzHUeQQfL5zhGA467qYCPQD6DaO0CNVD2/nQAswxXsj8dqt qZUVWq0oKe9occAAzFQrsh3Bn7vTaFf2ofxH6f7auDma2cE5MspZuMW3dlwXA0QBEEgI YU1EyRj//U4PZ48c5e+Df8RK1nNRK3S7co/6MgxClnxtyDf71jTjpLwozHhiz0eKQomL 3t5w== X-Gm-Message-State: ANoB5pkcZKWNF6YWxo/3er14PJJWkww/4oIf8MwhFA89oaqWx+SMQ930 HPkrKWMtGeXbx0JtYkeROpOUUTJxs7mYqQ== X-Google-Smtp-Source: AA0mqf7kdmdySkTh7UKC9v63XpNaD6uwGWx36KY1kr7xA68VymbH9kZ5wS5dvcqwLemN4PJMHz/UFg== X-Received: by 2002:adf:ed48:0:b0:242:5ae0:5b49 with SMTP id u8-20020adfed48000000b002425ae05b49mr20350786wro.30.1671194475366; Fri, 16 Dec 2022 04:41:15 -0800 (PST) Received: from ?IPv6:2001:8a0:f912:6700:afd9:8b6d:223f:6170? ([2001:8a0:f912:6700:afd9:8b6d:223f:6170]) by smtp.gmail.com with ESMTPSA id bj19-20020a0560001e1300b002238ea5750csm2531392wrb.72.2022.12.16.04.41.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Dec 2022 04:41:14 -0800 (PST) Subject: Re: [PATCH] [gdb/testsuite] Fix race in gdb.threads/detach-step-over.exp To: Tom de Vries , gdb-patches@sourceware.org References: <20221213140237.32325-1-tdevries@suse.de> From: Pedro Alves Message-ID: <0755efda-fea9-10d6-d138-d2857429218e@palves.net> Date: Fri, 16 Dec 2022 12:41:14 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20221213140237.32325-1-tdevries@suse.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2022-12-13 2:02 p.m., Tom de Vries via Gdb-patches wrote: > Once in a while I run into: > ... > FAIL: gdb.threads/detach-step-over.exp: \ > breakpoint-condition-evaluation=host: target-non-stop=off: non-stop=off: \ > displaced=off: iter 1: all threads running > ... > > In can easily reproduce this by doing: > ... > # Wait a bit, to give time for the threads to hit the > # breakpoint. > - sleep 1 > > return true > ... > > Fix this by counting the running threads in a loop, effectively allowing 10 > seconds (instead of 1) for the threads to start running, but only sleeping if > needed. > > Reduces total execution time from 1m27s to 56s. Cool, thanks. I've run into this race too once in a while, but never managed to find time to look into it. LGTM, with just one nit: > + if { $interrupted == 0 } { Just a bit below we have: if {!$interrupted} { I'd rather the same form is used in both places, and I think the second form is better.