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.yanku...@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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to