aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/ptrace.h
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2004-07-12 05:07:50 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2004-07-12 05:07:50 +0000
commitfbc3247d816a6c4c77324fdbd4e9188abc46aabe (patch)
tree354f543bfcbe27c384ccc9ed5c1d36a3fc6a26d1 /sys/sys/ptrace.h
parent98c151d6d952b5bc9e0142eb5d08b9e18d661b99 (diff)
downloadsrc-fbc3247d816a6c4c77324fdbd4e9188abc46aabe.tar.gz
src-fbc3247d816a6c4c77324fdbd4e9188abc46aabe.zip
Implement the PT_LWPINFO request. This request can be used by the
tracing process to obtain information about the LWP that caused the traced process to stop. Debuggers can use this information to select the thread currently running on the LWP as the current thread. The request has been made compatible with NetBSD for as much as possible. This implementation differs from NetBSD in the following ways: 1. The data argument is allowed to be smaller than the size of the ptrace_lwpinfo structure known to the kernel, but not 0. This is opposite to what NetBSD allows. The reason for this is that we can extend the structure without affecting older binaries. 2. On NetBSD the tracing process is to set the pl_lwpid field to the Id of the LWP it wants information of. We don't do that. Our ptrace interface allows passing the LWP Id instead of the PID. The tracing process is to set the PID to the LWP Id it wants information of. 3. When the PID is actually the PID of the tracing process, this request returns the information about the LWP that caused the process to stop. This was the whole purpose of the request in the first place. When the traced process has exited, this request will return the LWP Id 0, indicating that the process state is not the result of an event specific to a LWP.
Notes
Notes: svn path=/head/; revision=132016
Diffstat (limited to 'sys/sys/ptrace.h')
-rw-r--r--sys/sys/ptrace.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h
index c849eb6fc195..03ff33c13ce6 100644
--- a/sys/sys/ptrace.h
+++ b/sys/sys/ptrace.h
@@ -47,6 +47,7 @@
#define PT_ATTACH 10 /* trace some running process */
#define PT_DETACH 11 /* stop tracing a process */
#define PT_IO 12 /* do I/O to/from stopped process. */
+#define PT_LWPINFO 13 /* Info about the LWP that stopped. */
#define PT_TO_SCE 20
#define PT_TO_SCX 21
@@ -77,6 +78,14 @@ struct ptrace_io_desc {
#define PIOD_READ_I 3 /* Read from I space */
#define PIOD_WRITE_I 4 /* Write to I space */
+/* Argument structure for PT_LWPINFO. */
+struct ptrace_lwpinfo {
+ lwpid_t pl_lwpid; /* LWP described. */
+ int pl_event; /* Event that stopped the LWP. */
+#define PL_EVENT_NONE 0
+#define PL_EVENT_SIGNAL 1
+};
+
#ifdef _KERNEL
#define PTRACESTOP_SC(p, td, flag) \