Added new entries:
ptrace(2): Add new options in EVENT_MASK: PTRACE_LWP_CREATE and
PTRACE_LWP_EXIT
siginfo(2): Add new si_code for SIGTRAP: TRAP_LWP
Sponsored by <The NetBSD Foundation>
Add interface in ptrace(2) to track thread (LWP) events:
- birth,
- termination.
The purpose of this thread is to keep track of the current thread state in
a tracee and apply e.g. per-thread designed hardware assisted watchpoints.
This interface reuses the EVENT_MASK and PROCESS_STATE interface, and
shares it with PTRACE_FORK, PTRACE_VFORK and PTRACE_VFORK_DONE.
Change the following structure:
typedef struct ptrace_state {
int pe_report_event;
pid_t pe_other_pid;
} ptrace_state_t;
to
typedef struct ptrace_state {
int pe_report_event;
union {
pid_t _pe_other_pid;
lwpid_t _pe_lwp;
} _option;
} ptrace_state_t;
#define pe_other_pid _option._pe_other_pid
#define pe_lwp _option._pe_lwp
This keeps size of ptrace_state_t unchanged as both pid_t and lwpid_t are
defined as int32_t-like integer. This change does not break existing
prebuilt software and has minimal effect on necessity for source-code
changes. In summary, this change should be binary compatible and shouldn't
break build of existing software.
Introduce new siginfo(5) type for LWP events under the SIGTRAP signal:
TRAP_LWP. This change will help debuggers to distinguish exact source of
SIGTRAP.
Add two basic t_ptrace_wait* tests:
lwp_create1:
Verify that 1 LWP creation is intercepted by ptrace(2) with
EVENT_MASK set to PTRACE_LWP_CREATE
lwp_exit1:
Verify that 1 LWP creation is intercepted by ptrace(2) with
EVENT_MASK set to PTRACE_LWP_EXIT
All tests are passing.
Surfing the previous kernel ABI bump to 7.99.59 for PTRACE_VFORK{,_DONE}.
Sponsored by <The NetBSD Foundation>
eventmask3:
Verify that PTRACE_VFORK in EVENT_MASK is preserved
eventmask4:
Verify that PTRACE_VFORK_DONE in EVENT_MASK is preserved
Currently eventmask3 is failing and marked with PR kern/51630
Sponsored by <The NetBSD Foundation>
Removed:
- evaluate equivalent for PTRACE_O_TRACECLONE from Linux
clone(2)-like calls are traced with PTRACE_FORK, PTRACE_VFORK and
PTRACE_VFORK_DONE. VFORK ones block parent till termination or execve(2) of
its child.
Added:
- add proper implementation of PTRACE_VFORK for vfork(2)-like events
Currently PTRACE_VFORK is a stub.
Sponsored by <The NetBSD Foundation>
PTRACE_VFORK - report vfork(2)-like operations and trace child
PTRACE_VFORK_DONE - report unblocking the parent after vfork(2)-like call
Note that PTRACE_VFORK is currently unimplemented and returns ENOTSUP.
Sponsored by <The NetBSD Foundation>
PTRACE_VFORK and PTRACE_VFORK_DONE are now parts of <sys/ptrace.h>.
PTRACE_VFORK tests are still failing as the support for it is currently
a stub.
Sponsored by <The NetBSD Foundation>
PTRACE_VFORK is supposed to be used to track vfork(2)-like events, when
parent gives birth to new process child and stops till it exits or calls
exec().
Currently PTRACE_VFORK is a stub.
PTRACE_VFORK_DONE is notification to notify a debugger that a parent has
resumed after vfork(2)-like action.
PTRACE_VFORK_DONE throws SIGTRAP with TRAP_CHLD.
Sponsored by <The NetBSD Foundation>