pkgsrc-WIP-changes archive

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

lldb-git: Disable unbuildable code-fragments in the LinuxProcessPlugin/NetBSD



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Wed Dec 14 19:05:06 2016 +0100
Changeset:	e1ef012c16ab7729918ae367150b13bf0d77650b

Modified Files:
	lldb-git/Makefile
	lldb-git/distinfo
Added Files:
	lldb-git/patches/patch-include_lldb_Host_linux_Personality.h
	lldb-git/patches/patch-source_Plugins_Process_Linux_CMakeLists.txt
	lldb-git/patches/patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp
	lldb-git/patches/patch-source_Plugins_Process_Linux_NativeRegisterContextLinux.cpp
	lldb-git/patches/patch-source_Plugins_Process_Linux_NativeRegisterContextLinux__x86__64.cpp
	lldb-git/patches/patch-source_Plugins_Process_Linux_NativeThreadLinux.cpp
	lldb-git/patches/patch-source_Plugins_Process_Linux_NativeThreadLinux.h
	lldb-git/patches/patch-source_Plugins_Process_Linux_Procfs.h

Log Message:
lldb-git: Disable unbuildable code-fragments in the LinuxProcessPlugin/NetBSD

This is required to detect what parts are not portable and need to be abstracted.
The plugin itself will be transformed into common (shared) code.

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=e1ef012c16ab7729918ae367150b13bf0d77650b

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

diffstat:
 lldb-git/Makefile                                  |   7 +
 lldb-git/distinfo                                  |   8 +
 .../patch-include_lldb_Host_linux_Personality.h    |  19 ++
 ...tch-source_Plugins_Process_Linux_CMakeLists.txt |  16 ++
 ...ce_Plugins_Process_Linux_NativeProcessLinux.cpp | 278 +++++++++++++++++++++
 ...ns_Process_Linux_NativeRegisterContextLinux.cpp |  36 +++
 ...s_Linux_NativeRegisterContextLinux__x86__64.cpp |  26 ++
 ...rce_Plugins_Process_Linux_NativeThreadLinux.cpp | 123 +++++++++
 ...ource_Plugins_Process_Linux_NativeThreadLinux.h |  14 ++
 .../patch-source_Plugins_Process_Linux_Procfs.h    |  17 ++
 10 files changed, 544 insertions(+)

diffs:
diff --git a/lldb-git/Makefile b/lldb-git/Makefile
index 1ab1c9a..3a9208b 100644
--- a/lldb-git/Makefile
+++ b/lldb-git/Makefile
@@ -58,6 +58,13 @@ CMAKE_ARGS+=	-DLLDB_DISABLE_CURSES:BOOL=TRUE
 
 post-extract:
 	${RUN} mkdir -p ${WRKDIR}/build
+	# Temporary hack to nullify !amd64 platforms
+	# Required to port the process plugin from linux to NetBSD
+	# amd64/NetBSD goes first
+	${RM} ${WRKSRC}/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
+	${RM} ${WRKSRC}/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+	${RM} ${WRKSRC}/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp
+	${RM} ${WRKSRC}/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp
 
 .include "../../textproc/libxml2/buildlink3.mk"
 DEPENDS+=	llvm-${PKGVERSION_NOREV}{,nb*}:../../wip/llvm-git
diff --git a/lldb-git/distinfo b/lldb-git/distinfo
index 46df2e4..f8eb080 100644
--- a/lldb-git/distinfo
+++ b/lldb-git/distinfo
@@ -13,8 +13,16 @@ SHA1 (llvm-3.6.2.src.tar.xz) = 7a00257eb2bc9431e4c77c3a36b033072c54bc7e
 RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
 SHA1 (patch-cmake_LLDBDependencies.cmake) = c74b2e92695bd5e0ef2f6aca2b1157024c20e89e
+SHA1 (patch-include_lldb_Host_linux_Personality.h) = c9bb2773987b871c000043a9fd3ac143110f79a4
 SHA1 (patch-source_CMakeLists.txt) = d280b1a64b272c4bbdcdab838e69301eb17af732
 SHA1 (patch-source_Plugins_Process_CMakeLists.txt) = be993a6f54da5b09a44e0ca9e4dea96012e539d9
