Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] gdb: share some thread proceed related code between CLI and MI
Date: Fri, 07 Aug 2026 16:31:06 +0100	[thread overview]
Message-ID: <87ik5mkkw5.fsf@redhat.com> (raw)
In-Reply-To: <c90dcb58-d602-4845-8991-963702e3cc78@suse.de>

Tom de Vries <tdevries@suse.de> writes:

> On 8/6/26 10:54 PM, Andrew Burgess wrote:
>> +	  if (inf == nullptr)
>> +	    proceed_all_threads ();
>> +	  else
>> +	    {
>> +	      for (thread_info &thread : inf->threads ())
>> +		proceed_one_thread (thread);
>>   	    }
>
> FWIW, also I wonder if it makes sense to fold this logic into 
> proceed_all_threads:

I took a look through all the other proceed() calls and couldn't see
anything else that might want to share this code, so my preference would
be to leave things as I initially proposed.  I like the simpler each
function has one clear goal, rather than overloading proceed_all_threads
with multiple meanings ("all threads", or "all threads in inferior").
Especially not a fan of default arguments for cases like this (or in
general much).

That said, if you consider this a blocker to merging this patch then I
don't feel that strongly against it so would make the change to get this
fix merged.

Just let me know.

Thanks,
Andrew


> ...
> diff --git a/gdb/infcmd.c b/gdb/infcmd.c
> index 23e93587874..d2301ddf093 100644
> --- a/gdb/infcmd.c
> +++ b/gdb/infcmd.c
> @@ -743,10 +743,18 @@ proceed_one_thread (thread_info &thread)
>   /* See inferior.h.  */
>
>   void
> -proceed_all_threads ()
> +proceed_all_threads (inferior *inf)
>   {
>     gdb_assert (non_stop);
>
> +  if (inf != nullptr)
> +    {
> +      for (thread_info &thread : inf->threads ())
> +	proceed_one_thread (thread);
> +
> +      return;
> +    }
> +
>     for (thread_info &thread : all_threads ())
>       {
>         /* We go through all threads individually instead of compressing
> diff --git a/gdb/inferior.h b/gdb/inferior.h
> index 8255654d9b8..2067f60ab7d 100644
> --- a/gdb/inferior.h
> +++ b/gdb/inferior.h
> @@ -230,7 +230,7 @@ extern void continue_1 (bool all_threads_p);
>   /* For use only when non_stop is true.  Proceed all threads in every
>      inferior.  */
>
> -extern void proceed_all_threads ();
> +extern void proceed_all_threads (inferior *inf = nullptr);
>
>   /* For use only when non_stop is true.  If THREAD is stopped, and is in an
>      inferior that has_execution then switch to THREAD, clear its proceed
> diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
> index e110b029e1e..1eb087b85db 100644
> --- a/gdb/mi/mi-main.c
> +++ b/gdb/mi/mi-main.c
> @@ -259,13 +259,7 @@ exec_continue (const char *const *argv, int argc)
>   	  if (!current_context->all)
>   	    inf = find_inferior_id (current_context->thread_group);
>
> -	  if (inf == nullptr)
> -	    proceed_all_threads ();
> -	  else
> -	    {
> -	      for (thread_info &thread : inf->threads ())
> -		proceed_one_thread (thread);
> -	    }
> +	  proceed_all_threads (inf);
>
>   	  disable_commit_resumed.reset_and_commit ();
>   	}
> ...
>
> Thanks,
> - Tom


  reply	other threads:[~2026-08-07 15:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06 20:53 [PATCH 0/2] Cleanup and bug fix related to thread iteration and proceed calls Andrew Burgess
2026-08-06 20:54 ` [PATCH 1/2] gdb: use inferior::threads instead of all_threads and a PID filter Andrew Burgess
2026-08-07  7:59   ` Tom de Vries
2026-08-06 20:54 ` [PATCH 2/2] gdb: share some thread proceed related code between CLI and MI Andrew Burgess
2026-08-07  9:20   ` Tom de Vries
2026-08-07 15:40     ` Andrew Burgess
2026-08-07 10:14   ` Tom de Vries
2026-08-07 15:31     ` Andrew Burgess [this message]
2026-08-07 16:52       ` Tom de Vries
2026-08-24 18:18         ` Andrew Burgess

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=87ik5mkkw5.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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