Index: sys/kern/subr_syscall.c =================================================================== --- sys/kern/subr_syscall.c +++ sys/kern/subr_syscall.c @@ -68,6 +68,7 @@ PROC_LOCK(p); td->td_dbgflags &= ~TDB_USERWR; td->td_dbgflags |= TDB_SCE; + td->td_dbgsa = sa; PROC_UNLOCK(p); } else traced = 0; @@ -157,6 +158,7 @@ if (traced) { PROC_LOCK(p); td->td_dbgflags &= ~TDB_SCE; + td->td_dbgsa = NULL; PROC_UNLOCK(p); } (p->p_sysent->sv_set_syscall_retval)(td, error); @@ -164,7 +166,7 @@ } static inline void -syscallret(struct thread *td, int error, struct syscall_args *sa __unused) +syscallret(struct thread *td, int error, struct syscall_args *sa) { struct proc *p, *p2; int traced; @@ -188,6 +190,7 @@ traced = 1; PROC_LOCK(p); td->td_dbgflags |= TDB_SCX; + td->td_dbgsa = sa; PROC_UNLOCK(p); } else traced = 0; @@ -210,6 +213,7 @@ (p->p_stops & S_PT_SCX) != 0)) ptracestop(td, SIGTRAP); td->td_dbgflags &= ~(TDB_SCX | TDB_EXEC | TDB_FORK); + td->td_dbgsa = NULL; PROC_UNLOCK(p); } Index: sys/kern/sys_process.c =================================================================== --- sys/kern/sys_process.c +++ sys/kern/sys_process.c @@ -97,6 +97,8 @@ struct siginfo32 pl_siginfo; /* siginfo for signal */ char pl_tdname[MAXCOMLEN + 1]; /* LWP name. */ int pl_child_pid; /* New child pid */ + u_int pl_syscall_code; + int pl_syscall_narg; }; #endif @@ -481,6 +483,8 @@ siginfo_to_siginfo32(&pl->pl_siginfo, &pl32->pl_siginfo); strcpy(pl32->pl_tdname, pl->pl_tdname); pl32->pl_child_pid = pl->pl_child_pid; + pl32->pl_syscall_code = pl->pl_syscall_code; + pl32->pl_syscall_narg = pl->pl_syscall_narg; } #endif /* COMPAT_FREEBSD32 */ @@ -1211,6 +1215,13 @@ pl->pl_sigmask = td2->td_sigmask; pl->pl_siglist = td2->td_siglist; strcpy(pl->pl_tdname, td2->td_name); + if (td2->td_dbgsa != NULL) { + pl->pl_syscall_code = td2->td_dbgsa->code; + pl->pl_syscall_narg = td2->td_dbgsa->narg; + } else { + pl->pl_syscall_code = 0; + pl->pl_syscall_narg = 0; + } #ifdef COMPAT_FREEBSD32 if (wrap32) ptrace_lwpinfo_to32(pl, pl32); Index: sys/sys/proc.h =================================================================== --- sys/sys/proc.h +++ sys/sys/proc.h @@ -174,6 +174,7 @@ struct racct; struct sbuf; struct sleepqueue; +struct syscall_args; struct td_sched; struct thread; struct trapframe; @@ -282,6 +283,7 @@ int td_no_sleeping; /* (k) Sleeping disabled count. */ int td_dom_rr_idx; /* (k) RR Numa domain selection. */ void *td_su; /* (k) FFS SU private */ + struct syscall_args *td_dbgsa; /* (c) Debugger system call state. */ #define td_endzero td_sigmask /* Copied during fork1() or create_thread(). */ @@ -979,7 +981,6 @@ void cpu_exit(struct thread *); void exit1(struct thread *, int, int) __dead2; -struct syscall_args; int cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa); void cpu_fork(struct thread *, struct proc *, struct thread *, int); void cpu_set_fork_handler(struct thread *, void (*)(void *), void *); Index: sys/sys/ptrace.h =================================================================== --- sys/sys/ptrace.h +++ sys/sys/ptrace.h @@ -113,6 +113,8 @@ struct __siginfo pl_siginfo; /* siginfo for signal */ char pl_tdname[MAXCOMLEN + 1]; /* LWP name */ int pl_child_pid; /* New child pid */ + u_int pl_syscall_code; + int pl_syscall_narg; }; /* Argument structure for PT_VM_ENTRY. */