pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lldb-netbsd: Adapt NativeProcessNetBSD::SigchldHandler() for NetBSD
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Wed Dec 21 17:40:05 2016 +0100
Changeset: 5a5e04c2a427d23d1c52230a4692422559e6b805
Modified Files:
lldb-netbsd/distinfo
lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
Log Message:
lldb-netbsd: Adapt NativeProcessNetBSD::SigchldHandler() 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=5a5e04c2a427d23d1c52230a4692422559e6b805
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 | 86 +++++++++++-----------
2 files changed, 42 insertions(+), 46 deletions(-)
diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index b3a34a8..76a5546 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) = 7d0ffde884d5f1e2fa2940c82df8338bb890aa2f
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 1503f291e0b679d301db74a81557a1f61a2953e8
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 62d5908..d226e86 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,1790 @@
+@@ -0,0 +1,1786 @@
+//===-- NativeProcessNetBSD.cpp -------------------------------- -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
@@ -1693,56 +1693,52 @@ $NetBSD$
+void NativeProcessNetBSD::SigchldHandler() {
+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+ // Process all pending waitpid notifications.
-+ while (true) {
-+ int status = -1;
-+ ::pid_t wait_pid = waitpid(-1, &status, WALLSIG | WNOHANG);
++ int status;
++ ::pid_t wait_pid = waitpid(WAIT_ANY, &status, WALLSIG | WNOHANG);
+
-+ if (wait_pid == 0)
-+ break; // We are done.
++ if (wait_pid == 0)
++ return; // We are done.
+
-+ if (wait_pid == -1) {
-+ if (errno == EINTR)
-+ continue;
++ if (wait_pid == -1) {
++ if (errno == EINTR)
++ return;
+
-+ Error error(errno, eErrorTypePOSIX);
-+ if (log)
-+ log->Printf("NativeProcessNetBSD::%s waitpid (-1, &status, WALLSIG | "
-+ "WNOHANG) failed: %s",
-+ __FUNCTION__, error.AsCString());
-+ break;
-+ }
++ Error error(errno, eErrorTypePOSIX);
++ if (log)
++ log->Printf("NativeProcessNetBSD::%s waitpid (WAIT_ANY, &status, "
++ "WALLSIG | WNOHANG) failed: %s", __FUNCTION__,
++ error.AsCString());
++ }
+
-+ bool exited = false;
-+ int signal = 0;
-+ int exit_status = 0;
-+ const char *status_cstr = nullptr;
-+ if (WIFSTOPPED(status)) {
-+ signal = WSTOPSIG(status);
-+ status_cstr = "STOPPED";
-+ } else if (WIFEXITED(status)) {
-+ exit_status = WEXITSTATUS(status);
-+ status_cstr = "EXITED";
++ bool exited = false;
++ int signal = 0;
++ int exit_status = 0;
++ const char *status_cstr = nullptr;
++ if (WIFSTOPPED(status)) {
++ signal = WSTOPSIG(status);
++ status_cstr = "STOPPED";
++ } else if (WIFEXITED(status)) {
++ exit_status = WEXITSTATUS(status);
++ status_cstr = "EXITED";
++ exited = true;
++ } else if (WIFSIGNALED(status)) {
++ signal = WTERMSIG(status);
++ status_cstr = "SIGNALED";
++ if (wait_pid == static_cast<::pid_t>(GetID())) {
+ exited = true;
-+ } else if (WIFSIGNALED(status)) {
-+ signal = WTERMSIG(status);
-+ status_cstr = "SIGNALED";
-+ if (wait_pid == static_cast<::pid_t>(GetID())) {
-+ exited = true;
-+ exit_status = -1;
-+ }
-+ } else
-+ status_cstr = "(\?\?\?)";
++ exit_status = -1;
++ }
++ } else
++ status_cstr = "(\?\?\?)";
+
-+ if (log)
-+ log->Printf("NativeProcessNetBSD::%s: waitpid (-1, &status, WALLSIG | "
-+ "WNOHANG)"
-+ "=> pid = %" PRIi32
-+ ", status = 0x%8.8x (%s), signal = %i, exit_state = %i",
-+ __FUNCTION__, wait_pid, status, status_cstr, signal,
-+ exit_status);
-+
-+ MonitorCallback(wait_pid, exited, signal, exit_status);
-+ }
++ if (log)
++ log->Printf("NativeProcessNetBSD::%s: waitpid (WAIT_ANY, &status, "
++ "WALLSIG | WNOHANG) => pid = %" PRIi32
++ ", status = 0x%8.8x (%s), signal = %i, exit_state = %i",
++ __FUNCTION__, wait_pid, status, status_cstr, signal,
++ exit_status);
++
++ MonitorCallback(wait_pid, exited, signal, exit_status);
+}
+
+// Wrapper for ptrace to catch errors and log calls.
Home |
Main Index |
Thread Index |
Old Index