svn commit: r335505 - head/sys/compat/linux

Konstantin Belousov kib at FreeBSD.org
Thu Jun 21 21:15:06 UTC 2018


Author: kib
Date: Thu Jun 21 21:15:04 2018
New Revision: 335505
URL: https://svnweb.freebsd.org/changeset/base/335505

Log:
  linux_clone_thread: mark new thread as TDB_BORN.
  
  So that the ptrace code will catch it and report it to attached
  debugger.  Enables debugging of threaded Linux binaries with FreeBSD
  debugger.
  
  Submitted by:	Yanko Yankulov <yanko.yankulov at gmail.com>
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D15880

Modified:
  head/sys/compat/linux/linux_fork.c

Modified: head/sys/compat/linux/linux_fork.c
==============================================================================
--- head/sys/compat/linux/linux_fork.c	Thu Jun 21 21:12:49 2018	(r335504)
+++ head/sys/compat/linux/linux_fork.c	Thu Jun 21 21:15:04 2018	(r335505)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
+#include <sys/ptrace.h>
 #include <sys/racct.h>
 #include <sys/sched.h>
 #include <sys/syscallsubr.h>
@@ -352,6 +353,9 @@ linux_clone_thread(struct thread *td, struct linux_clo
 	thread_unlock(td);
 	if (P_SHOULDSTOP(p))
 		newtd->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK;
+	
+	if (p->p_ptevents & PTRACE_LWP)
+		newtd->td_dbgflags |= TDB_BORN;
 	PROC_UNLOCK(p);
 
 	tidhash_add(newtd);


More information about the svn-src-head mailing list