+SHA1 (patch-source_Plugins_Process_Linux_CMakeLists.txt) = a3b5431f8b52d04c838c3a12eaa1fd66cc521c68
+SHA1 (patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp) = 97e0338ef52ce243dda3875ec5e5c218ddff1929
+SHA1 (patch-source_Plugins_Process_Linux_NativeRegisterContextLinux.cpp) = 755cf9dce3aa8d1c32cff9fe3281a09f6d0e6c69
+SHA1 (patch-source_Plugins_Process_Linux_NativeRegisterContextLinux__x86__64.cpp) = f5219581c97d6179222e437122449673eac1cf59
+SHA1 (patch-source_Plugins_Process_Linux_NativeThreadLinux.cpp) = 7d72c5be16304bf2a2cd7b2441828c513e2e8160
+SHA1 (patch-source_Plugins_Process_Linux_NativeThreadLinux.h) = d3685ac9995b4b0c98a94c5a6b2383f386c3fff6
+SHA1 (patch-source_Plugins_Process_Linux_Procfs.h) = 9621cc9494a96d5d4c4fef06dcd9a85bd018f5a1
 SHA1 (patch-tools_lldb-mi_MICmnBase.cpp) = 851c82ac61e1241018755fbd7236af00379ac986
 SHA1 (patch-tools_lldb-mi_MICmnBase.h) = f550d5e10bcf02fb46472733acdbb820791f22e5
 SHA1 (patch-tools_lldb-mi_MIDriver.cpp) = bf1b5399e82bcfe54d6d852f64ed155328f2064d
