summaryrefslogtreecommitdiff
path: root/gdb/target.h
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.h
parent8a2ef851861706a113a080a1ff3d91c81449704d (diff)
downloadbinutils-gdb-d51926f06a7f4854bebdd71dcb0a78dbaa2f4168.tar.gz
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.h')
-rw-r--r--gdb/target.h31
1 files changed, 20 insertions, 11 deletions
diff --git a/gdb/target.h b/gdb/target.h
index 093178af0bc..f77dbf05113 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1471,23 +1471,32 @@ extern void target_detach (inferior *inf, int from_tty);
extern void target_disconnect (const char *, int);
-/* Resume execution (or prepare for execution) of a target thread,
- process or all processes. STEP says whether to hardware
- single-step or to run free; SIGGNAL is the signal to be given to
- the target, or GDB_SIGNAL_0 for no signal. The caller may not pass
- GDB_SIGNAL_DEFAULT. A specific PTID means `step/resume only this
- process id'. A wildcard PTID (all threads, or all threads of
- process) means `step/resume INFERIOR_PTID, and let other threads
- (for which the wildcard PTID matches) resume with their
- 'thread->suspend.stop_signal' signal (usually GDB_SIGNAL_0) if it
- is in "pass" state, or with no signal if in "no pass" state.
+/* Resume execution (or prepare for execution) of the current thread
+ (INFERIOR_PTID), while optionally letting other threads of the
+ current process or all processes run free.
+
+ STEP says whether to hardware single-step the current thread or to
+ let it run free; SIGNAL is the signal to be given to the current
+ thread, or GDB_SIGNAL_0 for no signal. The caller may not pass
+ GDB_SIGNAL_DEFAULT.
+
+ SCOPE_PTID indicates the resumption scope. I.e., which threads
+ (other than the current) run free. If resuming a single thread,
+ SCOPE_PTID is the same thread as the current thread. A wildcard
+ SCOPE_PTID (all threads, or all threads of process) lets threads
+ other than the current (for which the wildcard SCOPE_PTID matches)
+ resume with their 'thread->suspend.stop_signal' signal (usually
+ GDB_SIGNAL_0) if it is in "pass" state, or with no signal if in "no
+ pass" state. Note neither STEP nor SIGNAL apply to any thread
+ other than the current.
In order to efficiently handle batches of resumption requests,
targets may implement this method such that it records the
resumption request, but defers the actual resumption to the
target_commit_resume method implementation. See
target_commit_resume below. */
-extern void target_resume (ptid_t ptid, int step, enum gdb_signal signal);
+extern void target_resume (ptid_t scope_ptid,
+ int step, enum gdb_signal signal);
/* Ensure that all resumed threads are committed to the target.