[PATCH v4 24/44] gdb: allow resuming an inferior with no threads
Markus Metzger <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
When resuming an inferior without threads and schedule-multiple, we may
end up resuming threads of other inferiors in all-stop mode. Clear their
proceed status so we do not report the same event again.
Also, simplify clear_proceed_status () by collapsing the all-stop and
non-stop cases. In non-stop, user_visible_resume_ptid () returns
inferior_ptid, so iterating over all non-exited threads matching that ptid
in all-stop mode matches calling clear_proceed_status_thread () for
inferior_thread () in non-stop mode.
---
gdb/infrun.c | 39 ++++++++++++++++++---------------------
1 file changed, 18 insertions(+), 21 deletions(-)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index c0767e7f764..ce7c376af14 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3173,32 +3173,29 @@ clear_proceed_status (int step, bool about_to_proceed)
&& !target_record_will_replay (inferior_ptid, execution_direction))
target_record_stop_replaying ();
- if (!non_stop && inferior_ptid != null_ptid)
- {
- ptid_t resume_ptid = user_visible_resume_ptid (step);
- process_stratum_target *resume_target
- = user_visible_resume_target (resume_ptid);
+ ptid_t resume_ptid = user_visible_resume_ptid (step);
+ process_stratum_target *resume_target
+ = user_visible_resume_target (resume_ptid);
- /* In all-stop mode, delete the per-thread status of all threads
- we're about to resume, implicitly and explicitly. */
- for (thread_info &tp : all_non_exited_threads (resume_target, resume_ptid))
- if (tp.internal_state () != THREAD_INT_RUNNING)
- clear_proceed_status_thread (&tp);
- }
+ if (resume_ptid == null_ptid)
+ return;
- if (inferior_ptid != null_ptid)
+ /* Delete the per-thread status of all threads we're about to resume,
+ implicitly and explicitly. */
+ for (thread_info &tp : all_non_exited_threads (resume_target, resume_ptid))
+ if (tp.internal_state () != THREAD_INT_RUNNING)
+ clear_proceed_status_thread (&tp);
+
+ for (inferior *inf : all_non_exited_inferiors (resume_target))
{
- struct inferior *inferior;
+ if (!inf->has_execution ())
+ continue;
- if (non_stop)
- {
- /* If in non-stop mode, only delete the per-thread status of
- the current thread. */
- clear_proceed_status_thread (inferior_thread ());
- }
+ ptid_t ptid { inf->pid };
+ if (!ptid.matches (resume_ptid))
+ continue;
- inferior = current_inferior ();
- inferior->control.stop_soon = NO_STOP_QUIETLY;
+ inf->control.stop_soon = NO_STOP_QUIETLY;
}
if (about_to_proceed)
--
2.43.0
________________________________________
Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 (89) 99143-0
www.intel.de
Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman
Chairperson of the Supervisory Board: Sonja Pierer
Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.