diff --git a/lldb-git/patches/patch-include_lldb_Host_linux_Personality.h b/lldb-git/patches/patch-include_lldb_Host_linux_Personality.h
new file mode 100644
index 0000000..3bdda69
--- /dev/null
+++ b/lldb-git/patches/patch-include_lldb_Host_linux_Personality.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+--- include/lldb/Host/linux/Personality.h.orig	2016-12-14 14:10:24.000000000 +0000
++++ include/lldb/Host/linux/Personality.h
+@@ -12,6 +12,7 @@
+ #ifndef liblldb_Host_linux_Personality_h_
+ #define liblldb_Host_linux_Personality_h_
+ 
++#if !defined(__NetBSD__)
+ #ifdef __ANDROID__
+ #include <android/api-level.h>
+ #endif
+@@ -21,5 +22,6 @@
+ #else
+ #include <sys/personality.h>
+ #endif
++#endif
+ 
+ #endif // liblldb_Host_linux_Personality_h_
diff --git a/lldb-git/patches/patch-source_Plugins_Process_Linux_CMakeLists.txt b/lldb-git/patches/patch-source_Plugins_Process_Linux_CMakeLists.txt
new file mode 100644
index 0000000..5a4b3dc
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_Linux_CMakeLists.txt
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- source/Plugins/Process/Linux/CMakeLists.txt.orig	2016-05-01 10:39:36.000000000 +0000
++++ source/Plugins/Process/Linux/CMakeLists.txt
+@@ -5,11 +5,7 @@ include_directories(../Utility)
+ add_lldb_library(lldbPluginProcessLinux
+   NativeProcessLinux.cpp
+   NativeRegisterContextLinux.cpp
+-  NativeRegisterContextLinux_arm.cpp
+-  NativeRegisterContextLinux_arm64.cpp
+   NativeRegisterContextLinux_x86_64.cpp
+-  NativeRegisterContextLinux_mips64.cpp
+-  NativeRegisterContextLinux_s390x.cpp
+   NativeThreadLinux.cpp
+   ProcFileReader.cpp
+   SingleStepCheck.cpp
diff --git a/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp b/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp
new file mode 100644
index 0000000..d4fdb42
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp
@@ -0,0 +1,278 @@
+$NetBSD$
+
+--- source/Plugins/Process/Linux/NativeProcessLinux.cpp.orig	2016-12-14 14:10:24.000000000 +0000
++++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
+@@ -50,7 +50,9 @@
+ // System includes - They have to be included after framework includes because
+ // they define some
+ // macros which collide with variable names in other modules
++#if !defined(__NetBSD__)
+ #include <linux/unistd.h>
++#endif
+ #include <sys/socket.h>
+ 
+ #include <sys/syscall.h>
+@@ -74,6 +76,7 @@ using namespace llvm;
+ 
+ // Private bits we only need internally.
+ 
++#if !defined(__NetBSD__)
+ static bool ProcessVmReadvSupported() {
+   static bool is_supported;
+   static std::once_flag flag;
+@@ -107,6 +110,7 @@ static bool ProcessVmReadvSupported() {
+ 
+   return is_supported;
+ }
++#endif
+ 
+ namespace {
+ void MaybeLogLaunchInfo(const ProcessLaunchInfo &info) {
+@@ -155,6 +159,7 @@ void PtraceDisplayBytes(int &req, void *
+ 
+   if (verbose_log) {
+     switch (req) {
++#if !defined(__NetBSD__)
+     case PTRACE_POKETEXT: {
+       DisplayBytes(buf, &data, 8);
+       verbose_log->Printf("PTRACE_POKETEXT %s", buf.GetData());
+@@ -170,6 +175,7 @@ void PtraceDisplayBytes(int &req, void *
+       verbose_log->Printf("PTRACE_POKEUSER %s", buf.GetData());
+       break;
+     }
++#endif
+     case PTRACE_SETREGS: {
+       DisplayBytes(buf, data, data_size);
+       verbose_log->Printf("PTRACE_SETREGS %s", buf.GetData());
+@@ -180,6 +186,7 @@ void PtraceDisplayBytes(int &req, void *
+       verbose_log->Printf("PTRACE_SETFPREGS %s", buf.GetData());
+       break;
+     }
++#if !defined(__NetBSD__)
+     case PTRACE_SETSIGINFO: {
+       DisplayBytes(buf, data, sizeof(siginfo_t));
+       verbose_log->Printf("PTRACE_SETSIGINFO %s", buf.GetData());
+@@ -191,6 +198,7 @@ void PtraceDisplayBytes(int &req, void *
+       verbose_log->Printf("PTRACE_SETREGSET %s", buf.GetData());
+       break;
+     }
++#endif
+     default: {}
+     }
+   }
+@@ -224,6 +232,7 @@ static Error EnsureFDFlags(int fd, int f
+ // Public Static Methods
+ // -----------------------------------------------------------------------------
+ 
++#if !defined(__NetBSD__)
+ Error NativeProcessProtocol::Launch(
+     ProcessLaunchInfo &launch_info,
+     NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop,
+@@ -266,7 +275,9 @@ Error NativeProcessProtocol::Launch(
+ 
+   return error;
+ }
++#endif
+ 
++#if !defined(__NetBSD__)
+ Error NativeProcessProtocol::Attach(
+     lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate,
+     MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) {
+@@ -295,6 +306,7 @@ Error NativeProcessProtocol::Attach(
+   native_process_sp = native_process_linux_sp;
+   return error;
+ }
++#endif
+ 
+ // -----------------------------------------------------------------------------
+ // Public Instance Methods
+@@ -346,7 +358,11 @@ Error NativeProcessLinux::LaunchInferior
+   MaybeLogLaunchInfo(launch_info);
+ 
+   ::pid_t pid =
++#if !defined(__NetBSD__)
+       ProcessLauncherLinux().LaunchProcess(launch_info, error).GetProcessId();
++#else
++      0;
++#endif
+   if (error.Fail())
+     return error;
+ 
+@@ -458,7 +474,9 @@ Error NativeProcessLinux::LaunchInferior
+ 
+         // Attach to the requested process.
+         // An attach will cause the thread to stop with a SIGSTOP.
++#if !defined(__NetBSD__)
+         error = PtraceWrapper(PTRACE_ATTACH, tid);
++#endif
+         if (error.Fail()) {
+           // No such thread. The thread may have exited.
+           // More error handling may be needed.
+@@ -528,6 +546,7 @@ Error NativeProcessLinux::SetDefaultPtra
+ 
+   // Have the child raise an event on exit.  This is used to keep the child in
+   // limbo until it is destroyed.
++#if !defined(__NetBSD__)
+   ptrace_opts |= PTRACE_O_TRACEEXIT;
+ 
+   // Have the tracer trace threads which spawn in the inferior process.
+@@ -540,6 +559,7 @@ Error NativeProcessLinux::SetDefaultPtra
+   ptrace_opts |= PTRACE_O_TRACEEXEC;
+ 
+   return PtraceWrapper(PTRACE_SETOPTIONS, pid, nullptr, (void *)ptrace_opts);
++#endif
+ }
+ 
+ static ExitType convert_pid_status_to_exit_type(int status) {
+@@ -835,6 +855,7 @@ void NativeProcessLinux::MonitorSIGTRAP(
+ 
+   assert(info.si_signo == SIGTRAP && "Unexpected child signal!");
+ 
++#if !defined(__NetBSD__)
+   switch (info.si_code) {
+   // TODO: these two cases are required if we want to support tracing of the
+   // inferiors' children.  We'd need this to debug a monitor.
+@@ -1038,6 +1059,7 @@ void NativeProcessLinux::MonitorSIGTRAP(
+                   __FUNCTION__, GetID(), thread.GetID(), info.si_code);
+     break;
+   }
++#endif
+ }
+ 
+ void NativeProcessLinux::MonitorTrace(NativeThreadLinux &thread) {
+@@ -1110,6 +1132,7 @@ void NativeProcessLinux::MonitorSignal(c
+   //
+   // Similarly, ACK signals generated by this monitor.
+ 
++#if !defined(__NetBSD__)
+   // Handle the signal.
+   if (info.si_code == SI_TKILL || info.si_code == SI_USER) {
+     if (log)
+@@ -1194,6 +1217,7 @@ void NativeProcessLinux::MonitorSignal(c
+     // Done handling.
+     return;
+   }
++#endif
+ 
+   if (log)
+     log->Printf("NativeProcessLinux::%s() received signal %s", __FUNCTION__,
+@@ -2132,7 +2156,11 @@ NativeProcessLinux::GetCrashReasonForSIG
+ 
+ Error NativeProcessLinux::ReadMemory(lldb::addr_t addr, void *buf, size_t size,
+                                      size_t &bytes_read) {
++#if !defined(__NetBSD__)
+   if (ProcessVmReadvSupported()) {
++#else
++  {
++#endif
+     // The process_vm_readv path is about 50 times faster than ptrace api. We
+     // want to use
+     // this syscall if it is supported.
+@@ -2145,7 +2173,11 @@ Error NativeProcessLinux::ReadMemory(lld
+     remote_iov.iov_base = reinterpret_cast<void *>(addr);
+     remote_iov.iov_len = size;
+ 
++#if !defined(__NetBSD__)
+     bytes_read = process_vm_readv(pid, &local_iov, 1, &remote_iov, 1, 0);
++#else
++    bytes_read = 0;
++#endif
+     const bool success = bytes_read == size;
+ 
+     Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+@@ -2175,6 +2207,7 @@ Error NativeProcessLinux::ReadMemory(lld
+                 (void *)addr, buf, size);
+ 
+   for (bytes_read = 0; bytes_read < size; bytes_read += remainder) {
++#if !defined(__NetBSD__)
+     Error error = NativeProcessLinux::PtraceWrapper(
+         PTRACE_PEEKDATA, GetID(), (void *)addr, nullptr, 0, &data);
+     if (error.Fail()) {
+@@ -2182,6 +2215,7 @@ Error NativeProcessLinux::ReadMemory(lld
+         ProcessPOSIXLog::DecNestLevel();
+       return error;
+     }
++#endif
+ 
+     remainder = size - bytes_read;
+     remainder = remainder > k_ptrace_word_size ? k_ptrace_word_size : remainder;
+@@ -2248,6 +2282,7 @@ Error NativeProcessLinux::WriteMemory(ll
+         log->Printf("NativeProcessLinux::%s() [%p]:0x%lx (0x%lx)", __FUNCTION__,
+                     (void *)addr, *(const unsigned long *)src, data);
+ 
++#if !defined(__NetBSD__)
+       error = NativeProcessLinux::PtraceWrapper(PTRACE_POKEDATA, GetID(),
+                                                 (void *)addr, (void *)data);
+       if (error.Fail()) {
+@@ -2255,6 +2290,7 @@ Error NativeProcessLinux::WriteMemory(ll
+           ProcessPOSIXLog::DecNestLevel();
+         return error;
+       }
++#endif
+     } else {
+       unsigned char buff[8];
+       size_t bytes_read;
+@@ -2293,19 +2329,33 @@ Error NativeProcessLinux::WriteMemory(ll
+ }
+ 
+ Error NativeProcessLinux::GetSignalInfo(lldb::tid_t tid, void *siginfo) {
++#if !defined(__NetBSD__)
+   return PtraceWrapper(PTRACE_GETSIGINFO, tid, nullptr, siginfo);
++#else
++  Error error;
++  return error;
++#endif
+ }
+ 
+ Error NativeProcessLinux::GetEventMessage(lldb::tid_t tid,
+                                           unsigned long *message) {
++#if !defined(__NetBSD__)
+   return PtraceWrapper(PTRACE_GETEVENTMSG, tid, nullptr, message);
++#else
++  Error error;
++  return error;
++#endif
+ }
+ 
+ Error NativeProcessLinux::Detach(lldb::tid_t tid) {
+   if (tid == LLDB_INVALID_THREAD_ID)
+     return Error();
+-
++#if !defined(__NetBSD__)
+   return PtraceWrapper(PTRACE_DETACH, tid);
++#else
++  Error error;
++  return error;
++#endif
+ }
+ 
+ bool NativeProcessLinux::HasThreadNoLock(lldb::tid_t thread_id) {
+@@ -2649,7 +2699,11 @@ void NativeProcessLinux::SigchldHandler(
+   // Process all pending waitpid notifications.
+   while (true) {
+     int status = -1;
++#if !defined(__NetBSD__)
+     ::pid_t wait_pid = waitpid(-1, &status, __WALL | __WNOTHREAD | WNOHANG);
++#else
++    ::pid_t wait_pid = waitpid(-1, &status, /* __WALL | __WNOTHREAD | */ WNOHANG);
++#endif
+ 
+     if (wait_pid == 0)
+       break; // We are done.
+@@ -2713,12 +2767,16 @@ Error NativeProcessLinux::PtraceWrapper(
+   PtraceDisplayBytes(req, data, data_size);
+ 
+   errno = 0;
++#if !defined(__NetBSD__)
+   if (req == PTRACE_GETREGSET || req == PTRACE_SETREGSET)
+     ret = ptrace(static_cast<__ptrace_request>(req), static_cast<::pid_t>(pid),
+                  *(unsigned int *)addr, data);
+   else
+     ret = ptrace(static_cast<__ptrace_request>(req), static_cast<::pid_t>(pid),
+                  addr, data);
++#else
++  ret = 0;
++#endif
+ 
+   if (ret == -1)
+     error.SetErrorToErrno();
diff --git a/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeRegisterContextLinux.cpp b/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeRegisterContextLinux.cpp
new file mode 100644
index 0000000..b6ebac8
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeRegisterContextLinux.cpp
@@ -0,0 +1,36 @@
+$NetBSD$
+
+--- source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp.orig	2016-10-19 22:25:12.000000000 +0000
++++ source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
+@@ -163,6 +163,7 @@ Error NativeRegisterContextLinux::DoRead
+   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_REGISTERS));
+ 
+   long data;
++#if !defined(__NetBSD__)
+   Error error = NativeProcessLinux::PtraceWrapper(
+       PTRACE_PEEKUSER, m_thread.GetID(), reinterpret_cast<void *>(offset),
+       nullptr, 0, &data);
+@@ -170,6 +171,9 @@ Error NativeRegisterContextLinux::DoRead
+   if (error.Success())
+     // First cast to an unsigned of the same size to avoid sign extension.
+     value.SetUInt(static_cast<unsigned long>(data), size);
++#else
++  Error error;
++#endif
+ 
+   if (log)
+     log->Printf("NativeRegisterContextLinux::%s() reg %s: 0x%lx", __FUNCTION__,
+@@ -188,8 +192,13 @@ Error NativeRegisterContextLinux::DoWrit
+     log->Printf("NativeRegisterContextLinux::%s() reg %s: %p", __FUNCTION__,
+                 reg_name, buf);
+ 
++#if !defined(__NetBSD__)
+   return NativeProcessLinux::PtraceWrapper(
+       PTRACE_POKEUSER, m_thread.GetID(), reinterpret_cast<void *>(offset), buf);
++#else
++  Error error;
++  return error;
++#endif
+ }
+ 
+ Error NativeRegisterContextLinux::DoReadGPR(void *buf, size_t buf_size) {
diff --git a/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeRegisterContextLinux__x86__64.cpp b/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeRegisterContextLinux__x86__64.cpp
new file mode 100644
index 0000000..3e0a1be
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeRegisterContextLinux__x86__64.cpp
@@ -0,0 +1,26 @@
+$NetBSD$
+
+--- source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp.orig	2016-12-14 14:10:24.000000000 +0000
++++ source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
+@@ -20,7 +20,9 @@
+ #include "Plugins/Process/Utility/RegisterContextLinux_i386.h"
+ #include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h"
+ 
++#if !defined(__NetBSD__)
+ #include <linux/elf.h>
++#endif
+ 
+ using namespace lldb_private;
+ using namespace lldb_private::process_linux;
+@@ -223,7 +225,11 @@ static const RegisterSet g_reg_sets_x86_
+ // On x86_64 NT_PRFPREG is used to access the FXSAVE area. On i386, we need to
+ // use NT_PRXFPREG.
+ static inline unsigned int fxsr_regset(const ArchSpec &arch) {
++#if !defined(__NetBSD__)
+   return arch.GetAddressByteSize() == 8 ? NT_PRFPREG : NT_PRXFPREG;
++#else
++  return 0;
++#endif
+ }
+ 
+ // ----------------------------------------------------------------------------
diff --git a/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeThreadLinux.cpp b/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeThreadLinux.cpp
new file mode 100644
index 0000000..ee87079
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeThreadLinux.cpp
@@ -0,0 +1,123 @@
+$NetBSD$
+
+--- source/Plugins/Process/Linux/NativeThreadLinux.cpp.orig	2016-10-19 22:25:12.000000000 +0000
++++ source/Plugins/Process/Linux/NativeThreadLinux.cpp
+@@ -29,9 +29,13 @@
+ 
+ #include <sys/syscall.h>
+ // Try to define a macro to encapsulate the tgkill syscall
++#if !defined(__NetBSD__)
+ #define tgkill(pid, tid, sig)                                                  \
+   syscall(__NR_tgkill, static_cast<::pid_t>(pid), static_cast<::pid_t>(tid),   \
+           sig)
++#else
++#define tgkill(pid, tid, sig) 0
++#endif
+ 
+ using namespace lldb;
+ using namespace lldb_private;
+@@ -97,7 +101,11 @@ std::string NativeThreadLinux::GetName()
+   // const NativeProcessLinux *const process =
+   // reinterpret_cast<NativeProcessLinux*> (process_sp->get ());
+   llvm::SmallString<32> thread_name;
++#if !defined(__NetBSD__)
+   HostNativeThread::GetName(GetID(), thread_name);
++#else
++  // error: invalid conversion from 'lldb::tid_t {aka long unsigned int}' to 'lldb::thread_t {aka __pthread_st*}' [-fpermissive]
++#endif
+   return thread_name.c_str();
+ }
+ 
+@@ -216,8 +224,13 @@ Error NativeThreadLinux::Resume(uint32_t
+   if (signo != LLDB_INVALID_SIGNAL_NUMBER)
+     data = signo;
+ 
++#if !defined(__NetBSD__)
+   return NativeProcessLinux::PtraceWrapper(PTRACE_CONT, GetID(), nullptr,
+                                            reinterpret_cast<void *>(data));
++#else
++  Error error;
++  return error;
++#endif
+ }
+ 
+ void NativeThreadLinux::MaybePrepareSingleStepWorkaround() {
+@@ -226,6 +239,7 @@ void NativeThreadLinux::MaybePrepareSing
+ 
+   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
+ 
++#if !defined(__NetBSD__)
+   if (sched_getaffinity(static_cast<::pid_t>(m_tid), sizeof m_original_cpu_set,
+                         &m_original_cpu_set) != 0) {
+     // This should really not fail. But, just in case...
+@@ -253,12 +267,14 @@ void NativeThreadLinux::MaybePrepareSing
+         ": %s",
+         __FUNCTION__, m_tid, error.AsCString());
+   }
++#endif
+ }
+ 
+ void NativeThreadLinux::MaybeCleanupSingleStepWorkaround() {
+   if (!SingleStepWorkaroundNeeded())
+     return;
+ 
++#if !defined(__NetBSD__)
+   if (sched_setaffinity(static_cast<::pid_t>(m_tid), sizeof m_original_cpu_set,
+                         &m_original_cpu_set) != 0) {
+     Error error(errno, eErrorTypePOSIX);
+@@ -268,6 +284,7 @@ void NativeThreadLinux::MaybeCleanupSing
+         ": %s",
+         __FUNCTION__, m_tid, error.AsCString());
+   }
++#endif
+ }
+ 
+ Error NativeThreadLinux::SingleStep(uint32_t signo) {
+@@ -285,10 +302,15 @@ Error NativeThreadLinux::SingleStep(uint
+   // If hardware single-stepping is not supported, we just do a continue. The
+   // breakpoint on the
+   // next instruction has been setup in NativeProcessLinux::Resume.
++#if !defined(__NetBSD__)
+   return NativeProcessLinux::PtraceWrapper(
+       GetProcess().SupportHardwareSingleStepping() ? PTRACE_SINGLESTEP
+                                                    : PTRACE_CONT,
+       m_tid, nullptr, reinterpret_cast<void *>(data));
++#else
++  Error error;
++  return error;
++#endif
+ }
+ 
+ void NativeThreadLinux::SetStoppedBySignal(uint32_t signo,
+@@ -310,6 +332,7 @@ void NativeThreadLinux::SetStoppedBySign
+     case SIGBUS:
+     case SIGFPE:
+     case SIGILL:
++#if !defined(__NetBSD__)
+       // In case of MIPS64 target, SI_KERNEL is generated for invalid 64bit
+       // address.
+       const auto reason =
+@@ -317,6 +340,7 @@ void NativeThreadLinux::SetStoppedBySign
+               ? CrashReason::eInvalidAddress
+               : GetCrashReason(*info);
+       m_stop_description = GetCrashReasonString(reason, *info);
++#endif
+       break;
+     }
+   }
+@@ -440,6 +464,7 @@ Error NativeThreadLinux::RequestStop() {
+ 
+   Error err;
+   errno = 0;
++#if !defined(__NetBSD__)
+   if (::tgkill(pid, tid, SIGSTOP) != 0) {
+     err.SetErrorToErrno();
+     if (log)
+@@ -447,6 +472,7 @@ Error NativeThreadLinux::RequestStop() {
+                   ", SIGSTOP) failed: %s",
+                   __FUNCTION__, pid, tid, err.AsCString());
+   }
++#endif
+ 
+   return err;
+ }
diff --git a/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeThreadLinux.h b/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeThreadLinux.h
new file mode 100644
index 0000000..2cff18b
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeThreadLinux.h
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- source/Plugins/Process/Linux/NativeThreadLinux.h.orig	2016-09-10 17:36:23.000000000 +0000
++++ source/Plugins/Process/Linux/NativeThreadLinux.h
+@@ -107,7 +107,9 @@ private:
+   std::string m_stop_description;
+   using WatchpointIndexMap = std::map<lldb::addr_t, uint32_t>;
+   WatchpointIndexMap m_watchpoint_index_map;
++#if !defined(__NetBSD__)
+   cpu_set_t m_original_cpu_set; // For single-step workaround.
++#endif
+ };
+ 
+ typedef std::shared_ptr<NativeThreadLinux> NativeThreadLinuxSP;
diff --git a/lldb-git/patches/patch-source_Plugins_Process_Linux_Procfs.h b/lldb-git/patches/patch-source_Plugins_Process_Linux_Procfs.h
new file mode 100644
index 0000000..d5e98d5
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_Linux_Procfs.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+--- source/Plugins/Process/Linux/Procfs.h.orig	2016-09-10 17:36:23.000000000 +0000
++++ source/Plugins/Process/Linux/Procfs.h
+@@ -12,6 +12,7 @@
+ 
+ #include <sys/ptrace.h>
+ 
++#if !defined(__NetBSD__)
+ #ifdef __ANDROID__
+ #if defined(__arm64__) || defined(__aarch64__)
+ typedef unsigned long elf_greg_t;
+@@ -29,3 +30,4 @@ typedef struct user_fpsimd_state elf_fpr
+ #else // __ANDROID__
+ #include <sys/procfs.h>
+ #endif // __ANDROID__
++#endif


Home | Main Index | Thread Index | Old Index