Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>,
	Eli Zaretskii <eliz@gnu.org>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH 3/3] gdb: add a '-stopped' option to "info threads"
Date: Thu, 24 Apr 2025 15:50:42 +0100	[thread overview]
Message-ID: <53eb1690-487c-4bdb-ac33-a32e986d7509@palves.net> (raw)
In-Reply-To: <DM4PR11MB7303076CBB2C683A81352102C4909@DM4PR11MB7303.namprd11.prod.outlook.com>

Hi!

On 2023-04-05 12:31, Aktemur, Tankut Baris via Gdb-patches wrote:
> On Wednesday, April 5, 2023 12:51 PM, Eli Zaretskii wrote:
>>> From: "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
>>> Date: Wed, 5 Apr 2023 10:19:26 +0000
>>>
>>> I'm fine if we make the single thread id a special case.
>>
>> Maybe that's all we should do.
>>
>>> But then the question is, where do we draw the line?  If the user
>>> gave just a few thread ids, do we still ignore the flag?  What is
>>> the limit to the acceptable list length?  Because of these
>>> questions, consistently applying the flag made more sense to me.
>>
>> We don't have to be 100% consistent, we just need to be useful.
> 
> Let's please wait a bit in case other maintainers want to chime in.
> I don't have an objection to treating the single thread id case specially.

I don't think we should give single ID any special treatment.  It's as you say,
what about "info thread 1 2 ", does that get an exception because it
is two single IDs?  Why would that be different from "info threads 1-2" ?
What if I put the IDs in a convenience variable, and then do:

 (gdb) eval "info threads -stopped %s", $id

Why should my script behave differently depending on what is saved in $id?

Etc.

BTW, the same rationale should apply to "thread apply".  "info threads" and "thread apply"
have basically the same logic and also share options.  IMO, we should have a matching "thread apply -stopped" too.

And with "thread apply", it is even clearer IMO that "thread apply $ID -stopped print foo" should not
every try to run "print foo" on a not-stopped thread!  From the fact that "info threads" and "thread apply"
should walk the same threads given the same options, it follows that "info threads -stopped" should not walk
any non-stopped thread.

I'll look at later revisions of the series now.  Thanks for doing this.  We had talked about it a while ago but
I hadn't realized you had sent it upstream.  Thanks!

Pedro Alves


  parent reply	other threads:[~2025-04-24 14:52 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05  9:19 [PATCH 0/3] Option to show stopped threads only Tankut Baris Aktemur via Gdb-patches
2023-04-05  9:20 ` [PATCH 1/3] gdb: pass info_threads_opts to print_thread_info_1 Tankut Baris Aktemur via Gdb-patches
2023-04-05  9:20 ` [PATCH 2/3] gdb, doc: add the missing '-gid' option to 'info threads' Tankut Baris Aktemur via Gdb-patches
2023-04-05  9:56   ` Eli Zaretskii via Gdb-patches
2023-04-05 10:12     ` Aktemur, Tankut Baris via Gdb-patches
2023-04-05  9:20 ` [PATCH 3/3] gdb: add a '-stopped' option to "info threads" Tankut Baris Aktemur via Gdb-patches
2023-04-05 10:00   ` Eli Zaretskii via Gdb-patches
2023-04-05 10:19     ` Aktemur, Tankut Baris via Gdb-patches
2023-04-05 10:50       ` Eli Zaretskii via Gdb-patches
2023-04-05 11:31         ` Aktemur, Tankut Baris via Gdb-patches
2023-04-05 11:56           ` Eli Zaretskii via Gdb-patches
2025-04-24 14:50           ` Pedro Alves [this message]
2025-03-18 18:04 ` [PATCH v2 0/2] Option to show stopped threads only Tankut Baris Aktemur
2025-03-18 18:05   ` [PATCH v2 1/2] gdb: pass info_threads_opts to print_thread_info_1 Tankut Baris Aktemur
2025-03-18 18:05   ` [PATCH v2 2/2] gdb: add a '-stopped' option to "info threads" Tankut Baris Aktemur
2025-03-28 16:38   ` [PATCH v2 0/2] Option to show stopped threads only Guinevere Larsen
2025-04-04 13:39     ` Aktemur, Tankut Baris
2025-04-04 13:36 ` [PATCH v3 " Tankut Baris Aktemur
2025-04-04 13:36   ` [PATCH v3 1/2] gdb: pass info_threads_opts to print_thread_info_1 Tankut Baris Aktemur
2025-04-24 18:09     ` Pedro Alves
2025-04-04 13:36   ` [PATCH v3 2/2] gdb: add a '-stopped' option to "info threads" Tankut Baris Aktemur
2025-04-24 19:23     ` Pedro Alves
2025-05-05 16:17       ` Aktemur, Tankut Baris
2025-04-23  8:00   ` [PATCH v3 0/2] Option to show stopped threads only Aktemur, Tankut Baris
2025-04-24 17:53   ` Pedro Alves
2025-05-05 16:19   ` [PATCH v4 0/3] Option to show stopped/running " Tankut Baris Aktemur
2025-05-05 16:19     ` [PATCH v4 1/3] gdb: pass info_threads_opts to print_thread_info_1 Tankut Baris Aktemur
2025-05-05 16:19     ` [PATCH v4 2/3] gdb: update "info threads" output when no threads match the arguments Tankut Baris Aktemur
2025-05-05 17:19       ` Eli Zaretskii
2025-05-05 16:19     ` [PATCH v4 3/3] gdb: add '-stopped' and '-running' options to "info threads" Tankut Baris Aktemur
2025-05-05 17:21       ` Eli Zaretskii
2025-05-09 20:54     ` [PATCH v4 0/3] Option to show stopped/running threads only Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53eb1690-487c-4bdb-ac33-a32e986d7509@palves.net \
    --to=pedro@palves.net \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tankut.baris.aktemur@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox