Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 May 2010 21:32:38 +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: r208555 - head/sys/kern
Message-ID:  <201005252132.o4PLWcB3043574@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Tue May 25 21:32:37 2010
New Revision: 208555
URL: http://svn.freebsd.org/changeset/base/208555

Log:
  Ignore the 'addr' argument passed to PT_STEP (it is required to be '1'
  for PT_STEP which means "ignore") and PT_DETACH.
  
  PR:		kern/146167
  MFC after:	1 week

Modified:
  head/sys/kern/sys_process.c

Modified: head/sys/kern/sys_process.c
==============================================================================
--- head/sys/kern/sys_process.c	Tue May 25 21:20:56 2010	(r208554)
+++ head/sys/kern/sys_process.c	Tue May 25 21:32:37 2010	(r208555)
@@ -899,24 +899,29 @@ kern_ptrace(struct thread *td, int req, 
 			if (error)
 				goto out;
 			break;
+		case PT_CONTINUE:
 		case PT_TO_SCE:
-			p->p_stops |= S_PT_SCE;
-			break;
 		case PT_TO_SCX:
-			p->p_stops |= S_PT_SCX;
-			break;
 		case PT_SYSCALL:
-			p->p_stops |= S_PT_SCE | S_PT_SCX;
-			break;
-		}
-
-		if (addr != (void *)1) {
-			error = ptrace_set_pc(td2, (u_long)(uintfptr_t)addr);
-			if (error)
+			if (addr != (void *)1) {
+				error = ptrace_set_pc(td2,
+				    (u_long)(uintfptr_t)addr);
+				if (error)
+					goto out;
+			}
+			switch (req) {
+			case PT_TO_SCE:
+				p->p_stops |= S_PT_SCE;
 				break;
-		}
-
-		if (req == PT_DETACH) {
+			case PT_TO_SCX:
+				p->p_stops |= S_PT_SCX;
+				break;
+			case PT_SYSCALL:
+				p->p_stops |= S_PT_SCE | S_PT_SCX;
+				break;
+			}
+			break;
+		case PT_DETACH:
 			/* reset process parent */
 			if (p->p_oppid != p->p_pptr->p_pid) {
 				struct proc *pp;
@@ -941,6 +946,7 @@ kern_ptrace(struct thread *td, int req, 
 
 			/* should we send SIGCHLD? */
 			/* childproc_continued(p); */
+			break;
 		}
 
 	sendsig:



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