summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2015-10-23 01:27:44 +0000
committerjhb <jhb@FreeBSD.org>2015-10-23 01:27:44 +0000
commite25ab6846b2221872ca3abfa3c560b07b4afad9a (patch)
tree2210ab7fe1a3b71f90eb6a5150125774d10210ca /lib
parenta372d7e311087ffe7087caf4f637bdcea03e8dd6 (diff)
downloadFreeBSD-src-e25ab6846b2221872ca3abfa3c560b07b4afad9a.zip
FreeBSD-src-e25ab6846b2221872ca3abfa3c560b07b4afad9a.tar.gz
MFC 287386,288949,288993:
Export current system call code and argument count for system call entry and exit events. To preserve the ABI, the new fields are moved to the end of struct thread in these branches (unlike HEAD) and explicitly copied when new threads are created. In addition, the new tests are only added in 10. r287386: Export current system call code and argument count for system call entry and exit events. procfs stop events for system call tracing report these values (argument count for system call entry and code for system call exit), but ptrace() does not provide this information. (Note that while the system call code can be determined in an ABI-specific manner during system call entry, it is not generally available during system call exit.) The values are exported via new fields at the end of struct ptrace_lwpinfo available via PT_LWPINFO. r288949: Fix various edge cases related to system call tracing. - Always set td_dbg_sc_* when P_TRACED is set on system call entry even if the debugger is not tracing system call entries. This ensures the fields are valid when reporting other stops that occur at system call boundaries such as for PT_FOLLOW_FORKS or when only tracing system call exits. - Set TDB_SCX when reporting the stop for a new child process in fork_return(). This causes the event to be reported as a system call exit. - Report a system call exit event in fork_return() for new threads in a traced process. - Copy td_dbg_sc_* to new threads instead of zeroing. This ensures that td_dbg_sc_code in particular will report the system call that created the new thread or process when it reports a system call exit event in fork_return(). - Add new ptrace tests to verify that new child processes and threads report system call exit events with a valid pl_syscall_code via PT_LWPINFO. r288993: Document the recently added pl_syscall_* fields in struct ptrace_lwpinfo.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/sys/ptrace.225
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2
index 71b432f..5c93438 100644
--- a/lib/libc/sys/ptrace.2
+++ b/lib/libc/sys/ptrace.2
@@ -2,7 +2,7 @@
.\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
.\"
.\" This file is in the public domain.
-.Dd July 3, 2015
+.Dd October 6, 2015
.Dt PTRACE 2
.Os
.Sh NAME
@@ -307,6 +307,8 @@ struct ptrace_lwpinfo {
siginfo_t pl_siginfo;
char pl_tdname[MAXCOMLEN + 1];
int pl_child_pid;
+ u_int pl_syscall_code;
+ u_int pl_syscall_narg;
};
.Ed
.Pp
@@ -395,6 +397,27 @@ stop when
.Dv PL_FLAG_FORKED
is set in
.Va pl_flags .
+.It pl_syscall_code
+The ABI-specific identifier of the current system call.
+Note that for indirect system calls this field reports the indirected
+system call.
+Only valid when
+.Dv PL_FLAG_SCE
+or
+.Dv PL_FLAG_SCX
+is set in
+.Va pl_flags.
+.It pl_syscall_narg
+The number of arguments passed to the current system call not counting
+the system call identifier.
+Note that for indirect system calls this field reports the arguments
+passed to the indirected system call.
+Only valid when
+.Dv PL_FLAG_SCE
+or
+.Dv PL_FLAG_SCX
+is set in
+.Va pl_flags.
.El
.It PT_GETNUMLWPS
This request returns the number of kernel threads associated with the
OpenPOWER on IntegriCloud