pkgsrc-WIP-changes archive

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

lldb-netbsd: NativeProcessNetBSD::MonitorCallback() for NetBSD



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Wed Dec 21 17:55:07 2016 +0100
Changeset:	08661026df4a48ae013e4b3f8b8268c87cd53dd1

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

Log Message:
lldb-netbsd: NativeProcessNetBSD::MonitorCallback() for NetBSD

In Linux threads are like plain processes, unlike on NetBSD. Try to handle the
NetBSD case correctly.

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=08661026df4a48ae013e4b3f8b8268c87cd53dd1

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 | 74 ++++++++--------------
 2 files changed, 28 insertions(+), 48 deletions(-)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 76a5546..aa1f818 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) = 1503f291e0b679d301db74a81557a1f61a2953e8
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 9b8b88ee302646cd8bf2008e9be7b818bc1933f7
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = 3b15e8b5c4240846dbe1a5ef38b02da0c1299a85
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = a36d09154a2f1d795700aaa56c78120fc91794c0
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = a2510080812c538a2c65a7237bfe029d4e55b77d
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 d226e86..fe0aabf 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-21 15:47:29.499519618 +0000
 +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
-@@ -0,0 +1,1786 @@
+@@ -0,0 +1,1766 @@
 +//===-- NativeProcessNetBSD.cpp -------------------------------- -*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -445,67 +445,47 @@ $NetBSD$
 +                                         int signal, int status) {
 +  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
 +
-+  // Certain activities differ based on whether the pid is the tid of the main
-+  // thread.
-+  const bool is_main_thread = (pid == GetID());
-+
 +  // Handle when the thread exits.
 +  if (exited) {
 +    if (log)
 +      log->Printf(
-+          "NativeProcessNetBSD::%s() got exit signal(%d) , tid = %" PRIu64
-+          " (%s main thread)",
-+          __FUNCTION__, signal, pid, is_main_thread ? "is" : "is not");
++          "NativeProcessNetBSD::%s() got exit signal(%d) , pid = %d",
++          __FUNCTION__, signal, pid);
 +
 +    // This is a thread that exited.  Ensure we're not tracking it anymore.
 +    const bool thread_found = StopTrackingThread(pid);
 +
-+    if (is_main_thread) {
-+      // We only set the exit status and notify the delegate if we haven't
-+      // already set the process
-+      // state to an exited state.  We normally should have received a SIGTRAP |
-+      // (PTRACE_EVENT_EXIT << 8)
-+      // for the main thread.
-+      const bool already_notified = (GetState() == StateType::eStateExited) ||
++    // We only set the exit status and notify the delegate if we haven't
++    // already set the process
++    // state to an exited state.  We normally should have received a SIGTRAP |
++    // (PTRACE_EVENT_EXIT << 8)
++    // for the main thread.
++    const bool already_notified = (GetState() == StateType::eStateExited) ||
 +                                    (GetState() == StateType::eStateCrashed);
-+      if (!already_notified) {
-+        if (log)
-+          log->Printf("NativeProcessNetBSD::%s() tid = %" PRIu64
-+                      " handling main thread exit (%s), expected exit state "
-+                      "already set but state was %s instead, setting exit "
-+                      "state now",
-+                      __FUNCTION__, pid,
-+                      thread_found ? "stopped tracking thread metadata"
-+                                   : "thread metadata not found",
-+                      StateAsCString(GetState()));
-+        // The main thread exited.  We're done monitoring.  Report to delegate.
-+        SetExitStatus(convert_pid_status_to_exit_type(status),
-+                      convert_pid_status_to_return_code(status), nullptr, true);
-+
-+        // Notify delegate that our process has exited.
-+        SetState(StateType::eStateExited, true);
-+      } else {
-+        if (log)
-+          log->Printf("NativeProcessNetBSD::%s() tid = %" PRIu64
-+                      " main thread now exited (%s)",
-+                      __FUNCTION__, pid,
-+                      thread_found ? "stopped tracking thread metadata"
-+                                   : "thread metadata not found");
-+      }
++    if (!already_notified) {
++      if (log)
++        log->Printf("NativeProcessNetBSD::%s() pid = %d"
++                    " handling main thread exit (%s), expected exit state "
++                    "already set but state was %s instead, setting exit "
++                    "state now",
++                    __FUNCTION__, pid,
++                    thread_found ? "stopped tracking thread metadata"
++                                 : "thread metadata not found",
++                    StateAsCString(GetState()));
++      // The main thread exited.  We're done monitoring.  Report to delegate.
++      SetExitStatus(convert_pid_status_to_exit_type(status),
++                    convert_pid_status_to_return_code(status), nullptr, true);
++
++      // Notify delegate that our process has exited.
++      SetState(StateType::eStateExited, true);
 +    } else {
-+      // Do we want to report to the delegate in this case?  I think not.  If
-+      // this was an orderly
-+      // thread exit, we would already have received the SIGTRAP |
-+      // (PTRACE_EVENT_EXIT << 8) signal,
-+      // and we would have done an all-stop then.
 +      if (log)
-+        log->Printf("NativeProcessNetBSD::%s() tid = %" PRIu64
-+                    " handling non-main thread exit (%s)",
++        log->Printf("NativeProcessNetBSD::%s() pid = %d"
++                    " main thread now exited (%s)",
 +                    __FUNCTION__, pid,
 +                    thread_found ? "stopped tracking thread metadata"
 +                                 : "thread metadata not found");
 +    }
-+    return;
 +  }
 +}
 +


Home | Main Index | Thread Index | Old Index