From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uFFHDpDlGGjNCRYAWB0awg (envelope-from ) for ; Mon, 05 May 2025 12:21:36 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=NFElkD9T; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 318F91E10E; Mon, 5 May 2025 12:21:36 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-10.1 required=5.0 tests=ARC_SIGNED,ARC_VALID, BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 7F9B11E089 for ; Mon, 5 May 2025 12:21:35 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3095A3858C60 for ; Mon, 5 May 2025 16:21:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3095A3858C60 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=NFElkD9T Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) by sourceware.org (Postfix) with ESMTPS id 46B593858D26 for ; Mon, 5 May 2025 16:20:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 46B593858D26 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 46B593858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.19 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746462011; cv=none; b=ZD5oVwO4vrMwIHOyvCkmTQYpK/gRZc2oP0EPcY9GE0qxZI+I/31vtzPozCvOZ+rsomo85sEGaYhhONGjUacE2MvPTMUkSQyVbGSclCiz7QGFNYQf5fSOinpu4quh7E8GTjFPRAkeUks1SbuSjJS/coyU8QJE+Q+4JbUrB3anjFM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746462011; c=relaxed/simple; bh=3Olxe6Um2/ufl6G8QM4aveb0YPSwIjzPY3I862EpboA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=RtLJoJV9wK0inuIRtEB1bBujYeap4UqE7z+WLfObtmtn0rEoKYOaQW58htqg4UODa2xxtZVpesoroTLMyRI7jvpQkW+VrCShs6cNYrY6R6mdED1E1tfXH0+jQ+NEl6B48AcLjEeSDosKC/d46VXFsW6DzEGERgYR2vdwt5oNiOE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 46B593858D26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1746462012; x=1777998012; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3Olxe6Um2/ufl6G8QM4aveb0YPSwIjzPY3I862EpboA=; b=NFElkD9TjRFVWZpL+aYdN70gn3+yXp/Gc3EGJOGHwU+8h9JH+k5465x4 mYcgivwflCIsuCK7+U7zOdbqtI7AsN5+PkFROgFHNbkvnMZv396E3rLhc is6IiPzmnHAHqyfr9zGU647Jn+zoYlC2Kfs+Ikw0+SDdZAy5DOBVBuixa NSNii/gHc4K4fYJ9T6YD881lrLj3llneL1rUOSKzSEYbSewWDxyl+kC5U v/oIYK6oZgx9vPXByybLmQkzgOtjY4ulP6/27XeVnqnkDxFz5xj0x+jxl N/cHW9BP0TbJPHV5YGq50m8hJqogezrnH9ouhTD++kZpm7nvudzLhHFkW A==; X-CSE-ConnectionGUID: VG5FfayIR3S+GGYA1SBrJg== X-CSE-MsgGUID: MuZ2JZ4YTMGDyhKyeR9iKQ== X-IronPort-AV: E=McAfee;i="6700,10204,11424"; a="47961812" X-IronPort-AV: E=Sophos;i="6.15,264,1739865600"; d="scan'208";a="47961812" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2025 09:20:10 -0700 X-CSE-ConnectionGUID: qCuNP1B1QKW7RSqHccbSug== X-CSE-MsgGUID: mpWcQC5OTl+d3mm+4ZNkng== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,264,1739865600"; d="scan'208";a="166352025" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2025 09:20:07 -0700 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org Cc: guinevere@redhat.com, eliz@gnu.org, pedro@palves.net Subject: [PATCH v4 2/3] gdb: update "info threads" output when no threads match the arguments Date: Mon, 5 May 2025 18:19:30 +0200 Message-Id: <249ea30447af4794f6d2f11e26d1046ce0862dcf.1746461232.git.tankut.baris.aktemur@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 If "info threads" is provided with the thread ID argument but no such threads matching the thread ID(s) are found, GDB prints No threads match ''. Update this output to the more generalized No threads matched. The intention is that the next patch, and potentially future ones, will extend the command with more filter/match arguments. We cannot customize the output to each such argument. Hence, be more generic. --- gdb/NEWS | 7 +++++++ gdb/testsuite/gdb.multi/tids.exp | 4 ++-- gdb/testsuite/gdb.threads/current-lwp-dead.exp | 2 +- gdb/testsuite/gdb.threads/thread-bp-deleted.exp | 2 +- gdb/thread.c | 3 +-- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index a82b7e3342c..18a8b7475b4 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -90,6 +90,13 @@ info sharedlibrary command are now for the full memory range allocated to the shared library. +info threads [-gid] [ID]... + If no threads match the given ID(s), GDB now prints + + No threads matched. + + without printing the provided argument. + * GDB-internal Thread Local Storage (TLS) support ** Linux targets for the x86_64, aarch64, ppc64, s390x, and riscv diff --git a/gdb/testsuite/gdb.multi/tids.exp b/gdb/testsuite/gdb.multi/tids.exp index b84f9080cbd..dab6275dc03 100644 --- a/gdb/testsuite/gdb.multi/tids.exp +++ b/gdb/testsuite/gdb.multi/tids.exp @@ -290,7 +290,7 @@ with_test_prefix "two inferiors" { # Try both the convenience variable and the literal number. foreach thr {"\$thr" "20" "1.20" "\$inf.1" "30.1" } { set expected [string_to_regexp $thr] - gdb_test "info threads $thr" "No threads match '${expected}'." + gdb_test "info threads $thr" "No threads matched\\." # "info threads" works like a filter. If there's any other # valid thread in the list, there's no error. info_threads "$thr 1.1" "1.1" @@ -412,7 +412,7 @@ with_test_prefix "two inferiors" { # Check that we do parse the inferior number and don't confuse it. gdb_test "info threads 3.1" \ - "No threads match '3.1'\." + "No threads matched\\." } if { [allow_python_tests] } { diff --git a/gdb/testsuite/gdb.threads/current-lwp-dead.exp b/gdb/testsuite/gdb.threads/current-lwp-dead.exp index 7aa7ab951b5..c8364df0b84 100644 --- a/gdb/testsuite/gdb.threads/current-lwp-dead.exp +++ b/gdb/testsuite/gdb.threads/current-lwp-dead.exp @@ -47,6 +47,6 @@ gdb_breakpoint $line gdb_continue_to_breakpoint "fn_return" ".*at-fn_return.*" # Confirm thread 2 is really gone. -gdb_test "info threads 2" "No threads match '2'\\." +gdb_test "info threads 2" "No threads matched\\." gdb_continue_to_end "" continue 1 diff --git a/gdb/testsuite/gdb.threads/thread-bp-deleted.exp b/gdb/testsuite/gdb.threads/thread-bp-deleted.exp index 2eadd380370..8cabb709c0c 100644 --- a/gdb/testsuite/gdb.threads/thread-bp-deleted.exp +++ b/gdb/testsuite/gdb.threads/thread-bp-deleted.exp @@ -147,7 +147,7 @@ if {$is_remote} { exp_continue } - -re "No threads match '99'\\.\r\n$gdb_prompt $" { + -re "No threads matched\\.\r\n$gdb_prompt $" { if {!$saw_thread_exited && !$saw_bp_deleted && $attempt_count > 0} { sleep 1 incr attempt_count -1 diff --git a/gdb/thread.c b/gdb/thread.c index 3375cfcee24..d84d326a8c3 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -1285,8 +1285,7 @@ print_thread_info_1 (struct ui_out *uiout, const char *requested_threads, if (requested_threads == NULL || *requested_threads == '\0') uiout->message (_("No threads.\n")); else - uiout->message (_("No threads match '%s'.\n"), - requested_threads); + uiout->message (_("No threads matched.\n")); return; } -- 2.34.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928