From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ySOUB7Km+2mlWhsAWB0awg (envelope-from ) for ; Wed, 06 May 2026 16:38:10 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=qpyj0zOn; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 1AE741E0BA; Wed, 06 May 2026 16:38:10 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 93E451E067 for ; Wed, 06 May 2026 16:38:09 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 291CE4BA23E9 for ; Wed, 6 May 2026 20:38:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 291CE4BA23E9 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=qpyj0zOn Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 653A14BA2E37 for ; Wed, 6 May 2026 20:37:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 653A14BA2E37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 653A14BA2E37 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778099824; cv=none; b=rMsHzBMcU6nK9zPmX7RF5Lx1ubxVEnmbtkI/FcZ8ySpToCi46AEvstjD5hi7JxUImJxw5DZquLJ3FVEc06Riqk1AyU01TSDx8qdLJFHOaKmleORzGEAWuRJtHBSBWvgD2FME7njnDTJIz8eFW/ndB61QjA14Lef5g69bkN9At+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778099824; c=relaxed/simple; bh=oUvfpDd9Imwow+mN1lmYEbTqoBjJc1S35tbnQeFfFi8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DnTzpn2RKkLaVjTZ1d3LRT5DwkEX2n9B5w3jLw6GUbkawhOIjpqnHe+VBAVLKw7bNKTF/7IfQpTTKnL/0Hl9TV7fXuPo0X9R9jTsEwaQHEFFYL3q7B4Dev4svsfzGnw4P6JAa9arE9NTnSzQnpttWUuxbMT3AyDnwtgcQlR9c5A= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=qpyj0zOn DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 653A14BA2E37 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 646KaujF157057 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 6 May 2026 16:37:01 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 646KaujF157057 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1778099821; bh=gnf86iFZ+DlE7inSVASh8boA4gLiA7W+Q1/OZlKvp2k=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=qpyj0zOnGVXxMghb9o7MoMoKGyr74eT7EQpZtjr/iLnOsEbyaCRSVz7yzg5+d6R7Y BFQAqLNLXwXpCD5V9GBRNPHM/G6tT+WroGbAeeAU8ZLhmKPzhKdhPrigPTRhfarMWx G1i8xD8yoJNb7qmnEETWv2OYQxKjQrcJ79QBSTgS25c0WS/p3DkadS1SCbtG0kU/+G 9G6BRcSuSt4U6/h2Adez5dK/grvPrTvrVotbEmIHIC9zosrGNK6dXgWSW5aFdx0KIa 4oMU4HZPxjraADFN+BfxLKiyVv9pgEFHp1MpKHGF/jvyIdHx3n9KJcUujPaedl/GDy LQtff4+w/WBFg== Received: by simark.ca (Postfix) id B96221E0D1; Wed, 06 May 2026 16:28:07 -0400 (EDT) From: simon.marchi@polymtl.ca To: gdb-patches@sourceware.org Cc: Simon Marchi , Tankut Baris Aktemur Subject: [PATCH 4/7] gdb/testsuite: fix step-over-thread-exit.exp with native-gdbserver Date: Wed, 6 May 2026 16:27:52 -0400 Message-ID: <20260506202804.1681886-5-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260506202804.1681886-1-simon.marchi@polymtl.ca> References: <20260506202804.1681886-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 6 May 2026 20:36:56 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 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 From: Simon Marchi This test uses "set args N" to control how many threads the inferior spawns: 1 in some cases and 100 in others. However, "set args" doesn't work with the native-gdbserver board. As a result, with that board, the inferior always uses its default of 100 threads. It sometimes causes failures like: p $_thread == 2 $1 = 1 (gdb) [New Thread 2790806.2790823 (id 3)] Thread 3 "step-over-threa" hit Breakpoint 2, 0x00005555555552ab in my_exit_syscall () at /.../testsuite/lib/my-syscalls.S:85 85 SYSCALL (my_exit, __NR_exit) FAIL: gdb.threads/step-over-thread-exit.exp: step_over_mode=inline: non-stop=on: target-non-stop=on: schedlock=off: cmd=next: ns_stop_all=0: selected thread didn't change (timeout) Here, GDB steps over thread 2's exit. As soon as thread 2 exits, the main thread spawns a new thread (thread 3), which hits the breakpoint placed over the exit syscall, and that event gets reported asynchronously, confusing the testsuite. The point of setting n_threads to 1 is exactly to avoid things like that. Fix it by passing the args via the new -inferior-args option, which works correctly with the native-gdbserver board. Change the test program to requiring the number of threads to be passed as an argument, which would have caught this problem. Change-Id: Ifc8856aa582706fd7207d0035d35dee749eb83a5 Reported-By: Tankut Baris Aktemur --- gdb/testsuite/gdb.threads/step-over-thread-exit.c | 15 ++++++++++----- .../gdb.threads/step-over-thread-exit.exp | 8 ++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/gdb/testsuite/gdb.threads/step-over-thread-exit.c b/gdb/testsuite/gdb.threads/step-over-thread-exit.c index 6cda1a4f1b0b..e52de2910a7a 100644 --- a/gdb/testsuite/gdb.threads/step-over-thread-exit.c +++ b/gdb/testsuite/gdb.threads/step-over-thread-exit.c @@ -31,16 +31,21 @@ thread_func (void *arg) abort (); } -/* Number of threads we'll create. */ -int n_threads = 100; - int main (int argc, char **argv) { int i; - if (argc > 1) - n_threads = atoi (argv[1]); + /* Number of threads we'll create. Set from argv[1]. */ + int n_threads; + + if (argc != 2) + { + fprintf (stderr, "Usage: %s N_THREADS\n", argv[0]); + return 1; + } + + n_threads = atoi (argv[1]); /* Spawn and join a thread, N_THREADS times. */ for (i = 0; i < n_threads; i++) diff --git a/gdb/testsuite/gdb.threads/step-over-thread-exit.exp b/gdb/testsuite/gdb.threads/step-over-thread-exit.exp index f398538058d4..aeca985dec0d 100644 --- a/gdb/testsuite/gdb.threads/step-over-thread-exit.exp +++ b/gdb/testsuite/gdb.threads/step-over-thread-exit.exp @@ -71,9 +71,7 @@ proc test {step_over_mode non-stop target-non-stop schedlock cmd ns_stop_all} { if {$schedlock || (${non-stop} == "on" && $ns_stop_all)} { - gdb_test_no_output "set args 1" - - if { ![runto my_exit_syscall] } { + if { ![runto my_exit_syscall -inferior-args 1] } { return } @@ -148,9 +146,7 @@ proc test {step_over_mode non-stop target-non-stop schedlock cmd ns_stop_all} { set n_threads 100 } - gdb_test_no_output "set args $n_threads" - - if { ![runto_main] } { + if { ![runto_main -inferior-args $n_threads] } { return } -- 2.54.0