Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jun 2018 21:15:05 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335505 - head/sys/compat/linux
Message-ID:  <201806212115.w5LLF5Mj057047@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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);



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