public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb: Fix missing first breakpoint in schedule-multiple mode
@ 2022-07-25 16:22 Ciaran Woodward
  2022-07-25 17:02 ` Simon Marchi
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Ciaran Woodward @ 2022-07-25 16:22 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-09-22 13:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25 16:22 [PATCH] gdb: Fix missing first breakpoint in schedule-multiple mode 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 ` [PING 4][PATCH] " Ciaran Woodward

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).