pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lldb-netbsd: Upgrade to SVN 298953
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Wed Mar 29 02:22:51 2017 +0200
Changeset: dad4e6cf6905827e2712cae60323cc3fd7db9bf8
Modified Files:
lldb-netbsd/Makefile
lldb-netbsd/distinfo
lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt
lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp
lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp
lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h
lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
Log Message:
lldb-netbsd: Upgrade to SVN 298953
This version contains more code for NetBSD Native Process Plugin.
Drop patches that don't apply any more. They will be recreated.
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=dad4e6cf6905827e2712cae60323cc3fd7db9bf8
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
lldb-netbsd/Makefile | 2 +-
lldb-netbsd/distinfo | 18 +-
...ch-source_Plugins_Process_NetBSD_CMakeLists.txt | 10 -
..._Plugins_Process_NetBSD_NativeProcessNetBSD.cpp | 1415 --------------------
...ce_Plugins_Process_NetBSD_NativeProcessNetBSD.h | 143 --
..._Process_NetBSD_NativeRegisterContextNetBSD.cpp | 28 +-
...ns_Process_NetBSD_NativeRegisterContextNetBSD.h | 44 -
...NetBSD_NativeRegisterContextNetBSD__x86__64.cpp | 36 +-
...s_NetBSD_NativeRegisterContextNetBSD__x86__64.h | 7 +-
...e_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp | 403 ------
...rce_Plugins_Process_NetBSD_NativeThreadNetBSD.h | 62 -
11 files changed, 43 insertions(+), 2125 deletions(-)
diffs:
diff --git a/lldb-netbsd/Makefile b/lldb-netbsd/Makefile
index 51fcf06db9..6fb4f5fb51 100644
--- a/lldb-netbsd/Makefile
+++ b/lldb-netbsd/Makefile
@@ -5,7 +5,7 @@ CATEGORIES= lang devel
SVN_REPOSITORIES= lldb
SVN_REPO.lldb= http://llvm.org/svn/llvm-project/lldb/trunk
-SVN_REVISION.lldb= 298810
+SVN_REVISION.lldb= 298953
MAINTAINER= pkgsrc-users%NetBSD.org@localhost
HOMEPAGE= http://lldb.org/
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 23509ae8ba..3475bb4595 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -16,15 +16,15 @@ SHA1 (patch-source_CMakeLists.txt) = 5dacabc3f39c23bdfd432b5a4895866157b97aa0
SHA1 (patch-source_Host_common_Host.cpp) = 7d48b8bb1e4350ba6d3ddc6357b9b8dc82d6b32d
SHA1 (patch-source_Host_netbsd_Host.cpp) = 92ea9aa9c21d11126e7532a860e59f408175d8d4
SHA1 (patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp) = 32d683eb388ded96e7f9aedec827202b5b056392
-SHA1 (patch-source_Plugins_Process_NetBSD_CMakeLists.txt) = 558379a5f3b47235dbf670742467e64c05e5900f
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = ef68288982961753e342ed8c9dd599991087ba1a
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = 3c9d87046a4399f4ca8a48721b81b49b416ac3e0
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp) = 53e098aaaf0b124d98ce57569065924cd8569151
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h) = be4c4eae10cf5d18ad6e6f0523aaf59ce60cde5b
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp) = f6aaa6193389041476a05f022ad55e18b4ec0e20
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h) = dee7f3fafaf4688d573075897293d42b498484bf
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = 1aedd86c5571e8def23da1ff44c5f44852bd2f76
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = cc8cfee5f3740e2495282f376428963bb388b844
+SHA1 (patch-source_Plugins_Process_NetBSD_CMakeLists.txt) = adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp) = b167df99822ea185082ff5fb03683653cbadc685
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h) = adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp) = bbd23695df72cde26bbad7280a801d677f75e73b
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h) = d883851599eb3278df6f3b2b5854ede3589713f5
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
SHA1 (patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp) = 0a64e526ed3eca089ee54d3bb54385f4d26fc7d1
SHA1 (patch-source_Plugins_Process_elf-core_ThreadElfCore.cpp) = 3427bd2e2de3cd2947123c2f20ed8d5082a16ace
SHA1 (patch-source_Plugins_Process_minidump_ProcessMinidump.cpp) = a71464df2ef56b8b2c8905e8169a85a05cfd27ba
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt
index 2dc8d0e5a4..afc76512f4 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt
@@ -1,12 +1,2 @@
$NetBSD$
---- source/Plugins/Process/NetBSD/CMakeLists.txt.orig 2017-03-21 20:01:05.000000000 +0000
-+++ source/Plugins/Process/NetBSD/CMakeLists.txt
-@@ -6,6 +6,7 @@ add_lldb_library(lldbPluginProcessNetBSD
- NativeProcessNetBSD.cpp
- NativeRegisterContextNetBSD.cpp
- NativeThreadNetBSD.cpp
-+ NativeRegisterContextNetBSD_x86_64.cpp
-
- LINK_LIBS
- lldbCore
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 38b7bdfbea..afc76512f4 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
@@ -1,1417 +1,2 @@
$NetBSD$
---- source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp.orig 2017-03-23 15:49:53.000000000 +0000
-+++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
-@@ -10,16 +10,61 @@
- #include "NativeProcessNetBSD.h"
-
- // C Includes
-+#include <sys/param.h>
-+#include <sys/types.h>
-+#include <sys/sysctl.h>
-+#include <uvm/uvm_prot.h>
-+#include <elf.h>
-+#include <errno.h>
-+#include <stdint.h>
-+#include <string.h>
-+#include <unistd.h>
-+#include <util.h>
-
- // C++ Includes
-+#include <fstream>
-+#include <mutex>
-+#include <sstream>
-+#include <string>
-+#include <unordered_map>
-
- // Other libraries and framework includes
-+#include "lldb/Core/EmulateInstruction.h"
-+#include "lldb/Utility/Error.h"
-+#include "lldb/Core/ModuleSpec.h"
-+#include "lldb/Core/RegisterValue.h"
-+#include "lldb/Core/State.h"
-+#include "lldb/Host/Host.h"
-+#include "lldb/Host/HostProcess.h"
-+#include "lldb/Host/ThreadLauncher.h"
-+#include "lldb/Host/common/NativeBreakpoint.h"
-+#include "lldb/Host/common/NativeRegisterContext.h"
-+#include "lldb/Host/posix/ProcessLauncherPosixFork.h"
-+#include "lldb/Symbol/ObjectFile.h"
-+#include "lldb/Target/Process.h"
-+#include "lldb/Target/ProcessLaunchInfo.h"
-+#include "lldb/Target/Target.h"
-+#include "lldb/Utility/LLDBAssert.h"
-+#include "lldb/Host/PseudoTerminal.h"
-+#include "lldb/Utility/StringExtractor.h"
-+#include "lldb/Utility/DataBufferHeap.h"
-
-+#include "llvm/Support/MemoryBuffer.h"
-+
-+#include "NativeThreadNetBSD.h"
- #include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
-
- // System includes - They have to be included after framework includes because
- // they define some
- // macros which collide with variable names in other modules
-+#include <sys/socket.h>
-+
-+#include <sys/ptrace.h>
-+#include <sys/syscall.h>
-+#include <sys/types.h>
-+#include <sys/user.h>
-+#include <sys/wait.h>
-+
-
- using namespace lldb;
- using namespace lldb_private;
-@@ -27,6 +72,132 @@ using namespace lldb_private::process_ne
- using namespace llvm;
-
- // -----------------------------------------------------------------------------
-+// Public Instance Methods
-+// -----------------------------------------------------------------------------
-+
-+NativeProcessNetBSD::NativeProcessNetBSD()
-+ : NativeProcessProtocol(LLDB_INVALID_PROCESS_ID), m_arch(),
-+ m_supports_mem_region(eLazyBoolCalculate), m_mem_region_cache(),
-+ m_pending_notification_tid(LLDB_INVALID_THREAD_ID) {}
-+
-+namespace {
-+void MaybeLogLaunchInfo(const ProcessLaunchInfo &info) {
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-+ if (!log)
-+ return;
-+
-+ if (const FileAction *action = info.GetFileActionForFD(STDIN_FILENO))
-+ LLDB_LOG(log, "setting STDIN to '{0}'", action->GetFileSpec());
-+ else
-+ LLDB_LOG(log, "leaving STDIN as is");
-+
-+ if (const FileAction *action = info.GetFileActionForFD(STDOUT_FILENO))
-+ LLDB_LOG(log, "setting STDOUT to '{0}'", action->GetFileSpec());
-+ else
-+ LLDB_LOG(log, "leaving STDOUT as is");
-+
-+ if (const FileAction *action = info.GetFileActionForFD(STDERR_FILENO))
-+ LLDB_LOG(log, "setting STDERR to '{0}'", action->GetFileSpec());
-+ else
-+ LLDB_LOG(log, "leaving STDERR as is");
-+
-+ int i = 0;
-+ for (const char **args = info.GetArguments().GetConstArgumentVector(); *args;
-+ ++args, ++i)
-+ LLDB_LOG(log, "arg {0}: '{1}'", i, *args);
-+}
-+
-+void DisplayBytes(StreamString &s, void *bytes, uint32_t count) {
-+ uint8_t *ptr = (uint8_t *)bytes;
-+ const uint32_t loop_count = count;
-+ for (uint32_t i = 0; i < loop_count; i++) {
-+ s.Printf("[%x]", *ptr);
-+ ptr++;
-+ }
-+}
-+
-+void PtraceDisplayBytes(int &req, void *addr, int data) {
-+ StreamString buf;
-+
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
-+ if (!log)
-+ return;
-+
-+ switch (req) {
-+ case PT_WRITE_I: {
-+ DisplayBytes(buf, &data, sizeof(int));
-+ LLDB_LOG(log, "PT_WRITE_I {0}", buf.GetData());
-+ break;
-+ }
-+ case PT_WRITE_D: {
-+ DisplayBytes(buf, &data, sizeof(int));
-+ LLDB_LOG(log, "PT_WRITE_D {0}", buf.GetData());
-+ break;
-+ }
-+#ifdef PT_SETREGS
-+ case PT_SETREGS: {
-+ DisplayBytes(buf, addr, sizeof(struct reg));
-+ LLDB_LOG(log, "PT_SETREGS {0}", buf.GetData());
-+ break;
-+ }
-+#endif
-+#ifdef PT_SETFPREGS
-+ case PT_SETFPREGS: {
-+ DisplayBytes(buf, addr, sizeof(struct fpreg));
-+ LLDB_LOG(log, "PT_SETFPREGS {0}", buf.GetData());
-+ break;
-+ }
-+#endif
-+#ifdef PT_SETDBREGS
-+ case PT_SETDBREGS: {
-+ DisplayBytes(buf, addr, sizeof(struct fpreg));
-+ LLDB_LOG(log, "PT_SETDBREGS {0}", buf.GetData());
-+ break;
-+ }
-+#endif
-+#ifdef PT_SETXMMREGS
-+ case PT_SETXMMREGS: {
-+ DisplayBytes(buf, addr, sizeof(struct xmmregs));
-+ LLDB_LOG(log, "PT_SETXMMREGS {0}", buf.GetData());
-+ break;
-+ }
-+#endif
-+#ifdef PT_SETVECREGS
-+ case PT_SETVECREGS: {
-+ DisplayBytes(buf, addr, sizeof(struct vreg));
-+ LLDB_LOG(log, "PT_SETVECREGS {0}", buf.GetData());
-+ break;
-+ }
-+#endif
-+ default: {}
-+ }
-+}
-+
-+static constexpr unsigned k_ptrace_word_size = sizeof(void *);
-+static_assert(sizeof(long) >= k_ptrace_word_size,
-+ "Size of long must be larger than ptrace word size");
-+} // end of anonymous namespace
-+
-+// Simple helper function to ensure flags are enabled on the given file
-+// descriptor.
-+static Error EnsureFDFlags(int fd, int flags) {
-+ Error error;
-+
-+ int status = fcntl(fd, F_GETFL);
-+ if (status == -1) {
-+ error.SetErrorToErrno();
-+ return error;
-+ }
-+
-+ if (fcntl(fd, F_SETFL, status | flags) == -1) {
-+ error.SetErrorToErrno();
-+ return error;
-+ }
-+
-+ return error;
-+}
-+
-+// -----------------------------------------------------------------------------
- // Public Static Methods
- // -----------------------------------------------------------------------------
-
-@@ -34,18 +205,1213 @@ Error NativeProcessProtocol::Launch(
- ProcessLaunchInfo &launch_info,
- NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop,
- NativeProcessProtocolSP &native_process_sp) {
-- return Error();
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-+
-+ Error error;
-+
-+ // Verify the working directory is valid if one was specified.
-+ FileSpec working_dir{launch_info.GetWorkingDirectory()};
-+ if (working_dir &&
-+ (!working_dir.ResolvePath() ||
-+ !llvm::sys::fs::is_directory(working_dir.GetPath()))) {
-+ error.SetErrorStringWithFormat("No such file or directory: %s",
-+ working_dir.GetCString());
-+ return error;
-+ }
-+
-+ // Create the NativeProcessNetBSD in launch mode.
-+ native_process_sp.reset(new NativeProcessNetBSD());
-+
-+ if (!native_process_sp->RegisterNativeDelegate(native_delegate)) {
-+ native_process_sp.reset();
-+ error.SetErrorStringWithFormat("failed to register the native delegate");
-+ return error;
-+ }
-+
-+ error = std::static_pointer_cast<NativeProcessNetBSD>(native_process_sp)
-+ ->LaunchInferior(mainloop, launch_info);
-+
-+ if (error.Fail()) {
-+ native_process_sp.reset();
-+ LLDB_LOG(log, "failed to launch process: {0}", error);
-+ return error;
-+ }
-+
-+ launch_info.SetProcessID(native_process_sp->GetID());
-+
-+ return error;
- }
-
- Error NativeProcessProtocol::Attach(
- lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate,
- MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) {
-- return Error();
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-+ LLDB_LOG(log, "pid = {0:x}", pid);
-+
-+ // Retrieve the architecture for the running process.
-+ ArchSpec process_arch;
-+ Error error = ResolveProcessArchitecture(pid, process_arch);
-+ if (!error.Success())
-+ return error;
-+
-+ std::shared_ptr<NativeProcessNetBSD> native_process_netbsd_sp(
-+ new NativeProcessNetBSD());
-+
-+ if (!native_process_netbsd_sp->RegisterNativeDelegate(native_delegate)) {
-+ error.SetErrorStringWithFormat("failed to register the native delegate");
-+ return error;
-+ }
-+
-+ native_process_netbsd_sp->AttachToInferior(mainloop, pid, error);
-+ if (!error.Success())
-+ return error;
-+
-+ native_process_sp = native_process_netbsd_sp;
-+ return error;
- }
-
- // -----------------------------------------------------------------------------
- // Public Instance Methods
- // -----------------------------------------------------------------------------
-
--NativeProcessNetBSD::NativeProcessNetBSD()
-- : NativeProcessProtocol(LLDB_INVALID_PROCESS_ID) {}
-+
-+
-+void NativeProcessNetBSD::AttachToInferior(MainLoop &mainloop, lldb::pid_t pid,
-+ Error &error) {
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-+ LLDB_LOG(log, "pid = {0:x}", pid);
-+
-+ m_sigchld_handle = mainloop.RegisterSignal(
-+ SIGCHLD, [this](MainLoopBase &) { SigchldHandler(); }, error);
-+ if (!m_sigchld_handle)
-+ return;
-+
-+ error = ResolveProcessArchitecture(pid, m_arch);
-+ if (!error.Success())
-+ return;
-+
-+ // Set the architecture to the exe architecture.
-+ LLDB_LOG(log, "pid = {0:x}, detected architecture {1}", pid,
-+ m_arch.GetArchitectureName());
-+
-+ m_pid = pid;
-+ SetState(eStateAttaching);
-+
-+ Attach(pid, error);
-+}
-+
-+Error NativeProcessNetBSD::LaunchInferior(MainLoop &mainloop,
-+ ProcessLaunchInfo &launch_info) {
-+ Error error;
-+ m_sigchld_handle = mainloop.RegisterSignal(
-+ SIGCHLD, [this](MainLoopBase &) { SigchldHandler(); }, error);
-+ if (!m_sigchld_handle)
-+ return error;
-+
-+ SetState(eStateLaunching);
-+
-+ MaybeLogLaunchInfo(launch_info);
-+
-+ ::pid_t pid =
-+ ProcessLauncherPosixFork().LaunchProcess(launch_info, error).GetProcessId();
-+ if (error.Fail())
-+ return error;
-+
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-+
-+ // Wait for the child process to trap on its call to execve.
-+ ::pid_t wpid;
-+ int status;
-+ if ((wpid = waitpid(pid, &status, 0)) < 0) {
-+ error.SetErrorToErrno();
-+ LLDB_LOG(log, "waitpid for inferior failed with %s", error);
-+
-+ // Mark the inferior as invalid.
-+ // FIXME this could really use a new state - eStateLaunchFailure. For now,
-+ // using eStateInvalid.
-+ SetState(StateType::eStateInvalid);
-+
-+ return error;
-+ }
-+ assert(WIFSTOPPED(status) && (wpid == static_cast<::pid_t>(pid)) &&
-+ "Could not sync with inferior process.");
-+
-+ LLDB_LOG(log, "inferior started, now in stopped state");
-+
-+ SetDefaultPtraceOpts(pid);
-+
-+ // Release the master terminal descriptor and pass it off to the
-+ // NativeProcessNetBSD instance. Similarly stash the inferior pid.
-+ m_terminal_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor();
-+ m_pid = pid;
-+ launch_info.SetProcessID(pid);
-+
-+ if (m_terminal_fd != -1) {
-+ error = EnsureFDFlags(m_terminal_fd, O_NONBLOCK);
-+ if (error.Fail()) {
-+ LLDB_LOG(log,
-+ "inferior EnsureFDFlags failed for ensuring terminal "
-+ "O_NONBLOCK setting: {0}",
-+ error);
-+
-+ // Mark the inferior as invalid.
-+ // FIXME this could really use a new state - eStateLaunchFailure. For
-+ // now, using eStateInvalid.
-+ SetState(StateType::eStateInvalid);
-+
-+ return error;
-+ }
-+ }
-+
-+ LLDB_LOG(log, "adding pid = {0}", pid);
-+
-+ ResolveProcessArchitecture(m_pid, m_arch);
-+
-+ /* Initialize threads */
-+ struct ptrace_lwpinfo info = {};
-+ error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
-+ if (error.Fail()) {
-+ SetState(StateType::eStateInvalid);
-+ return error;
-+ }
-+ while (info.pl_lwpid != 0) {
-+ NativeThreadNetBSDSP thread_sp = AddThread(info.pl_lwpid);
-+ thread_sp->SetStoppedBySignal(SIGSTOP);
-+ error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
-+ if (error.Fail()) {
-+ SetState(StateType::eStateInvalid);
-+ return error;
-+ }
-+ }
-+
-+ /* Set process stopped */
-+ SetState(StateType::eStateStopped);
-+
-+ if (error.Fail())
-+ LLDB_LOG(log, "inferior launching failed {0}", error);
-+ return error;
-+}
-+
-+::pid_t NativeProcessNetBSD::Attach(lldb::pid_t pid, Error &error) {
-+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-+
-+ // Use a map to keep track of the threads which we have attached/need to
-+ // attach.
-+ Host::TidMap tids_to_attach;
-+ if (pid <= 1) {
-+ error.SetErrorToGenericError();
-+ error.SetErrorString("Attaching to process 1 is not allowed.");
-+ return -1;
-+ }
-+
-+ // Attach to the requested process.
-+ // An attach will cause the thread to stop with a SIGSTOP.
-+ error = PtraceWrapper(PT_ATTACH, pid);
-+ if (error.Fail())
-+ return -1;
-+
-+ int status;
-+ // Need to use WALLSIG otherwise we receive an error with errno=ECHLD
-+ // At this point we should have a thread stopped if waitpid succeeds.
-+ if ((status = waitpid(pid, NULL, WALLSIG)) < 0)
-+ return -1;
-+
-+ SetDefaultPtraceOpts(pid);
-+
-+ m_pid = pid;
-+
-+ /* Initialize threads */
-+ struct ptrace_lwpinfo info = {};
-+ error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
-+ if (error.Fail()) {
-+ SetState(StateType::eStateInvalid);
-+ return -1;
-+ }
-+ while (info.pl_lwpid != 0) {
-+ NativeThreadNetBSDSP thread_sp = AddThread(info.pl_lwpid);
-+ thread_sp->SetStoppedBySignal(SIGSTOP);
-+ error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
-+ if (error.Fail()) {
-+ SetState(StateType::eStateInvalid);
-+ return -1;
-+ }
-+ }
-+
-+ // Let our process instance know the thread has stopped.
-+ SetState(StateType::eStateStopped);
-+
-+ return pid;
-+}
-+
-+Error NativeProcessNetBSD::SetDefaultPtraceOpts(lldb::pid_t pid) {
-+ ptrace_event_t event = {};
-+
-+#if notyet
-+ // Report forks
-+ event.pe_set_event |= PTRACE_FORK;
-+
-+ // Report vforks
-+ // TODO: Currently unsupported in NetBSD
-+ event.pe_set_event |= PTRACE_VFORK;
-+
-+ // Report finished vforks - the parent unblocked after execve(2) or exit(2) of the child
-+ event.pe_set_event |= PTRACE_VFORK_DONE;
-+#endif
-+
-+ // Report LWP (thread) creation
-+ event.pe_set_event |= PTRACE_LWP_CREATE;
-+
-+ // Report LWP (thread) termination
-+ event.pe_set_event |= PTRACE_LWP_EXIT;
-+
-+ return PtraceWrapper(PT_SET_EVENT_MASK, pid, &event, sizeof(struct ptrace_event));
-+}
-+
-+static ExitType convert_pid_status_to_exit_type(int status) {
-+ if (WIFEXITED(status))
-+ return ExitType::eExitTypeExit;
-+ else if (WIFSIGNALED(status))
-+ return ExitType::eExitTypeSignal;
-+ else if (WIFSTOPPED(status))
-+ return ExitType::eExitTypeStop;
-+ else {
-+ // We don't know what this is.
-+ return ExitType::eExitTypeInvalid;
-+ }
-+}
-+
-+static int convert_pid_status_to_return_code(int status) {
-+ if (WIFEXITED(status))
-+ return WEXITSTATUS(status);
-+ else if (WIFSIGNALED(status))
-+ return WTERMSIG(status);
-+ else if (WIFSTOPPED(status))
-+ return WSTOPSIG(status);
-+ else {
-+ // We don't know what this is.
-+ return ExitType::eExitTypeInvalid;
-+ }
-+}
-+
-+// Handles all waitpid events from the inferior process.
-+void NativeProcessNetBSD::MonitorCallback(lldb::pid_t pid, bool exited,
-+ int signal, int status) {
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-+
-+ // Handle when the process exits.
-+ if (exited) {
-+ LLDB_LOG(log, "got exit signal({0}) , pid = {1}", signal, pid);
-+
-+ /* Stop Tracking All Threads attached to Process */
-+ m_threads.clear();
-+
-+ 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);
-+
-+ return;
-+ }
-+
-+ ptrace_siginfo_t info;
-+ const auto siginfo_err = PtraceWrapper(PT_GET_SIGINFO, pid, &info, sizeof(info));
-+
-+ ptrace_state_t state;
-+ const auto state_err = PtraceWrapper(PT_GET_PROCESS_STATE, pid, &state, sizeof(state));
-+
-+ printf("Signal received signo=%d errno=%d code=%d\n", info.psi_siginfo.si_signo,
-+ info.psi_siginfo.si_errno, info.psi_siginfo.si_code);
-+
-+ // Get details on the signal raised.
-+ if (siginfo_err.Success() && state_err.Success()) {
-+ switch (info.psi_siginfo.si_signo) {
-+ case SIGTRAP:
-+ switch (info.psi_siginfo.si_code) {
-+ case TRAP_BRKPT:
-+ for (const auto &thread_sp : m_threads) {
-+ static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedByBreakpoint();
-+ FixupBreakpointPCAsNeeded(*static_pointer_cast<NativeThreadNetBSD>(thread_sp));
-+ }
-+ SetState(StateType::eStateStopped, true);
-+ break;
-+ case TRAP_TRACE:
-+ for (const auto &thread_sp : m_threads) {
-+ static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedByTrace();
-+ }
-+ SetState(StateType::eStateStopped, true);
-+ break;
-+ case TRAP_EXEC:
-+ {
-+ // Clear old threads
-+ m_threads.clear();
-+
-+ // Initialize new thread
-+ struct ptrace_lwpinfo info = {};
-+ Error error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
-+ if (error.Fail()) {
-+ SetState(StateType::eStateInvalid);
-+ return;
-+ }
-+
-+ // Reinitialize from scratch threads and register them in process
-+ while (info.pl_lwpid != 0) {
-+ NativeThreadNetBSDSP thread_sp = AddThread(info.pl_lwpid);
-+ thread_sp->SetStoppedByExec();
-+ error = PtraceWrapper(PT_LWPINFO, pid, &info, sizeof(info));
-+ if (error.Fail()) {
-+ SetState(StateType::eStateInvalid);
-+ return;
-+ }
-+ }
-+
-+ // Let our delegate know we have just exec'd.
-+ NotifyDidExec();
-+
-+ SetState(StateType::eStateStopped, true);
-+ }
-+ break;
-+ case TRAP_CHLD:
-+ {
-+ // fork(2)
-+ if ((state.pe_report_event & PTRACE_FORK) != 0)
-+ printf("Fork reported\n");
-+ // vfork(2)
-+ else if ((state.pe_report_event & PTRACE_VFORK) != 0)
-+ printf("VFork reported\n");
-+ // vfork(2) done
-+ else if ((state.pe_report_event & PTRACE_VFORK_DONE) != 0)
-+ printf("VFork Done reported\n");
-+ }
-+ break;
-+ case TRAP_LWP:
-+ {
-+ // _lwp_create(2)
-+ if ((state.pe_report_event & PTRACE_LWP_CREATE) != 0) {
-+ AddThread(state.pe_lwp);
-+ for (const auto &thread_sp : m_threads) {
-+ static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(info.psi_siginfo.si_signo, &info.psi_siginfo);
-+ }
-+ }
-+ // _lwp_exit(2)
-+ if ((state.pe_report_event & PTRACE_LWP_EXIT) != 0)
-+ for (size_t i; i < m_threads.size(); i++) {
-+ if (static_pointer_cast<NativeThreadNetBSD>(m_threads[i])->GetID() == state.pe_lwp) {
-+ m_threads.erase(m_threads.begin() + i);
-+ break;
-+ }
-+ }
-+ for (const auto &thread_sp : m_threads) {
-+ static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(info.psi_siginfo.si_signo, &info.psi_siginfo);
-+ }
-+ }
-+ SetState(StateType::eStateStopped, true);
-+ break;
-+ case TRAP_DBREG:
-+ printf("hw watchpoint reported\n");
-+ break;
-+ }
-+ break;
-+ case SIGSTOP:
-+ // Handle SIGSTOP from LLGS (LLDB GDB Server)
-+ if (info.psi_siginfo.si_code == SI_USER && info.psi_siginfo.si_pid == ::getpid()) {
-+ /* Stop Tracking All Threads attached to Process */
-+ for (const auto &thread_sp : m_threads) {
-+ static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(SIGSTOP, &info.psi_siginfo);
-+ }
-+ }
-+ break;
-+ default:
-+ // Other signals
-+
-+#if 0
-+ if (m_signals_to_ignore.find(signo) != m_signals_to_ignore.end()) {
-+ ResumeThread(thread, thread.GetState(), signo);
-+ return;
-+ }
-+#endif
-+
-+ for (const auto &thread_sp : m_threads) {
-+ static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStoppedBySignal(info.psi_siginfo.si_signo, &info.psi_siginfo);
-+ }
-+ SetState(StateType::eStateStopped, true);
-+ }
-+ }
-+}
-+
-+namespace {
-+
-+struct EmulatorBaton {
-+ NativeProcessNetBSD *m_process;
-+ NativeRegisterContext *m_reg_context;
-+
-+ // eRegisterKindDWARF -> RegsiterValue
-+ std::unordered_map<uint32_t, RegisterValue> m_register_values;
-+
-+ EmulatorBaton(NativeProcessNetBSD *process, NativeRegisterContext *reg_context)
-+ : m_process(process), m_reg_context(reg_context) {}
-+};
-+
-+} // anonymous namespace
-+
-+static size_t ReadMemoryCallback(EmulateInstruction *instruction, void *baton,
-+ const EmulateInstruction::Context &context,
-+ lldb::addr_t addr, void *dst, size_t length) {
-+ EmulatorBaton *emulator_baton = static_cast<EmulatorBaton *>(baton);
-+
-+ size_t bytes_read;
-+ emulator_baton->m_process->ReadMemory(addr, dst, length, bytes_read);
-+ return bytes_read;
-+}
-+
-+static bool ReadRegisterCallback(EmulateInstruction *instruction, void *baton,
-+ const RegisterInfo *reg_info,
-+ RegisterValue ®_value) {
-+ EmulatorBaton *emulator_baton = static_cast<EmulatorBaton *>(baton);
-+
-+ auto it = emulator_baton->m_register_values.find(
-+ reg_info->kinds[eRegisterKindDWARF]);
-+ if (it != emulator_baton->m_register_values.end()) {
-+ reg_value = it->second;
-+ return true;
-+ }
-+
-+ // The emulator only fill in the dwarf regsiter numbers (and in some case
-+ // the generic register numbers). Get the full register info from the
-+ // register context based on the dwarf register numbers.
-+ const RegisterInfo *full_reg_info =
-+ emulator_baton->m_reg_context->GetRegisterInfo(
-+ eRegisterKindDWARF, reg_info->kinds[eRegisterKindDWARF]);
-+
-+ Error error =
-+ emulator_baton->m_reg_context->ReadRegister(full_reg_info, reg_value);
-+ if (error.Success())
-+ return true;
-+
-+ return false;
-+}
-+
-+static bool WriteRegisterCallback(EmulateInstruction *instruction, void *baton,
-+ const EmulateInstruction::Context &context,
-+ const RegisterInfo *reg_info,
-+ const RegisterValue ®_value) {
-+ EmulatorBaton *emulator_baton = static_cast<EmulatorBaton *>(baton);
-+ emulator_baton->m_register_values[reg_info->kinds[eRegisterKindDWARF]] =
-+ reg_value;
-+ return true;
-+}
-+
-+static size_t WriteMemoryCallback(EmulateInstruction *instruction, void *baton,
-+ const EmulateInstruction::Context &context,
-+ lldb::addr_t addr, const void *dst,
-+ size_t length) {
-+ return length;
-+}
-+
-+static lldb::addr_t ReadFlags(NativeRegisterContext *regsiter_context) {
-+ const RegisterInfo *flags_info = regsiter_context->GetRegisterInfo(
-+ eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FLAGS);
-+ return regsiter_context->ReadRegisterAsUnsigned(flags_info,
-+ LLDB_INVALID_ADDRESS);
-+}
-+
-+Error NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) {
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-+ LLDB_LOG(log, "pid {0}", GetID());
-+
-+ const auto &thread_sp = m_threads[0];
-+ const ResumeAction *const action = resume_actions.GetActionForThread(thread_sp->GetID(), true);
-+
-+ if (action == nullptr) {
-+ LLDB_LOG(log, "no action specified for pid {0} tid {1}", GetID(),
-+ thread_sp->GetID());
-+ return Error();
-+ }
-+
-+ switch (action->state) {
-+ case eStateRunning: {
-+ // Run the thread, possibly feeding it the signal.
-+ Error error = NativeProcessNetBSD::PtraceWrapper(PT_CONTINUE, GetID(),(void *)1, action->signal);
-+ if (!error.Success())
-+ return error;
-+ for (const auto &thread_sp : m_threads) {
-+ static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetRunning();
-+ }
-+ SetState(eStateRunning, true);
-+ break;
-+ }
-+ case eStateStepping: {
-+ // Run the thread, possibly feeding it the signal.
-+ Error error = NativeProcessNetBSD::PtraceWrapper(PT_STEP, GetID(),(void *)1, action->signal);
-+ if (!error.Success())
-+ return error;
-+ for (const auto &thread_sp : m_threads) {
-+ static_pointer_cast<NativeThreadNetBSD>(thread_sp)->SetStepping();
-+ }
-+ SetState(eStateStepping, true);
-+ break;
-+ }
-+
-+ case eStateSuspended:
-+ case eStateStopped:
-+ llvm_unreachable("Unexpected state");
-+
-+ default:
-+ return Error("NativeProcessLinux::%s (): unexpected state %s specified "
-+ "for pid %" PRIu64 ", tid %" PRIu64,
-+ __FUNCTION__, StateAsCString(action->state), GetID(),
-+ thread_sp->GetID());
-+ }
-+
-+ return Error();
-+}
-+
-+Error NativeProcessNetBSD::Halt() {
-+ Error error;
-+
-+ if (kill(GetID(), SIGSTOP) != 0)
-+ error.SetErrorToErrno();
-+
-+ return error;
-+}
-+
-+Error NativeProcessNetBSD::Detach() {
-+ Error error;
-+
-+ // Stop monitoring the inferior.
-+ m_sigchld_handle.reset();
-+
-+ // Tell ptrace to detach from the process.
-+ if (GetID() == LLDB_INVALID_PROCESS_ID)
-+ return error;
-+
-+ return PtraceWrapper(PT_DETACH, GetID());
-+}
-+
-+Error NativeProcessNetBSD::Signal(int signo) {
-+ Error error;
-+
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-+ LLDB_LOG(log, "selecting running thread for interrupt target");
-+
-+ if (kill(GetID(), signo))
-+ error.SetErrorToErrno();
-+
-+ return error;
-+}
-+
-+Error NativeProcessNetBSD::Interrupt() {
-+ // Pick a running thread (or if none, a not-dead stopped thread) as
-+ // the chosen thread that will be the stop-reason thread.
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-+
-+ NativeThreadProtocolSP running_thread_sp;
-+ NativeThreadProtocolSP stopped_thread_sp;
-+
-+ LLDB_LOG(log, "selecting running thread for interrupt target");
-+
-+ for (auto thread_sp : m_threads) {
-+ // The thread shouldn't be null but lets just cover that here.
-+ if (!thread_sp)
-+ continue;
-+
-+ // If we have a running or stepping thread, we'll call that the
-+ // target of the interrupt.
-+ const auto thread_state = thread_sp->GetState();
-+ if (thread_state == eStateRunning || thread_state == eStateStepping) {
-+ running_thread_sp = thread_sp;
-+ break;
-+ } else if (!stopped_thread_sp && StateIsStoppedState(thread_state, true)) {
-+ // Remember the first non-dead stopped thread. We'll use that as a backup
-+ // if there are no running threads.
-+ stopped_thread_sp = thread_sp;
-+ }
-+ }
-+
-+ if (!running_thread_sp && !stopped_thread_sp) {
-+ Error error("found no running/stepping or live stopped threads as target "
-+ "for interrupt");
-+ LLDB_LOG(log, "skipping due to error: {0}", error);
-+ return error;
-+ }
-+
-+ NativeThreadProtocolSP deferred_signal_thread_sp =
-+ running_thread_sp ? running_thread_sp : stopped_thread_sp;
-+
-+ return Error();
-+}
-+
-+Error NativeProcessNetBSD::Kill() {
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-+ LLDB_LOG(log, "pid {0}", GetID());
-+
-+ Error error;
-+
-+ switch (m_state) {
-+ case StateType::eStateInvalid:
-+ case StateType::eStateExited:
-+ case StateType::eStateCrashed:
-+ case StateType::eStateDetached:
-+ case StateType::eStateUnloaded:
-+ // Nothing to do - the process is already dead.
-+ LLDB_LOG(log, "ignored for PID {0} due to current state: {1}", GetID(),
-+ StateAsCString(m_state));
-+ return error;
-+
-+ case StateType::eStateConnected:
-+ case StateType::eStateAttaching:
-+ case StateType::eStateLaunching:
-+ case StateType::eStateStopped:
-+ case StateType::eStateRunning:
-+ case StateType::eStateStepping:
-+ case StateType::eStateSuspended:
-+ // We can try to kill a process in these states.
-+ break;
-+ }
-+
-+ if (kill(GetID(), SIGKILL) != 0) {
-+ error.SetErrorToErrno();
-+ return error;
-+ }
-+
-+ return error;
-+}
-+
-+Error NativeProcessNetBSD::GetMemoryRegionInfo(lldb::addr_t load_addr,
-+ MemoryRegionInfo &range_info) {
-+
-+ if (m_supports_mem_region == LazyBool::eLazyBoolNo) {
-+ // We're done.
-+ return Error("unsupported");
-+ }
-+
-+ Error error = PopulateMemoryRegionCache();
-+ if (error.Fail()) {
-+ return error;
-+ }
-+
-+ lldb::addr_t prev_base_address = 0;
-+ // FIXME start by finding the last region that is <= target address using
-+ // binary search. Data is sorted.
-+ // There can be a ton of regions on pthreads apps with lots of threads.
-+ for (auto it = m_mem_region_cache.begin(); it != m_mem_region_cache.end();
-+ ++it) {
-+ MemoryRegionInfo &proc_entry_info = it->first;
-+ // Sanity check assumption that /proc/{pid}/maps entries are ascending.
-+ assert((proc_entry_info.GetRange().GetRangeBase() >= prev_base_address) &&
-+ "descending /proc/pid/maps entries detected, unexpected");
-+ prev_base_address = proc_entry_info.GetRange().GetRangeBase();
-+ UNUSED_IF_ASSERT_DISABLED(prev_base_address);
-+ // If the target address comes before this entry, indicate distance to next
-+ // region.
-+ if (load_addr < proc_entry_info.GetRange().GetRangeBase()) {
-+ range_info.GetRange().SetRangeBase(load_addr);
-+ range_info.GetRange().SetByteSize(
-+ proc_entry_info.GetRange().GetRangeBase() - load_addr);
-+ range_info.SetReadable(MemoryRegionInfo::OptionalBool::eNo);
-+ range_info.SetWritable(MemoryRegionInfo::OptionalBool::eNo);
-+ range_info.SetExecutable(MemoryRegionInfo::OptionalBool::eNo);
-+ range_info.SetMapped(MemoryRegionInfo::OptionalBool::eNo);
-+ return error;
-+ } else if (proc_entry_info.GetRange().Contains(load_addr)) {
-+ // The target address is within the memory region we're processing here.
-+ range_info = proc_entry_info;
-+ return error;
-+ }
-+ // The target memory address comes somewhere after the region we just
-+ // parsed.
-+ }
-+ // If we made it here, we didn't find an entry that contained the given
-+ // address. Return the
-+ // load_addr as start and the amount of bytes betwwen load address and the end
-+ // of the memory as
-+ // size.
-+ range_info.GetRange().SetRangeBase(load_addr);
-+ range_info.GetRange().SetRangeEnd(LLDB_INVALID_ADDRESS);
-+ range_info.SetReadable(MemoryRegionInfo::OptionalBool::eNo);
-+ range_info.SetWritable(MemoryRegionInfo::OptionalBool::eNo);
-+ range_info.SetExecutable(MemoryRegionInfo::OptionalBool::eNo);
-+ range_info.SetMapped(MemoryRegionInfo::OptionalBool::eNo);
-+ return error;
-+}
-+
-+
-+Error NativeProcessNetBSD::PopulateMemoryRegionCache() {
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-+ // If our cache is empty, pull the latest. There should always be at least
-+ // one memory region if memory region handling is supported.
-+ if (!m_mem_region_cache.empty()) {
-+ LLDB_LOG(log, "reusing {0} cached memory region entries",
-+ m_mem_region_cache.size());
-+ return Error();
-+ }
-+
-+ struct kinfo_vmentry *vm;
-+ size_t count, i;
-+ vm = kinfo_getvmmap(GetID(), &count);
-+ if (vm == NULL) {
-+ m_supports_mem_region = LazyBool::eLazyBoolNo;
-+ Error error;
-+ error.SetErrorString("not supported");
-+ return error;
-+ }
-+ for (i = 0; i < count; i++) {
-+ MemoryRegionInfo info;
-+ info.Clear();
-+ info.GetRange().SetRangeBase(vm[i].kve_start);
-+ info.GetRange().SetRangeEnd(vm[i].kve_end);
-+ info.SetMapped(MemoryRegionInfo::OptionalBool::eYes);
-+
-+ if (vm[i].kve_protection & VM_PROT_READ)
-+ info.SetReadable(MemoryRegionInfo::OptionalBool::eYes);
-+ else
-+ info.SetReadable(MemoryRegionInfo::OptionalBool::eNo);
-+
-+ if (vm[i].kve_protection & VM_PROT_WRITE)
-+ info.SetWritable(MemoryRegionInfo::OptionalBool::eYes);
-+ else
-+ info.SetWritable(MemoryRegionInfo::OptionalBool::eNo);
-+
-+ if (vm[i].kve_protection & VM_PROT_EXECUTE)
-+ info.SetExecutable(MemoryRegionInfo::OptionalBool::eYes);
-+ else
-+ info.SetExecutable(MemoryRegionInfo::OptionalBool::eNo);
-+
-+ if (vm[i].kve_path[0])
-+ info.SetName(vm[i].kve_path);
-+
-+ m_mem_region_cache.emplace_back(
-+ info, FileSpec(info.GetName().GetCString(), true));
-+ }
-+ free(vm);
-+
-+ if (m_mem_region_cache.empty()) {
-+ // No entries after attempting to read them. This shouldn't happen.
-+ // Assume we don't support map entries.
-+ LLDB_LOG(log,
-+ "failed to find any vmmap entries, assuming no support "
-+ "for memory region metadata retrieval");
-+ m_supports_mem_region = LazyBool::eLazyBoolNo;
-+ Error error;
-+ error.SetErrorString("not supported");
-+ return error;
-+ }
-+ LLDB_LOG(log, "read {0} memory region entries from process {1}",
-+ m_mem_region_cache.size(), GetID());
-+ // We support memory retrieval, remember that.
-+ m_supports_mem_region = LazyBool::eLazyBoolYes;
-+ return Error();
-+}
-+
-+void NativeProcessNetBSD::DoStopIDBumped(uint32_t newBumpId) {
-+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-+ if (log)
-+ log->Printf("NativeProcessNetBSD::%s(newBumpId=%" PRIu32 ") called",
-+ __FUNCTION__, newBumpId);
-+
-+ if (log)
-+ log->Printf("NativeProcessNetBSD::%s clearing %" PRIu64
-+ " entries from the cache",
-+ __FUNCTION__, static_cast<uint64_t>(m_mem_region_cache.size()));
-+ m_mem_region_cache.clear();
-+}
-+
-+Error NativeProcessNetBSD::AllocateMemory(size_t size, uint32_t permissions,
-+ lldb::addr_t &addr) {
-+// FIXME implementing this requires the equivalent of
-+// InferiorCallPOSIX::InferiorCallMmap, which depends on
-+// functional ThreadPlans working with Native*Protocol.
-+#if 1
-+ return Error("not implemented yet");
-+#else
-+ addr = LLDB_INVALID_ADDRESS;
-+
-+ unsigned prot = 0;
-+ if (permissions & lldb::ePermissionsReadable)
-+ prot |= eMmapProtRead;
-+ if (permissions & lldb::ePermissionsWritable)
-+ prot |= eMmapProtWrite;
-+ if (permissions & lldb::ePermissionsExecutable)
-+ prot |= eMmapProtExec;
-+
-+ // TODO implement this directly in NativeProcessNetBSD
-+ // (and lift to NativeProcessPOSIX if/when that class is
-+ // refactored out).
-+ if (InferiorCallMmap(this, addr, 0, size, prot,
-+ eMmapFlagsAnon | eMmapFlagsPrivate, -1, 0)) {
-+ m_addr_to_mmap_size[addr] = size;
-+ return Error();
-+ } else {
-+ addr = LLDB_INVALID_ADDRESS;
-+ return Error("unable to allocate %" PRIu64
-+ " bytes of memory with permissions %s",
-+ size, GetPermissionsAsCString(permissions));
-+ }
-+#endif
-+}
-+
-+Error NativeProcessNetBSD::DeallocateMemory(lldb::addr_t addr) {
-+ // FIXME see comments in AllocateMemory - required lower-level
-+ // bits not in place yet (ThreadPlans)
-+ return Error("not implemented");
-+}
-+
-+lldb::addr_t NativeProcessNetBSD::GetSharedLibraryInfoAddress() {
-+ // punt on this for now
-+ return LLDB_INVALID_ADDRESS;
-+}
-+
-+size_t NativeProcessNetBSD::UpdateThreads() {
-+ // The NativeProcessNetBSD monitoring threads are always up to date
-+ // with respect to thread state and they keep the thread list
-+ // populated properly. All this method needs to do is return the
-+ // thread count.
-+ return m_threads.size();
-+}
-+
-+bool NativeProcessNetBSD::GetArchitecture(ArchSpec &arch) const {
-+ arch = m_arch;
-+ return true;
-+}
-+
-+
-+Error NativeProcessNetBSD::FixupBreakpointPCAsNeeded(NativeThreadNetBSD &thread) {
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS));
-+ Error error;
-+ // Find out the size of a breakpoint (might depend on where we are in the
-+ // code).
-+ NativeRegisterContextSP context_sp = thread.GetRegisterContext();
-+ if (!context_sp) {
-+ error.SetErrorString("cannot get a NativeRegisterContext for the thread");
-+ LLDB_LOG(log, "failed: {0}", error);
-+ return error;
-+ }
-+ uint32_t breakpoint_size = 0;
-+ error = GetSoftwareBreakpointPCOffset(breakpoint_size);
-+ if (error.Fail()) {
-+ LLDB_LOG(log, "GetBreakpointSize() failed: {0}", error);
-+ return error;
-+ } else
-+ LLDB_LOG(log, "breakpoint size: {0}", breakpoint_size);
-+ // First try probing for a breakpoint at a software breakpoint location: PC -
-+ // breakpoint size.
-+ const lldb::addr_t initial_pc_addr =
-+ context_sp->GetPCfromBreakpointLocation();
-+ lldb::addr_t breakpoint_addr = initial_pc_addr;
-+ if (breakpoint_size > 0) {
-+ // Do not allow breakpoint probe to wrap around.
-+ if (breakpoint_addr >= breakpoint_size)
-+ breakpoint_addr -= breakpoint_size;
-+ }
-+ // Check if we stopped because of a breakpoint.
-+ NativeBreakpointSP breakpoint_sp;
-+ error = m_breakpoint_list.GetBreakpoint(breakpoint_addr, breakpoint_sp);
-+ if (!error.Success() || !breakpoint_sp) {
-+ // We didn't find one at a software probe location. Nothing to do.
-+ LLDB_LOG(log,
-+ "pid {0} no lldb breakpoint found at current pc with "
-+ "adjustment: {1}",
-+ GetID(), breakpoint_addr);
-+ return Error();
-+ }
-+ // If the breakpoint is not a software breakpoint, nothing to do.
-+ if (!breakpoint_sp->IsSoftwareBreakpoint()) {
-+ LLDB_LOG(
-+ log,
-+ "pid {0} breakpoint found at {1:x}, not software, nothing to adjust",
-+ GetID(), breakpoint_addr);
-+ return Error();
-+ }
-+ //
-+ // We have a software breakpoint and need to adjust the PC.
-+ //
-+ // Sanity check.
-+ if (breakpoint_size == 0) {
-+ // Nothing to do! How did we get here?
-+ LLDB_LOG(log,
-+ "pid {0} breakpoint found at {1:x}, it is software, but the "
-+ "size is zero, nothing to do (unexpected)",
-+ GetID(), breakpoint_addr);
-+ return Error();
-+ }
-+ // Change the program counter.
-+ LLDB_LOG(log, "pid {0} tid {1}: changing PC from {2:x} to {3:x}", GetID(),
-+ thread.GetID(), initial_pc_addr, breakpoint_addr);
-+ error = context_sp->SetPC(breakpoint_addr);
-+ if (error.Fail()) {
-+ LLDB_LOG(log, "pid {0} tid {1}: failed to set PC: {2}", GetID(),
-+ thread.GetID(), error);
-+ return error;
-+ }
-+ return error;
-+}
-+
-+Error NativeProcessNetBSD::SetBreakpoint(lldb::addr_t addr, uint32_t size,
-+ bool hardware) {
-+ if (hardware)
-+ return Error("NativeProcessNetBSD does not support hardware breakpoints");
-+ else
-+ return SetSoftwareBreakpoint(addr, size);
-+}
-+
-+Error NativeProcessNetBSD::GetSoftwareBreakpointTrapOpcode(
-+ size_t trap_opcode_size_hint, size_t &actual_opcode_size,
-+ const uint8_t *&trap_opcode_bytes) {
-+ static const uint8_t g_i386_opcode[] = {0xCC};
-+
-+ switch (m_arch.GetMachine()) {
-+ case llvm::Triple::x86:
-+ case llvm::Triple::x86_64:
-+ trap_opcode_bytes = g_i386_opcode;
-+ actual_opcode_size = sizeof(g_i386_opcode);
-+ return Error();
-+ default:
-+ assert(false && "CPU type not supported!");
-+ return Error("CPU type not supported");
-+ }
-+}
-+
-+Error NativeProcessNetBSD::GetSoftwareBreakpointPCOffset(
-+ uint32_t &actual_opcode_size) {
-+ // FIXME put this behind a breakpoint protocol class that can be
-+ // set per architecture. Need ARM, MIPS support here.
-+ static const uint8_t g_i386_opcode[] = {0xCC};
-+ switch (m_arch.GetMachine()) {
-+ case llvm::Triple::x86_64:
-+ actual_opcode_size = static_cast<uint32_t>(sizeof(g_i386_opcode));
-+ return Error();
-+ default:
-+ assert(false && "CPU type not supported!");
-+ return Error("CPU type not supported");
-+ }
-+}
-+
-+Error NativeProcessNetBSD::ReadMemory(lldb::addr_t addr, void *buf, size_t size,
-+ size_t &bytes_read) {
-+ unsigned char *dst = static_cast<unsigned char *>(buf);
-+ struct ptrace_io_desc io;
-+
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_MEMORY));
-+ LLDB_LOG(log, "addr = {0}, buf = {1}, size = {2}", addr, buf, size);
-+
-+ bytes_read = 0;
-+ io.piod_op = PIOD_READ_D;
-+ io.piod_len = size;
-+
-+ do {
-+ io.piod_offs = (void *)(addr + bytes_read);
-+ io.piod_addr = dst + bytes_read;
-+
-+ Error error = NativeProcessNetBSD::PtraceWrapper(
-+ PT_IO, GetID(), &io);
-+ if (error.Fail())
-+ return error;
-+
-+ bytes_read = io.piod_len;
-+ io.piod_len = size - bytes_read;
-+ } while(bytes_read < size);
-+
-+ return Error();
-+}
-+
-+Error NativeProcessNetBSD::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf,
-+ size_t size,
-+ size_t &bytes_read) {
-+ Error error = ReadMemory(addr, buf, size, bytes_read);
-+ if (error.Fail())
-+ return error;
-+ return m_breakpoint_list.RemoveTrapsFromBuffer(addr, buf, size);
-+}
-+
-+Error NativeProcessNetBSD::WriteMemory(lldb::addr_t addr, const void *buf,
-+ size_t size, size_t &bytes_written) {
-+ const unsigned char *src = static_cast<const unsigned char *>(buf);
-+ Error error;
-+ struct ptrace_io_desc io;
-+
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_MEMORY));
-+ LLDB_LOG(log, "addr = {0}, buf = {1}, size = {2}", addr, buf, size);
-+
-+ bytes_written = 0;
-+ io.piod_op = PIOD_WRITE_D;
-+ io.piod_len = size;
-+
-+ do {
-+ io.piod_addr = (void *)(src + bytes_written);
-+ io.piod_offs = (void *)(addr + bytes_written);
-+
-+ Error error = NativeProcessNetBSD::PtraceWrapper(
-+ PT_IO, GetID(), &io);
-+ if (error.Fail())
-+ return error;
-+
-+ bytes_written = io.piod_len;
-+ io.piod_len = size - bytes_written;
-+ } while(bytes_written < size);
-+
-+ return error;
-+}
-+
-+bool NativeProcessNetBSD::HasThreadNoLock(lldb::tid_t thread_id) {
-+ for (auto thread_sp : m_threads) {
-+ assert(thread_sp && "thread list should not contain NULL threads");
-+ if (thread_sp->GetID() == thread_id) {
-+ // We have this thread.
-+ return true;
-+ }
-+ }
-+
-+ // We don't have this thread.
-+ return false;
-+}
-+
-+NativeThreadNetBSDSP NativeProcessNetBSD::AddThread(lldb::tid_t thread_id) {
-+
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
-+ LLDB_LOG(log, "pid {0} adding thread with tid {1}", GetID(), thread_id);
-+
-+ assert(!HasThreadNoLock(thread_id) &&
-+ "attempted to add a thread by id that already exists");
-+
-+ // If this is the first thread, save it as the current thread
-+ if (m_threads.empty())
-+ SetCurrentThreadID(thread_id);
-+
-+ auto thread_sp = std::make_shared<NativeThreadNetBSD>(this, thread_id);
-+ m_threads.push_back(thread_sp);
-+ return thread_sp;
-+}
-+
-+Error NativeProcessNetBSD::GetLoadedModuleFileSpec(const char *module_path,
-+ FileSpec &file_spec) {
-+ FileSpec module_file_spec(module_path, true);
-+
-+ bool found = false;
-+ file_spec.Clear();
-+
-+ if (!found)
-+ return Error("Module file (%s) not found in /proc/%" PRIu64 "/maps file!",
-+ module_file_spec.GetFilename().AsCString(), GetID());
-+
-+ return Error();
-+}
-+
-+Error NativeProcessNetBSD::GetFileLoadAddress(const llvm::StringRef &file_name,
-+ lldb::addr_t &load_addr) {
-+ load_addr = LLDB_INVALID_ADDRESS;
-+ return Error();
-+}
-+
-+NativeThreadNetBSDSP NativeProcessNetBSD::GetThreadByID(lldb::tid_t tid) {
-+ return std::static_pointer_cast<NativeThreadNetBSD>(
-+ NativeProcessProtocol::GetThreadByID(tid));
-+}
-+
-+llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer> > NativeProcessNetBSD::GetAuxvData() const {
-+ /*
-+ * ELF_AUX_ENTRIES is currently restricted to kernel
-+ * (<sys/exec_elf.h> r. 1.155 specifies 15)
-+ *
-+ * ptrace(2) returns the whole AUXV including extra fiels after AT_NULL this
-+ * information isn't needed.
-+ */
-+ size_t auxv_size = 100 * sizeof(AuxInfo);
-+
-+ ErrorOr<std::unique_ptr<MemoryBuffer>> buf = llvm::MemoryBuffer::getNewMemBuffer(auxv_size);
-+
-+ struct ptrace_io_desc io = {
-+ .piod_op = PIOD_READ_AUXV,
-+ .piod_offs = 0,
-+ .piod_addr = (void *)buf.get()->getBufferStart(),
-+ .piod_len = auxv_size
-+ };
-+
-+ Error error = NativeProcessNetBSD::PtraceWrapper(
-+ PT_IO, GetID(), &io);
-+
-+ if (error.Fail())
-+ return std::error_code(error.GetError(), std::generic_category());
-+
-+ if (io.piod_len < 1)
-+ return std::error_code(ECANCELED, std::generic_category());
-+
-+ return buf;
-+}
-+
-+//===----------------------------------------------------------------------===//
-+
-+void NativeProcessNetBSD::SigchldHandler() {
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
-+ // Process all pending waitpid notifications.
-+ int status;
-+ ::pid_t wait_pid = waitpid(WAIT_ANY, &status, WALLSIG | WNOHANG);
-+
-+ if (wait_pid == 0)
-+ return; // We are done.
-+
-+ if (wait_pid == -1) {
-+ if (errno == EINTR)
-+ return;
-+
-+ Error error(errno, eErrorTypePOSIX);
-+ LLDB_LOG(log, "waitpid (-1, &status, _) failed: {0}", error);
-+ }
-+
-+ 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;
-+ exit_status = -1;
-+ }
-+ } else
-+ status_cstr = "(\?\?\?)";
-+
-+ LLDB_LOG(log,
-+ "waitpid (-1, &status, _) => pid = {0}, status = {1:x} "
-+ "({2}), signal = {3}, exit_state = {4}",
-+ wait_pid, status, status_cstr, signal, exit_status);
-+
-+ MonitorCallback(wait_pid, exited, signal, exit_status);
-+}
-+
-+// Wrapper for ptrace to catch errors and log calls.
-+// Note that ptrace sets errno on error because -1 can be a valid result (i.e.
-+// for PT_READ*)
-+Error NativeProcessNetBSD::PtraceWrapper(int req, lldb::pid_t pid, void *addr,
-+ int data, int *result) {
-+ Error error;
-+ int ret;
-+
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));
-+
-+ PtraceDisplayBytes(req, addr, data);
-+
-+ errno = 0;
-+ ret = ptrace(req, static_cast<::pid_t>(pid), addr, data);
-+
-+ if (ret == -1)
-+ error.SetErrorToErrno();
-+
-+ if (result)
-+ *result = ret;
-+
-+ LLDB_LOG(log, "ptrace({0}, {1}, {2}, {3}, {4})={6:x}", req, pid, addr,
-+ data, ret);
-+
-+ if (error.Fail())
-+ LLDB_LOG(log, "ptrace() failed: {0}", error);
-+
-+ return error;
-+}
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
index 5aa6db6ad8..afc76512f4 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
@@ -1,145 +1,2 @@
$NetBSD$
---- source/Plugins/Process/NetBSD/NativeProcessNetBSD.h.orig 2017-03-21 20:01:05.000000000 +0000
-+++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
-@@ -39,8 +39,140 @@ class NativeProcessNetBSD : public Nativ
- lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate,
- MainLoop &mainloop, NativeProcessProtocolSP &process_sp);
-
-+public:
-+ // ---------------------------------------------------------------------
-+ // NativeProcessProtocol Interface
-+ // ---------------------------------------------------------------------
-+ Error Resume(const ResumeActionList &resume_actions) override;
-+
-+ Error Halt() override;
-+
-+ Error Detach() override;
-+
-+ Error Signal(int signo) override;
-+
-+ Error Interrupt() override;
-+
-+ Error Kill() override;
-+
-+ Error GetMemoryRegionInfo(lldb::addr_t load_addr,
-+ MemoryRegionInfo &range_info) override;
-+
-+ Error ReadMemory(lldb::addr_t addr, void *buf, size_t size,
-+ size_t &bytes_read) override;
-+
-+ Error ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size,
-+ size_t &bytes_read) override;
-+
-+ Error WriteMemory(lldb::addr_t addr, const void *buf, size_t size,
-+ size_t &bytes_written) override;
-+
-+ Error AllocateMemory(size_t size, uint32_t permissions,
-+ lldb::addr_t &addr) override;
-+
-+ Error DeallocateMemory(lldb::addr_t addr) override;
-+
-+ lldb::addr_t GetSharedLibraryInfoAddress() override;
-+
-+ size_t UpdateThreads() override;
-+
-+ bool GetArchitecture(ArchSpec &arch) const override;
-+
-+ Error SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware) override;
-+
-+ void DoStopIDBumped(uint32_t newBumpId) override;
-+
-+ Error GetLoadedModuleFileSpec(const char *module_path,
-+ FileSpec &file_spec) override;
-+
-+ Error GetFileLoadAddress(const llvm::StringRef &file_name,
-+ lldb::addr_t &load_addr) override;
-+
-+ NativeThreadNetBSDSP GetThreadByID(lldb::tid_t id);
-+
-+ llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
-+ GetAuxvData() const override;
-+
-+ // ---------------------------------------------------------------------
-+ // Interface used by NativeRegisterContext-derived classes.
-+ // ---------------------------------------------------------------------
-+ static Error PtraceWrapper(int req, lldb::pid_t pid, void *addr = nullptr,
-+ int data = 0, int *result = nullptr);
-+
-+protected:
-+ // ---------------------------------------------------------------------
-+ // NativeProcessProtocol protected interface
-+ // ---------------------------------------------------------------------
-+
-+ Error
-+ GetSoftwareBreakpointTrapOpcode(size_t trap_opcode_size_hint,
-+ size_t &actual_opcode_size,
-+ const uint8_t *&trap_opcode_bytes) override;
-+
- private:
-+ MainLoop::SignalHandleUP m_sigchld_handle;
-+ ArchSpec m_arch;
-+
-+ LazyBool m_supports_mem_region;
-+ std::vector<std::pair<MemoryRegionInfo, FileSpec>> m_mem_region_cache;
-+
-+ lldb::tid_t m_pending_notification_tid;
-+
-+ // List of thread ids stepping with a breakpoint with the address of
-+ // the relevan breakpoint
-+ std::map<lldb::tid_t, lldb::addr_t> m_threads_stepping_with_breakpoint;
-+
-+ // ---------------------------------------------------------------------
-+ // Private Instance Methods
-+ // ---------------------------------------------------------------------
- NativeProcessNetBSD();
-+
-+ Error LaunchInferior(MainLoop &mainloop, ProcessLaunchInfo &launch_info);
-+
-+ /// Attaches to an existing process. Forms the
-+ /// implementation of Process::DoAttach
-+ void AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, Error &error);
-+
-+ ::pid_t Attach(lldb::pid_t pid, Error &error);
-+
-+ static Error SetDefaultPtraceOpts(const lldb::pid_t);
-+
-+ static void *MonitorThread(void *baton);
-+
-+ void MonitorCallback(lldb::pid_t pid, bool exited, int signal, int status);
-+
-+ void MonitorSIGTRAP(const siginfo_t &info, NativeThreadNetBSD &thread);
-+
-+ Error SetupSoftwareSingleStepping(NativeThreadNetBSD &thread);
-+
-+ bool HasThreadNoLock(lldb::tid_t thread_id);
-+
-+ NativeThreadNetBSDSP AddThread(lldb::tid_t thread_id);
-+
-+ Error GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size);
-+
-+ Error FixupBreakpointPCAsNeeded(NativeThreadNetBSD &thread);
-+
-+ /// Writes a siginfo_t structure corresponding to the given thread ID to the
-+ /// memory region pointed to by @p siginfo.
-+ Error GetSignalInfo(lldb::tid_t tid, void *siginfo);
-+
-+ void NotifyThreadDeath(lldb::tid_t tid);
-+
-+ Error Detach(lldb::tid_t tid);
-+
-+ // Notify the delegate if all threads have stopped.
-+ void SignalIfAllThreadsStopped();
-+
-+ // Resume the given thread, optionally passing it the given signal. The type
-+ // of resume
-+ // operation (continue, single-step) depends on the state parameter.
-+ Error ResumeThread(NativeThreadNetBSD &thread, lldb::StateType state,
-+ int signo);
-+
-+ void SigchldHandler();
-+
-+ Error PopulateMemoryRegionCache();
- };
-
- } // namespace process_netbsd
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp
index 813aa8cec8..73803f66f5 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp
@@ -1,29 +1,11 @@
$NetBSD$
---- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp.orig 2017-03-21 20:01:05.000000000 +0000
+--- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp.orig 2017-03-29 00:14:15.000000000 +0000
+++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
-@@ -9,6 +9,16 @@
-
- #include "NativeRegisterContextNetBSD.h"
-
-+#include "lldb/Core/RegisterValue.h"
-+#include "lldb/Host/common/NativeProcessProtocol.h"
-+#include "lldb/Host/common/NativeThreadProtocol.h"
-+
-+#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
-+
-+#include <sys/param.h>
-+#include <sys/types.h>
-+#include <sys/ptrace.h>
-+
- using namespace lldb_private;
- using namespace lldb_private::process_netbsd;
-
-@@ -17,3 +27,85 @@ NativeRegisterContextNetBSD::NativeRegis
- RegisterInfoInterface *reg_info_interface_p)
+@@ -25,6 +25,88 @@ NativeRegisterContextNetBSD::NativeRegis
: NativeRegisterContextRegisterInfo(native_thread, concrete_frame_idx,
reg_info_interface_p) {}
-+
+
+lldb::ByteOrder NativeRegisterContextNetBSD::GetByteOrder() const {
+ // Get the target process whose privileged thread was used for the register
+ // read.
@@ -105,3 +87,7 @@ $NetBSD$
+
+ return pid;
+}
++
+ Error NativeRegisterContextNetBSD::ReadGPR() {
+ void *buf = GetGPRBuffer();
+ if (!buf)
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
index 45a02212c8..afc76512f4 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
@@ -1,46 +1,2 @@
$NetBSD$
---- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h.orig 2017-03-21 20:01:05.000000000 +0000
-+++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
-@@ -33,6 +33,41 @@ public:
- CreateHostNativeRegisterContextNetBSD(const ArchSpec &target_arch,
- NativeThreadProtocol &native_thread,
- uint32_t concrete_frame_idx);
-+
-+protected:
-+ lldb::ByteOrder GetByteOrder() const;
-+
-+ virtual Error ReadGPR();
-+
-+ virtual Error WriteGPR();
-+
-+ virtual Error ReadFPR();
-+
-+ virtual Error WriteFPR();
-+
-+ virtual void *GetGPRBuffer() { return nullptr; }
-+
-+ virtual size_t GetGPRSize() {
-+ return GetRegisterInfoInterface().GetGPRSize();
-+ }
-+
-+ virtual void *GetFPRBuffer() { return nullptr; }
-+
-+ virtual void *GetDBRBuffer() { return nullptr; }
-+
-+ virtual size_t GetFPRSize() { return 0; }
-+
-+ virtual Error DoReadGPR(void *buf);
-+
-+ virtual Error DoWriteGPR(void *buf);
-+
-+ virtual Error DoReadFPR(void *buf);
-+
-+ virtual Error DoWriteFPR(void *buf);
-+
-+ virtual NativeProcessNetBSD &GetProcess();
-+
-+ virtual pid_t GetProcessPid();
- };
-
- } // namespace process_netbsd
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp
index 8d5c6e3806..35baaa9fba 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp
@@ -1,21 +1,11 @@
$NetBSD$
---- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp.orig 2017-03-18 01:37:22.341045276 +0000
+--- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp.orig 2017-03-29 00:14:15.000000000 +0000
+++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
-@@ -0,0 +1,553 @@
-+//===-- NativeRegisterContextNetBSD_x86_64.cpp ---------------*- C++ -*-===//
-+//
-+// The LLVM Compiler Infrastructure
-+//
-+// This file is distributed under the University of Illinois Open Source
-+// License. See LICENSE.TXT for details.
-+//
-+//===----------------------------------------------------------------------===//
-+
-+#if defined(__x86_64__)
-+
-+#include "NativeRegisterContextNetBSD_x86_64.h"
-+
+@@ -11,6 +11,559 @@
+
+ #include "NativeRegisterContextNetBSD_x86_64.h"
+
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Core/RegisterValue.h"
@@ -556,3 +546,19 @@ $NetBSD$
+}
+
+#endif // defined(__x86_64__)
++//===-- NativeRegisterContextNetBSD_x86_64.cpp ---------------*- C++ -*-===//
++//
++// The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++
++#if defined(__x86_64__)
++
++#include "NativeRegisterContextNetBSD_x86_64.h"
++
+ #include "lldb/Core/RegisterValue.h"
+ #include "lldb/Host/HostInfo.h"
+ #include "lldb/Utility/DataBufferHeap.h"
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h
index da612280a3..179d85187a 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h
@@ -1,8 +1,8 @@
$NetBSD$
---- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h.orig 2017-03-14 16:45:14.556385063 +0000
+--- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h.orig 2017-03-29 00:14:15.000000000 +0000
+++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
-@@ -0,0 +1,83 @@
+@@ -1,3 +1,86 @@
+//===-- NativeRegisterContextNetBSD_x86_64.h ---------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
@@ -86,3 +86,6 @@ $NetBSD$
+#endif // #ifndef lldb_NativeRegisterContextNetBSD_x86_64_h
+
+#endif // defined(__x86_64__)
+ //===-- NativeRegisterContextNetBSD_x86_64.h --------------------*- C++ -*-===//
+ //
+ // The LLVM Compiler Infrastructure
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
index b5018840b7..afc76512f4 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
@@ -1,405 +1,2 @@
$NetBSD$
---- source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp.orig 2017-03-23 15:49:53.000000000 +0000
-+++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
-@@ -11,11 +11,398 @@
- #include "NativeRegisterContextNetBSD.h"
-
- #include "NativeProcessNetBSD.h"
-+#include "lldb/Core/RegisterValue.h"
-+#include "lldb/Core/State.h"
-+
-+#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
-+
-+#include <sstream>
-+
-+#include <sys/param.h>
-+#include <sys/types.h>
-+#include <sys/ptrace.h>
-+#include <sys/poll.h>
-
- using namespace lldb;
- using namespace lldb_private;
- using namespace lldb_private::process_netbsd;
-
-+namespace {
-+void LogThreadStopInfo(Log &log, const ThreadStopInfo &stop_info,
-+ const char *const header) {
-+ switch (stop_info.reason) {
-+ case eStopReasonNone:
-+ log.Printf("%s: %s no stop reason", __FUNCTION__, header);
-+ return;
-+ case eStopReasonTrace:
-+ log.Printf("%s: %s trace, stopping signal 0x%" PRIx32, __FUNCTION__, header,
-+ stop_info.details.signal.signo);
-+ return;
-+ case eStopReasonBreakpoint:
-+ log.Printf("%s: %s breakpoint, stopping signal 0x%" PRIx32, __FUNCTION__,
-+ header, stop_info.details.signal.signo);
-+ return;
-+ case eStopReasonSignal:
-+ log.Printf("%s: %s signal 0x%02" PRIx32, __FUNCTION__, header,
-+ stop_info.details.signal.signo);
-+ return;
-+ case eStopReasonException:
-+ log.Printf("%s: %s exception type 0x%02" PRIx64, __FUNCTION__, header,
-+ stop_info.details.exception.type);
-+ return;
-+ case eStopReasonExec:
-+ log.Printf("%s: %s exec, stopping signal 0x%" PRIx32, __FUNCTION__, header,
-+ stop_info.details.signal.signo);
-+ return;
-+ case eStopReasonPlanComplete:
-+ log.Printf("%s: %s plan complete", __FUNCTION__, header);
-+ return;
-+ case eStopReasonThreadExiting:
-+ log.Printf("%s: %s thread exiting", __FUNCTION__, header);
-+ return;
-+ case eStopReasonInstrumentation:
-+ log.Printf("%s: %s instrumentation", __FUNCTION__, header);
-+ return;
-+ default:
-+ log.Printf("%s: %s invalid stop reason %" PRIu32, __FUNCTION__, header,
-+ static_cast<uint32_t>(stop_info.reason));
-+ }
-+}
-+}
-+
- NativeThreadNetBSD::NativeThreadNetBSD(NativeProcessNetBSD *process,
-- lldb::tid_t tid)
-- : NativeThreadProtocol(process, tid) {}
-+ lldb::tid_t tid)
-+ : NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid),
-+ m_stop_info(), m_reg_context_sp(), m_stop_description() {}
-+
-+std::string NativeThreadNetBSD::GetName() {
-+ NativeProcessProtocolSP process_sp = m_process_wp.lock();
-+ if (!process_sp)
-+ return "<unknown: no process>";
-+
-+ // const NativeProcessNetBSD *const process =
-+ // reinterpret_cast<NativeProcessNetBSD*> (process_sp->get ());
-+ llvm::SmallString<32> thread_name;
-+ return std::string("");
-+}
-+
-+lldb::StateType NativeThreadNetBSD::GetState() { return m_state; }
-+
-+bool NativeThreadNetBSD::GetStopReason(ThreadStopInfo &stop_info,
-+ std::string &description) {
-+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-+
-+ description.clear();
-+
-+ switch (m_state) {
-+ case eStateStopped:
-+ case eStateCrashed:
-+ case eStateExited:
-+ case eStateSuspended:
-+ case eStateUnloaded:
-+ if (log)
-+ LogThreadStopInfo(*log, m_stop_info, "m_stop_info in thread:");
-+ stop_info = m_stop_info;
-+ description = m_stop_description;
-+ if (log)
-+ LogThreadStopInfo(*log, stop_info, "returned stop_info:");
-+
-+ return true;
-+
-+ case eStateInvalid:
-+ case eStateConnected:
-+ case eStateAttaching:
-+ case eStateLaunching:
-+ case eStateRunning:
-+ case eStateStepping:
-+ case eStateDetached:
-+ if (log) {
-+ log->Printf("NativeThreadNetBSD::%s tid %" PRIu64
-+ " in state %s cannot answer stop reason",
-+ __FUNCTION__, GetID(), StateAsCString(m_state));
-+ }
-+ return false;
-+ }
-+ llvm_unreachable("unhandled StateType!");
-+}
-+
-+NativeRegisterContextSP NativeThreadNetBSD::GetRegisterContext() {
-+ // Return the register context if we already created it.
-+ if (m_reg_context_sp)
-+ return m_reg_context_sp;
-+
-+ NativeProcessProtocolSP m_process_sp = m_process_wp.lock();
-+ if (!m_process_sp)
-+ return NativeRegisterContextSP();
-+
-+ ArchSpec target_arch;
-+ if (!m_process_sp->GetArchitecture(target_arch))
-+ return NativeRegisterContextSP();
-+
-+ const uint32_t concrete_frame_idx = 0;
-+ m_reg_context_sp.reset(
-+ NativeRegisterContextNetBSD::CreateHostNativeRegisterContextNetBSD(
-+ target_arch, *this, concrete_frame_idx));
-+
-+ return m_reg_context_sp;
-+}
-+
-+Error NativeThreadNetBSD::SetWatchpoint(lldb::addr_t addr, size_t size,
-+ uint32_t watch_flags, bool hardware) {
-+ return Error();
-+}
-+
-+Error NativeThreadNetBSD::RemoveWatchpoint(lldb::addr_t addr) {
-+ return Error();
-+}
-+
-+void NativeThreadNetBSD::SetStoppedBySignal(uint32_t signo,
-+ const siginfo_t *info) {
-+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-+ if (log)
-+ log->Printf("NativeThreadNetBSD::%s called with signal %s (value 0x%02" PRIx32 ")",
-+ __FUNCTION__, strsignal(signo), signo);
-+
-+ m_state = eStateStopped;
-+
-+ m_stop_info.reason = StopReason::eStopReasonSignal;
-+ m_stop_info.details.signal.signo = signo;
-+
-+ std::ostringstream stringStream;
-+
-+ if (!info) {
-+ stringStream << "The signal " << strsignal(signo) << " was caught";
-+ m_stop_description = stringStream.str();
-+ return;
-+ }
-+
-+ switch(info->si_code) {
-+ case SI_USER:
-+ stringStream << "The signal " << strsignal(signo) << " was generated via kill(2) from pid="
-+ << info->si_pid << ", uid=" << info->si_uid;
-+ break;
-+ case SI_QUEUE:
-+ stringStream << "The signal " << strsignal(signo) << " was generated via sigqueue(2)";
-+ break;
-+ case SI_TIMER:
-+ stringStream << "The signal " << strsignal(signo) << " was generated because a timer set by timer_settime(2) has expired"
-+ << " with si_value set to sival_int=" << info->si_value.sival_int << " and "
-+ << "sival_ptr=" << info->si_value.sival_ptr;
-+ break;
-+ case SI_ASYNCIO:
-+ stringStream << "The signal " << strsignal(signo) << " was generated by completion of an asynchronous I/O operation with "
-+ << info->si_fd << " file descriptor number on which the operation was completed "
-+ << " and side and priority of the operation set to ";
-+ switch (info->si_band) {
-+ case POLLIN | POLLRDNORM:
-+ stringStream << "normal read ";
-+ break;
-+ case POLLPRI | POLLRDNORM:
-+ stringStream << "out-of-band read ";
-+ break;
-+ case POLLOUT | POLLWRNORM:
-+ stringStream << "normal write ";
-+ break;
-+ case POLLPRI | POLLWRBAND:
-+ stringStream << "normal write ";
-+ break;
-+ default:
-+ stringStream << "unspecified value ";
-+ }
-+ stringStream << std::hex << std::showbase << info->si_band;
-+ case SI_MESGQ:
-+ stringStream << "The signal " << strsignal(signo) << " was generated by arrival of a message on an empty message queue "
-+ << "with si_value set to sival_int=" << info->si_value.sival_int << " and "
-+ << "sival_ptr=" << info->si_value.sival_ptr;
-+ case SI_LWP:
-+ stringStream << "The signal " << strsignal(signo) << " was generated via _lwp_kill(2) from pid="
-+ << info->si_pid << ", uid=" << info->si_uid;
-+ break;
-+ case SI_NOINFO:
-+ stringStream << "The signal " << strsignal(signo) << " was generated with no signal specific info available";
-+ break;
-+ default:
-+ switch (info->si_signo) {
-+ case SIGTRAP:
-+ stringStream << "SIGTRAP has been caught with ";
-+ switch (info->si_code) {
-+ case TRAP_BRKPT:
-+ stringStream << "Process Breakpoint type";
-+ break;
-+ case TRAP_TRACE:
-+ stringStream << "Process Trace Trap type";
-+ break;
-+ case TRAP_EXEC:
-+ stringStream << "Process Exec Trap type";
-+ break;
-+ case TRAP_CHLD:
-+ stringStream << "Process Child Trap type";
-+ break;
-+ case TRAP_LWP:
-+ stringStream << "Process LWP Trap type";
-+ break;
-+ default:
-+ stringStream << "unknown si_code value " << std::hex << std::showbase
-+ << info->si_code;
-+ }
-+ break;
-+ case SIGCHLD:
-+ stringStream << "SIGCHLD has been caught with ";
-+ switch (info->si_code) {
-+ case CLD_EXITED:
-+ stringStream << "Child Has Exited type";
-+ break;
-+ case CLD_KILLED:
-+ stringStream << "Child Has Terminated Abnormally "
-+ "(without a core file) type";
-+ break;
-+ case CLD_DUMPED:
-+ stringStream << "Child Has Terminated Abnormally "
-+ << "(with a core file) type";
-+ break;
-+ case CLD_TRAPPED:
-+ stringStream << "Child Has Trapped type";
-+ break;
-+ case CLD_STOPPED:
-+ stringStream << "Child Has Stopped type";
-+ break;
-+ case CLD_CONTINUED:
-+ stringStream << "Child Has Continued type";
-+ break;
-+ default:
-+ stringStream << "unknown si_code value " << std::hex << std::showbase
-+ << info->si_code;
-+ }
-+ stringStream << "with pid=" << std::dec << info->si_pid << " of the process who's status "
-+ << "changed, user id=" << info->si_uid << " of that process, "
-+ << std::hex << std::showbase << ((info->si_code == CLD_EXITED) ?
-+ "exit code of the process " : "signal number received by the process ")
-+ << std::dec << info->si_status << ", user process accounting time "
-+ << info->si_utime << ", system process accounting time " << info->si_stime;
-+ break;
-+ case SIGIO:
-+ stringStream << "SIGIO has been caught with ";
-+ switch (info->si_code) {
-+ case POLL_IN:
-+ stringStream << "Data Input Available type";
-+ break;
-+ case POLL_OUT:
-+ stringStream << "Output Buffers Available type";
-+ break;
-+ case POLL_MSG:
-+ stringStream << "Input Message type";
-+ break;
-+ case POLL_ERR:
-+ stringStream << "I/O Error type";
-+ break;
-+ case POLL_PRI:
-+ stringStream << "High Priority Input Available type";
-+ break;
-+ case POLL_HUP:
-+ stringStream << "Device Disconnected type";
-+ break;
-+ default:
-+ stringStream << "unknown si_code value " << std::hex << std::showbase
-+ << info->si_code;
-+ }
-+ stringStream << "with " << std::dec << info->si_fd << " file descriptor number on which the "
-+ << "operation was completed and side and priority of the operation set to ";
-+ switch (info->si_band) {
-+ case POLLIN | POLLRDNORM:
-+ stringStream << "normal read ";
-+ break;
-+ case POLLPRI | POLLRDNORM:
-+ stringStream << "out-of-band read ";
-+ break;
-+ case POLLOUT | POLLWRNORM:
-+ stringStream << "normal write ";
-+ break;
-+ case POLLPRI | POLLWRBAND:
-+ stringStream << "normal write ";
-+ break;
-+ default:
-+ stringStream << "unspecified value ";
-+ }
-+ stringStream << std::hex << std::showbase << info->si_band;
-+
-+ break;
-+ /* The following signals are defined by POSIX common platform code */
-+ case SIGSEGV:
-+ case SIGBUS:
-+ case SIGFPE:
-+ case SIGILL:
-+// stringStream << GetCrashReasonString(GetCrashReason(*info), *info);
-+ break;
-+ default:
-+ stringStream << "The signal " << strsignal(info->si_signo) << " was caught";
-+ }
-+ }
-+ m_stop_description = stringStream.str();
-+}
-+
-+void NativeThreadNetBSD::SetStopped() {
-+ const StateType new_state = StateType::eStateStopped;
-+ m_state = new_state;
-+ m_stop_description.clear();
-+}
-+
-+void NativeThreadNetBSD::SetStoppedByExec() {
-+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-+ if (log)
-+ log->Printf("NativeThreadNetBSD::%s()", __FUNCTION__);
-+ SetStopped();
-+ m_stop_info.reason = StopReason::eStopReasonExec;
-+ m_stop_info.details.signal.signo = SIGTRAP;
-+}
-+
-+void NativeThreadNetBSD::SetRunning() {
-+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-+ if (log)
-+ log->Printf("NativeThreadNetBSD::%s()", __FUNCTION__);
-+
-+ m_state = StateType::eStateRunning;
-+ m_stop_info.reason = StopReason::eStopReasonNone;
-+}
-+
-+void NativeThreadNetBSD::SetStepping() {
-+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-+ if (log)
-+ log->Printf("NativeThreadNetBSD::%s()", __FUNCTION__);
-+
-+ m_state = StateType::eStateStepping;
-+ m_stop_info.reason = StopReason::eStopReasonNone;
-+}
-+
-+void NativeThreadNetBSD::SetStoppedByTrace() {
-+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-+ if (log)
-+ log->Printf("NativeThreadNetBSD::%s()", __FUNCTION__);
-+ SetStopped();
-+ m_stop_info.reason = StopReason::eStopReasonTrace;
-+ m_stop_info.details.signal.signo = SIGTRAP;
-+}
-+
-+void NativeThreadNetBSD::SetStoppedByBreakpoint() {
-+ Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
-+ if (log)
-+ log->Printf("NativeThreadNetBSD::%s()", __FUNCTION__);
-+ SetStopped();
-+ m_stop_info.reason = StopReason::eStopReasonBreakpoint;
-+ m_stop_info.details.signal.signo = SIGTRAP;
-+}
-+
-+NativeProcessNetBSD &NativeThreadNetBSD::GetProcess() {
-+ auto process_sp = std::static_pointer_cast<NativeProcessNetBSD>(
-+ NativeThreadProtocol::GetProcess());
-+ assert(process_sp);
-+ return *process_sp;
-+}
-+
-+Error NativeThreadNetBSD::SetHardwareBreakpoint(lldb::addr_t addr,
-+ size_t size) {
-+ return Error();
-+}
-+
-+Error NativeThreadNetBSD::RemoveHardwareBreakpoint(lldb::addr_t addr) {
-+ return Error();
-+}
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
index b2397f1c11..afc76512f4 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
@@ -1,64 +1,2 @@
$NetBSD$
---- source/Plugins/Process/NetBSD/NativeThreadNetBSD.h.orig 2017-03-21 20:01:05.000000000 +0000
-+++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
-@@ -22,6 +22,59 @@ class NativeThreadNetBSD : public Native
-
- public:
- NativeThreadNetBSD(NativeProcessNetBSD *process, lldb::tid_t tid);
-+
-+ // ---------------------------------------------------------------------
-+ // NativeThreadProtocol Interface
-+ // ---------------------------------------------------------------------
-+ std::string GetName() override;
-+
-+ lldb::StateType GetState() override;
-+
-+ bool GetStopReason(ThreadStopInfo &stop_info,
-+ std::string &description) override;
-+
-+ NativeRegisterContextSP GetRegisterContext() override;
-+
-+ Error SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags,
-+ bool hardware) override;
-+
-+ Error RemoveWatchpoint(lldb::addr_t addr) override;
-+
-+ Error SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override;
-+
-+ Error RemoveHardwareBreakpoint(lldb::addr_t addr) override;
-+
-+private:
-+ // ---------------------------------------------------------------------
-+ // Interface for friend classes
-+ // ---------------------------------------------------------------------
-+
-+ void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr);
-+
-+ void SetStoppedByExec();
-+
-+ void SetStoppedByTrace();
-+
-+ void SetStoppedByBreakpoint();
-+
-+ void SetRunning();
-+
-+ void SetStepping();
-+
-+ // ---------------------------------------------------------------------
-+ // Private interface
-+ // ---------------------------------------------------------------------
-+ NativeProcessNetBSD &GetProcess();
-+
-+ void SetStopped();
-+
-+ // ---------------------------------------------------------------------
-+ // Member Variables
-+ // ---------------------------------------------------------------------
-+ lldb::StateType m_state;
-+ ThreadStopInfo m_stop_info;
-+ NativeRegisterContextSP m_reg_context_sp;
-+ std::string m_stop_description;
- };
-
- typedef std::shared_ptr<NativeThreadNetBSD> NativeThreadNetBSDSP;
Home |
Main Index |
Thread Index |
Old Index