Author: jhb
Date: Fri Nov  6 16:57:23 2015
New Revision: 290456
URL: https://svnweb.freebsd.org/changeset/base/290456

Log:
  MFC 288902:
  Include additional info in ptrace(2) KTR traces:
  - The new PC value and signal passed to PT_CONTINUE, PT_DETACH, PT_SYSCALL,
    and PT_TO_SC[EX].
  - The system call code returned via PT_LWPINFO.

Modified:
  stable/9/sys/kern/sys_process.c
Directory Properties:
  stable/9/sys/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sys/kern/sys_process.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/9/sys/kern/sys_process.c
==============================================================================
--- stable/9/sys/kern/sys_process.c     Fri Nov  6 16:54:17 2015        
(r290455)
+++ stable/9/sys/kern/sys_process.c     Fri Nov  6 16:57:23 2015        
(r290456)
@@ -930,25 +930,29 @@ kern_ptrace(struct thread *td, int req, 
                        switch (req) {
                        case PT_TO_SCE:
                                p->p_stops |= S_PT_SCE;
-                               CTR2(KTR_PTRACE,
-                                   "PT_TO_SCE: pid %d, stops = %#x", p->p_pid,
-                                   p->p_stops);
+                               CTR4(KTR_PTRACE,
+                   "PT_TO_SCE: pid %d, stops = %#x, PC = %#lx, sig = %d",
+                                   p->p_pid, p->p_stops,
+                                   (u_long)(uintfptr_t)addr, data);
                                break;
                        case PT_TO_SCX:
                                p->p_stops |= S_PT_SCX;
-                               CTR2(KTR_PTRACE,
-                                   "PT_TO_SCX: pid %d, stops = %#x", p->p_pid,
-                                   p->p_stops);
+                               CTR4(KTR_PTRACE,
+                   "PT_TO_SCX: pid %d, stops = %#x, PC = %#lx, sig = %d",
+                                   p->p_pid, p->p_stops,
+                                   (u_long)(uintfptr_t)addr, data);
                                break;
                        case PT_SYSCALL:
                                p->p_stops |= S_PT_SCE | S_PT_SCX;
-                               CTR2(KTR_PTRACE,
-                                   "PT_SYSCALL: pid %d, stops = %#x", p->p_pid,
-                                   p->p_stops);
+                               CTR4(KTR_PTRACE,
+                   "PT_SYSCALL: pid %d, stops = %#x, PC = %#lx, sig = %d",
+                                   p->p_pid, p->p_stops,
+                                   (u_long)(uintfptr_t)addr, data);
                                break;
                        case PT_CONTINUE:
-                               CTR1(KTR_PTRACE,
-                                   "PT_CONTINUE: pid %d", p->p_pid);
+                               CTR3(KTR_PTRACE,
+                                   "PT_CONTINUE: pid %d, PC = %#lx, sig = %d",
+                                   p->p_pid, (u_long)(uintfptr_t)addr, data);
                                break;
                        }
                        break;
@@ -971,11 +975,12 @@ kern_ptrace(struct thread *td, int req, 
                                proc_reparent(p, pp);
                                if (pp == initproc)
                                        p->p_sigparent = SIGCHLD;
-                               CTR2(KTR_PTRACE,
-                                   "PT_DETACH: pid %d reparented to pid %d",
-                                   p->p_pid, pp->p_pid);
+                               CTR3(KTR_PTRACE,
+                           "PT_DETACH: pid %d reparented to pid %d, sig %d",
+                                   p->p_pid, pp->p_pid, data);
                        } else
-                               CTR1(KTR_PTRACE, "PT_DETACH: pid %d", p->p_pid);
+                               CTR2(KTR_PTRACE, "PT_DETACH: pid %d, sig %d",
+                                   p->p_pid, data);
                        p->p_oppid = 0;
 
                        /* should we send SIGCHLD? */
@@ -1227,10 +1232,10 @@ kern_ptrace(struct thread *td, int req, 
                if (wrap32)
                        ptrace_lwpinfo_to32(pl, pl32);
 #endif
-               CTR5(KTR_PTRACE,
-           "PT_LWPINFO: tid %d (pid %d) event %d flags %#x child pid %d",
+               CTR6(KTR_PTRACE,
+    "PT_LWPINFO: tid %d (pid %d) event %d flags %#x child pid %d syscall %d",
                    td2->td_tid, p->p_pid, pl->pl_event, pl->pl_flags,
-                   pl->pl_child_pid);
+                   pl->pl_child_pid, pl->pl_syscall_code);
                break;
 
        case PT_GETNUMLWPS:
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to