pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lldb-netbsd: Initialize threads in tracee launch



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Sat Dec 24 02:54:24 2016 +0100
Changeset:	853bddaee755fa719bf920f03aa6b145b4ea8728

Modified Files:
	lldb-netbsd/distinfo
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp

Log Message:
lldb-netbsd: Initialize threads in tracee launch

NetBSD can iterate all tracee's threads with PT_LWPINFO.
All of them report to NativeProcessProtocol.

It's unclear how to handle Current Thread, for now set it to the first lwp.

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=853bddaee755fa719bf920f03aa6b145b4ea8728

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 lldb-netbsd/distinfo                               |  2 +-
 ..._Plugins_Process_NetBSD_NativeProcessNetBSD.cpp | 29 ++++++++++++++++------
 2 files changed, 23 insertions(+), 8 deletions(-)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 2189906..621e877 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -27,7 +27,7 @@ SHA1 (patch-source_Plugins_Platform_NetBSD_PlatformNetBSD.cpp) = 129e853c1f93f06
 SHA1 (patch-source_Plugins_Platform_NetBSD_PlatformNetBSD.h) = 4327a21e79378b8f35adb07614adb41c37bbaf61
 SHA1 (patch-source_Plugins_Process_CMakeLists.txt) = c0168f81da56d9896eb414e6b8bb7262de04ac33
 SHA1 (patch-source_Plugins_Process_NetBSD_CMakeLists.txt) = df17afdf71c29d945c887e318718904793cd48ad
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = a2383087de29e239e97a8816a5f2ff16372ad98c
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 5dfcb33b2d3ddaec708ed7dbfc17ce747e65a684
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = f31a6c671d648f49a67e515706492420dcd75027
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = 05b1accced8403da0a70114c0f4b01faf570340c
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = f6217d48ba65babe63a56b2def14cc8099ca7c5d
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
index 70ae410..71dc316 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
@@ -2,7 +2,7 @@ $NetBSD$
 
 --- source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp.orig	2016-12-23 23:19:01.279655164 +0000
 +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
-@@ -0,0 +1,1637 @@
+@@ -0,0 +1,1652 @@
 +//===-- NativeProcessNetBSD.cpp -------------------------------- -*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -364,14 +364,29 @@ $NetBSD$
 +                uint64_t(pid));
 +
 +  ResolveProcessArchitecture(m_pid, m_arch);
-+#if 0
-+  NativeThreadNetBSDSP thread_sp = AddThread(pid);
-+  assert(thread_sp && "AddThread() returned a nullptr thread");
-+  thread_sp->SetStoppedBySignal(SIGSTOP);
 +
-+  // Let our process instance know the thread has stopped.
++  /* Initialize threads */
++  struct ptrace_lwpinfo info = {};
++  error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
++  if (error.Fail()) {
++    SetState(StateType::eStateInvalid);
++    return error;
++  }
++  NativeThreadNetBSDSP thread_sp = AddThread(info.pl_lwpid);
++  assert(thread_sp && "AddThread() returned a nullptr thread");
++  /* It's unclear which thread is current - the first one? */
 +  SetCurrentThreadID(thread_sp->GetID());
-+#endif
++
++  while (info.pl_lwpid != 0) {
++    error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
++    if (error.Fail()) {
++      SetState(StateType::eStateInvalid);
++      return error;
++    }
++    AddThread(info.pl_lwpid);
++  }
++
++  /* Set process stopped */
 +  SetState(StateType::eStateStopped);
 +
 +  if (log) {


Home | Main Index | Thread Index | Old Index