Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_syscall.c
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | #endif | ||||
if (error == 0) { | if (error == 0) { | ||||
STOPEVENT(p, S_SCE, sa->narg); | STOPEVENT(p, S_SCE, sa->narg); | ||||
if (p->p_flag & P_TRACED) { | if (p->p_flag & P_TRACED) { | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
td->td_dbg_sc_code = sa->code; | td->td_dbg_sc_code = sa->code; | ||||
td->td_dbg_sc_narg = sa->narg; | td->td_dbg_sc_narg = sa->narg; | ||||
if (p->p_ptevents & PTRACE_SCE) | if (p->p_ptevents & PTRACE_SCE) | ||||
ptracestop((td), SIGTRAP); | ptracestop((td), SIGTRAP, NULL); | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
} | } | ||||
if (td->td_dbgflags & TDB_USERWR) { | if (td->td_dbgflags & TDB_USERWR) { | ||||
/* | /* | ||||
* Reread syscall number and arguments if | * Reread syscall number and arguments if | ||||
* debugger modified registers or memory. | * debugger modified registers or memory. | ||||
*/ | */ | ||||
error = (p->p_sysent->sv_fetch_syscall_args)(td, sa); | error = (p->p_sysent->sv_fetch_syscall_args)(td, sa); | ||||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | if (traced || (td->td_dbgflags & (TDB_EXEC | TDB_FORK)) != 0) { | ||||
* If tracing the execed process, trap to the debugger | * If tracing the execed process, trap to the debugger | ||||
* so that breakpoints can be set before the program | * so that breakpoints can be set before the program | ||||
* executes. If debugger requested tracing of syscall | * executes. If debugger requested tracing of syscall | ||||
* returns, do it now too. | * returns, do it now too. | ||||
*/ | */ | ||||
if (traced && | if (traced && | ||||
((td->td_dbgflags & (TDB_FORK | TDB_EXEC)) != 0 || | ((td->td_dbgflags & (TDB_FORK | TDB_EXEC)) != 0 || | ||||
(p->p_ptevents & PTRACE_SCX) != 0)) | (p->p_ptevents & PTRACE_SCX) != 0)) | ||||
ptracestop(td, SIGTRAP); | ptracestop(td, SIGTRAP, NULL); | ||||
td->td_dbgflags &= ~(TDB_SCX | TDB_EXEC | TDB_FORK); | td->td_dbgflags &= ~(TDB_SCX | TDB_EXEC | TDB_FORK); | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
} | } | ||||
if (td->td_pflags & TDP_RFPPWAIT) { | if (td->td_pflags & TDP_RFPPWAIT) { | ||||
/* | /* | ||||
* Preserve synchronization semantics of vfork. If | * Preserve synchronization semantics of vfork. If | ||||
* waiting for child to exec or exit, fork set | * waiting for child to exec or exit, fork set | ||||
Show All 20 Lines | while (p2->p_flag & P_PPWAIT) { | ||||
} | } | ||||
cv_timedwait(&p2->p_pwait, &p2->p_mtx, hz); | cv_timedwait(&p2->p_pwait, &p2->p_mtx, hz); | ||||
} | } | ||||
PROC_UNLOCK(p2); | PROC_UNLOCK(p2); | ||||
if (td->td_dbgflags & TDB_VFORK) { | if (td->td_dbgflags & TDB_VFORK) { | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
if (p->p_ptevents & PTRACE_VFORK) | if (p->p_ptevents & PTRACE_VFORK) | ||||
ptracestop(td, SIGTRAP); | ptracestop(td, SIGTRAP, NULL); | ||||
td->td_dbgflags &= ~TDB_VFORK; | td->td_dbgflags &= ~TDB_VFORK; | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
} | } | ||||
} | } | ||||
} | } |