summaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2022-04-21 14:20:36 +0100
committerPedro Alves <pedro@palves.net>2022-04-29 12:33:27 +0100
commitd51926f06a7f4854bebdd71dcb0a78dbaa2f4168 (patch)
treeaeeb243c5da413dc2dc2b3c8d539e7f65471312b /gdb/target.c
parent8a2ef851861706a113a080a1ff3d91c81449704d (diff)
Slightly tweak and clarify target_resume's interface
The current target_resume interface is a bit odd & non-intuitive. I've found myself explaining it a couple times the recent past, while reviewing patches that assumed STEP/SIGNAL always applied to the passed in PTID. It goes like this today: - if the passed in PTID is a thread, then the step/signal request is for that thread. - otherwise, if PTID is a wildcard (all threads or all threads of process), the step/signal request is for inferior_ptid, and PTID indicates which set of threads run free. Because GDB always switches the current thread to "leader" thread being resumed/stepped/signalled, we can simplify this a bit to: - step/signal are always for inferior_ptid. - PTID indicates the set of threads that run free. Still not ideal, but it's a minimal change and at least there are no special cases this way. That's what this patch does. It renames the PTID parameter to SCOPE_PTID, adds some assertions to target_resume, and tweaks target_resume's description. In addition, it also renames PTID to SCOPE_PTID in the remote and linux-nat targets, and simplifies their implementation a little bit. Other targets could do the same, but they don't have to. Change-Id: I02a2ec2ab3a3e9b191de1e9a84f55c17cab7daaf
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 7d291fd4d0..1063f8086b 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -2655,21 +2655,24 @@ target_thread_info_to_thread_handle (struct thread_info *tip)
}
void
-target_resume (ptid_t ptid, int step, enum gdb_signal signal)
+target_resume (ptid_t scope_ptid, int step, enum gdb_signal signal)
{
process_stratum_target *curr_target = current_inferior ()->process_target ();
gdb_assert (!curr_target->commit_resumed_state);
+ gdb_assert (inferior_ptid != null_ptid);
+ gdb_assert (inferior_ptid.matches (scope_ptid));
+
target_dcache_invalidate ();
- current_inferior ()->top_target ()->resume (ptid, step, signal);
+ current_inferior ()->top_target ()->resume (scope_ptid, step, signal);
- registers_changed_ptid (curr_target, ptid);
+ registers_changed_ptid (curr_target, scope_ptid);
/* We only set the internal executing state here. The user/frontend
running state is set at a higher level. This also clears the
thread's stop_pc as side effect. */
- set_executing (curr_target, ptid, true);
- clear_inline_frame_state (curr_target, ptid);
+ set_executing (curr_target, scope_ptid, true);
+ clear_inline_frame_state (curr_target, scope_ptid);
if (target_can_async_p ())
target_async (1);