From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id o8L9JtjzGGhrIRYAWB0awg (envelope-from ) for ; Mon, 05 May 2025 13:22:32 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=UaRp203V; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8D0701E10E; Mon, 5 May 2025 13:22:32 -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 1B64A1E089 for ; Mon, 5 May 2025 13:22:32 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B58E03858408 for ; Mon, 5 May 2025 17:22:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B58E03858408 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gnu.org header.i=@gnu.org header.a=rsa-sha256 header.s=fencepost-gnu-org header.b=UaRp203V Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 79D873858406 for ; Mon, 5 May 2025 17:22:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 79D873858406 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 79D873858406 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746465722; cv=none; b=FOOKmeSZ6mFGElKvwgzWeFSXp7uWmTF0VGXqLPHFNQ0inh6pY7OPx1Ux/bYdFLqcsX0hzLw8zeilJJR7IBvPO+HqlWXco7fmyHFte52k/dHq9IhdeDCnK7tCh0LIF8W3pQq3sfF7u58WRAxAvtZViSPM/c3eGwcJpk1q5s/K6BY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746465722; c=relaxed/simple; bh=vgHTlJQRacq+TzrUS+sg6FacEG9md2wy+yPqz/81Ejg=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=d9oD+lP3QxO7MK+XP+Y62DupDPLgO1s4Sbwgcl5b3WWZ2sSKbdk0hAsfFG2FQHrexcRi/LSz6RcossS8quayvoA3wbNevbzp+nCtPL7TgjP9myxTULgrXfD05zqNsPB6ohorTS3em6WgEVXr8+AvnRhjIG+QL2xXcK0HhpG87g8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 79D873858406 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBzVx-0005vT-MJ; Mon, 05 May 2025 13:22:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=z/xmPD6e/H9cD0GejE0dvymtCh5X2tr/2PQatwc2WbA=; b=UaRp203VaZ3a rW+9zlc1IkANS0bT2btniXdsgJ5bBOxP+51ztVHRVJcxIQZC0UwFilcP5pr8N13jfQQBvY18/r+rV TDzcpTOTVCWkL336NjfTVbsB4c2K47+hMS9KmfrEPaSSCA+FNiNvm83+KeSSaqxR0m0qeU9knmheS tzyIQs+CZe6tPryAuR7HUTQrea5tejubqRGIIpljkq/o1yLcHdt2IqdSkgtj5DL43lQXEl99z44Pz uiLOUPT8dM3t/kFUi6NbpK+5kGkOrnCiUjOxOBlH3dHY2ZBDz5LJum306eSW7cL7dt/UCZVgN/zd6 iYjnfbonnhNQuYb1BXJPuQ==; Date: Mon, 05 May 2025 20:21:59 +0300 Message-Id: <86ikmfgeh4.fsf@gnu.org> From: Eli Zaretskii To: Tankut Baris Aktemur Cc: gdb-patches@sourceware.org, guinevere@redhat.com, pedro@palves.net In-Reply-To: (message from Tankut Baris Aktemur on Mon, 5 May 2025 18:19:31 +0200) Subject: Re: [PATCH v4 3/3] gdb: add '-stopped' and '-running' options to "info threads" References: 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: Tankut Baris Aktemur > Cc: guinevere@redhat.com, > eliz@gnu.org, > pedro@palves.net > Date: Mon, 5 May 2025 18:19:31 +0200 > > Add two options to "info threads": `-stopped` and `-running`. > > The purpose of these options is to filter the output of the command. > The `-stopped` option means "print stopped threads only" and, > similarly, `-running` means "print the running threads only". When > both options are provided by the user, the indication is that the user > wants the union. That is, the output contains both stopped and > running threads. > > Suppose we have an application with 5 threads, 2 of which have hit a > breakpoint. The "info threads" command in the non-stop mode gives: > > (gdb) info threads > Id Target Id Frame > * 1 Thread 0x7ffff7d99740 (running) > 2 Thread 0x7ffff7d98700 something () at file.c:30 > 3 Thread 0x7ffff7597700 (running) > 4 Thread 0x7ffff6d96700 something () at file.c:30 > 5 Thread 0x7ffff6595700 (running) > (gdb) > > Using the "-stopped" flag, we get > > (gdb) info threads -stopped > Id Target Id Frame > 2 Thread 0x7ffff7d98700 something () at file.c:30 > 4 Thread 0x7ffff6d96700 something () at file.c:30 > (gdb) > > Using the "-running" flag, we get > > (gdb) info threads -running > Id Target Id Frame > * 1 Thread 0x7ffff7d99740 (running) > 3 Thread 0x7ffff7597700 (running) > 5 Thread 0x7ffff6595700 (running) > (gdb) > > Using both flags prints all: > > (gdb) info threads -stopped -running > Id Target Id Frame > * 1 Thread 0x7ffff7d99740 (running) > 2 Thread 0x7ffff7d98700 something () at file.c:30 > 3 Thread 0x7ffff7597700 (running) > 4 Thread 0x7ffff6d96700 something () at file.c:30 > 5 Thread 0x7ffff6595700 (running) > (gdb) > > When combined with a thread ID, filtering applies to those threads that > are matched by the ID. > > (gdb) info threads 3 > Id Target Id Frame > 3 Thread 0x7ffff7597700 (running) > (gdb) info threads -stopped 3 > No threads matched. > (gdb) > > Regression-tested on X86_64 Linux. > > Reviewed-By: Guinevere Larsen > --- > gdb/NEWS | 11 +- > gdb/doc/gdb.texinfo | 10 +- > gdb/testsuite/gdb.base/options.exp | 16 ++- > .../gdb.threads/info-threads-options.c | 77 ++++++++++ > .../gdb.threads/info-threads-options.exp | 131 ++++++++++++++++++ > gdb/thread.c | 41 ++++-- > 6 files changed, 272 insertions(+), 14 deletions(-) > create mode 100644 gdb/testsuite/gdb.threads/info-threads-options.c > create mode 100644 gdb/testsuite/gdb.threads/info-threads-options.exp Thanks. The documentation parts are okay, but my suggestion is to drop the part that talks about "union": it adds nothing useful to the description. IOW, this: If you specify both options, @value{GDBN} prints both stopped and running threads. is enough and tells the whole story. Reviewed-By: Eli Zaretskii