Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/sys/kern



Module Name:    src
Committed By:   kamil
Date:           Tue May  1 13:48:38 UTC 2018

Modified Files:
        src/sys/kern: kern_sig.c

Log Message:
Improve the proc_stoptrace() function

proc_stoptrace() is dedicated for emitting a syscall trap for a debugger,
either on entry or exit of the system function routine.

Changes:
 - Change an if() branch of an invalid condition of being traced by
   initproc (PID1) to KASSERT(9).
 - Assert that the current process has set appropriate flags (PSL_TRACED
   and PSL_SYSCALL).
 - Use ktrpoint(KTR_PSIG) and ktrpsig()/e_ktrpsig() in order to register
   the emitted signal for the ktrace(1) event debugging.

Example of the new output from kdump(1) for the syscall debugger traps,
containing SIGTRAP notification with TRAP_SCE and TRAP_SCX (around
the getpid(2) call).

$ kdump /tmp/1.dat.qemu |grep 663
   588      1 t_ptrace_waitpid RET   fork 663/0x297
   663      1 t_ptrace_waitpid EMUL  "netbsd"
   663      1 t_ptrace_waitpid RET   fork 0
   663      1 t_ptrace_waitpid CALL  ptrace(PT_TRACE_ME,0,0,0)
   663      1 t_ptrace_waitpid RET   ptrace 0
   663      1 t_ptrace_waitpid CALL  _lwp_self
   663      1 t_ptrace_waitpid RET   _lwp_self 1
   663      1 t_ptrace_waitpid CALL  _lwp_kill(1,0x11)
   663      1 t_ptrace_waitpid RET   _lwp_kill 0
   588      1 t_ptrace_waitpid RET   __wait450 663/0x297
   663      1 t_ptrace_waitpid CALL  getpid
   588      1 t_ptrace_waitpid RET   __wait450 663/0x297
   663      1 t_ptrace_waitpid PSIG  SIGTRAP SIG_DFL: code=TRAP_SCE, addr=0x0, trap=0)
   663      1 t_ptrace_waitpid RET   getpid 663/0x297, 588/0x24c
   588      1 t_ptrace_waitpid RET   __wait450 663/0x297
   663      1 t_ptrace_waitpid PSIG  SIGTRAP SIG_DFL: code=TRAP_SCX, addr=0x0, trap=0)
   663      1 t_ptrace_waitpid CALL  exit(5)
   588      1 t_ptrace_waitpid RET   __wait450 663/0x297

Sponsored by <The NetBSD Foundation>


To generate a diff of this commit:
cvs rdiff -u -r1.340 -r1.341 src/sys/kern/kern_sig.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index