Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Oct 2015 21:36:54 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288902 - head/sys/kern
Message-ID:  <201510052136.t95Las90013244@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Mon Oct  5 21:36:53 2015
New Revision: 288902
URL: https://svnweb.freebsd.org/changeset/base/288902

Log:
  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.
  
  MFC after:	1 week

Modified:
  head/sys/kern/sys_process.c

Modified: head/sys/kern/sys_process.c
==============================================================================
--- head/sys/kern/sys_process.c	Mon Oct  5 21:29:17 2015	(r288901)
+++ head/sys/kern/sys_process.c	Mon Oct  5 21:36:53 2015	(r288902)
@@ -928,25 +928,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;
@@ -969,11 +973,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;
 			p->p_stops = 0;
 
@@ -1226,10 +1231,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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510052136.t95Las90013244>