public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Ciaran Woodward <ciaranwoodward@xmos.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [PING 4][PATCH] gdb: Fix missing first breakpoint in schedule-multiple mode
Date: Thu, 22 Sep 2022 13:22:56 +0000	[thread overview]
Message-ID: <DU0PR09MB604616D56ADC057FA051894DB94E9@DU0PR09MB6046.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <20220725162231.4473-1-ciaranwoodward@xmos.com>

Hi,

Ping 4 - this (or something similar) is required for working with multiple inferiors on a remote if you connect to the remote while the inferiors are already running. There is a reproduction description here: https://sourceware.org/pipermail/gdb-patches/2022-July/191092.html

Please let me know if there is anything else I should do to help move this along.

Cheers,
Ciaran

> -----Original Message-----
> From: Ciaran Woodward <ciaranwoodward@xmos.com>
> Sent: 25 July 2022 17:23
> To: gdb-patches@sourceware.org
> Cc: Ciaran Woodward <ciaranwoodward@xmos.com>
> Subject: [PATCH] gdb: Fix missing first breakpoint in schedule-multiple
> mode
> 
> Rationale/background:
> When using schedule-multiple (sched_multi) in gdb, all inferiors
> are set to continue when the c command is used. However, before
> this patch, only the 'current' inferior would have its
> control->stop_soon field cleared. This field causes certain stops
> to be ignored, and is only intended for initial attach.
> 
> By not clearing this field before continue, continuing with inferior 2
> in focus and with inferior 1 hitting the next breakpoint, would cause
> gdb to ignore the breakpoint and any attempt to stop the target with
> Ctrl-C following that - even though the target was already stopped.
> The only fix was to quit GDB and restart.
> 
> Solution:
> With this patch, all inferiors being resumed have their
> control->stop_soon fields cleared, so gdb does not ignore the
> breakpoints of any inferior inadvertently.
> ---
>  gdb/infrun.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index 543cccc5311..894157ed1d1 100644
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -2808,18 +2808,18 @@ clear_proceed_status (int step)
>  	 we're about to resume, implicitly and explicitly.  */
>        for (thread_info *tp : all_non_exited_threads (resume_target,
> resume_ptid))
>  	clear_proceed_status_thread (tp);
> +
> +      for(struct inferior* inferior :
> all_non_exited_inferiors(resume_target))
> +        inferior->control.stop_soon = NO_STOP_QUIETLY;
>      }
> 
> -  if (inferior_ptid != null_ptid)
> +  if (non_stop && inferior_ptid != null_ptid)
>      {
>        struct inferior *inferior;
> 
> -      if (non_stop)
> -	{
> -	  /* If in non-stop mode, only delete the per-thread status of
> -	     the current thread.  */
> -	  clear_proceed_status_thread (inferior_thread ());
> -	}
> +      /* If in non-stop mode, only delete the per-thread status of
> +         the current thread.  */
> +      clear_proceed_status_thread (inferior_thread ());
> 
>        inferior = current_inferior ();
>        inferior->control.stop_soon = NO_STOP_QUIETLY;
> --
> 2.25.1


      parent reply	other threads:[~2022-09-22 13:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 16:22 [PATCH] " Ciaran Woodward
2022-07-25 17:02 ` Simon Marchi
2022-07-26 13:16   ` Ciaran Woodward
2022-08-09 15:00 ` [PING] " Ciaran Woodward
2022-08-23 16:30 ` [PING 2][PATCH] " Ciaran Woodward
2022-08-31 10:11 ` [PING 3][PATCH] " Ciaran Woodward
2022-09-22 13:22 ` Ciaran Woodward [this message]

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=DU0PR09MB604616D56ADC057FA051894DB94E9@DU0PR09MB6046.eurprd09.prod.outlook.com \
    --to=ciaranwoodward@xmos.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).