pkgsrc-WIP-changes archive

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

lldb-git: Prepare Native Process NetBSD stub for upstream



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Mon Mar 20 16:44:18 2017 +0100
Changeset:	f099d6dbcc7b4642ebac1196ffcde495bb25bca3

Modified Files:
	lldb-git/distinfo
Added Files:
	lldb-git/patches/patch-source_Plugins_Process_CMakeLists.txt
	lldb-git/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt
	lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
	lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
	lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp
	lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
	lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
	lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
	lldb-git/patches/patch-tools_lldb-server_CMakeLists.txt

Log Message:
lldb-git: Prepare Native Process NetBSD stub for upstream

These files are placeholders for further compilation.

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

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

diffstat:
 lldb-git/distinfo                                  |   9 +
 .../patch-source_Plugins_Process_CMakeLists.txt    |  12 ++
 ...ch-source_Plugins_Process_NetBSD_CMakeLists.txt |  25 +++
 ..._Plugins_Process_NetBSD_NativeProcessNetBSD.cpp | 205 +++++++++++++++++++++
 ...ce_Plugins_Process_NetBSD_NativeProcessNetBSD.h | 189 +++++++++++++++++++
 ..._Process_NetBSD_NativeRegisterContextNetBSD.cpp |  54 ++++++
 ...ns_Process_NetBSD_NativeRegisterContextNetBSD.h |  81 ++++++++
 ...e_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp | 102 ++++++++++
 ...rce_Plugins_Process_NetBSD_NativeThreadNetBSD.h |  89 +++++++++
 .../patches/patch-tools_lldb-server_CMakeLists.txt |  12 ++
 10 files changed, 778 insertions(+)

diffs:
diff --git a/lldb-git/distinfo b/lldb-git/distinfo
index 7931384fd5..c6417664be 100644
--- a/lldb-git/distinfo
+++ b/lldb-git/distinfo
@@ -12,3 +12,12 @@ Size (libcxx-3.6.2.src.tar.xz) = 944020 bytes
 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-source_Plugins_Process_CMakeLists.txt) = d12bf5e389eb70defd4c0b277d7d726d3d304f15
+SHA1 (patch-source_Plugins_Process_NetBSD_CMakeLists.txt) = aff9f4a875882ae5ce1221509272eb1b3c403587
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 5d06543c311358b4c685b5fc5fcea042b0afa211
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = 386f78d8cfa5fe4e39c11c36f00e5cabb587eb4d
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp) = 546b4414518e24c4d570ed512a3dc76317cacdc7
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h) = 141c88b0de12d5e8b1e4cda115eb0addfa5fc151
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = 8c7fe458fd47609db75e95f0dcfb70a3eba43815
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = 6977cdde31fd71435eda6ea2e3540f2f50ff9d52
+SHA1 (patch-tools_lldb-server_CMakeLists.txt) = 1faf185bcadc90dac87beced1f7b949d62144292
diff --git a/lldb-git/patches/patch-source_Plugins_Process_CMakeLists.txt b/lldb-git/patches/patch-source_Plugins_Process_CMakeLists.txt
new file mode 100644
index 0000000000..bc0f72258c
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_CMakeLists.txt
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- source/Plugins/Process/CMakeLists.txt.orig	2017-02-23 07:09:45.000000000 +0000
++++ source/Plugins/Process/CMakeLists.txt
+@@ -5,6 +5,7 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "FreeB
+   add_subdirectory(FreeBSD)
+   add_subdirectory(POSIX)
+ elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
++  add_subdirectory(NetBSD)
+   add_subdirectory(POSIX)
+ elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
+   add_subdirectory(Windows/Common)
diff --git a/lldb-git/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt
new file mode 100644
index 0000000000..e70de23341
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt
@@ -0,0 +1,25 @@
+$NetBSD$
+
+--- source/Plugins/Process/NetBSD/CMakeLists.txt.orig	2017-03-20 16:10:36.196207069 +0000
++++ source/Plugins/Process/NetBSD/CMakeLists.txt
+@@ -0,0 +1,20 @@
++include_directories(.)
++include_directories(../POSIX)
++include_directories(../Utility)
++
++add_lldb_library(lldbPluginProcessNetBSD PLUGIN
++  NativeProcessNetBSD.cpp
++  NativeRegisterContextNetBSD.cpp
++  NativeThreadNetBSD.cpp
++
++  LINK_LIBS
++    lldbCore
++    lldbHost
++    lldbSymbol
++    lldbTarget
++    lldbUtility
++    lldbPluginProcessPOSIX
++    lldbPluginProcessUtility
++  LINK_COMPONENTS
++    Support
++  )
diff --git a/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
new file mode 100644
index 0000000000..edff9bf744
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
@@ -0,0 +1,205 @@
+$NetBSD$
+
+--- source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp.orig	2017-03-20 16:10:36.201719451 +0000
++++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+@@ -0,0 +1,200 @@
++//===-- NativeProcessNetBSD.cpp ------------------------------- -*- C++ -*-===//
++//
++//                     The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++
++#include "NativeProcessNetBSD.h"
++
++// C Includes
++
++// C++ Includes
++
++// Other libraries and framework includes
++
++#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
++
++using namespace lldb;
++using namespace lldb_private;
++using namespace lldb_private::process_netbsd;
++using namespace llvm;
++
++namespace {
++void MaybeLogLaunchInfo(const ProcessLaunchInfo &info) {}
++
++void DisplayBytes(StreamString &s, void *bytes, uint32_t count) {}
++
++void PtraceDisplayBytes(int &req, void *addr, int data) {}
++
++} // end of anonymous namespace
++
++// -----------------------------------------------------------------------------
++// Public Static Methods
++// -----------------------------------------------------------------------------
++
++Error NativeProcessProtocol::Launch(
++    ProcessLaunchInfo &launch_info,
++    NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop,
++    NativeProcessProtocolSP &native_process_sp) {
++  return Error();
++}
++
++Error NativeProcessProtocol::Attach(
++    lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate,
++    MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) {
++  return Error();
++}
++
++// -----------------------------------------------------------------------------
++// 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) {}
++
++void NativeProcessNetBSD::AttachToInferior(MainLoop &mainloop, lldb::pid_t pid,
++                                           Error &error) {}
++
++Error NativeProcessNetBSD::LaunchInferior(MainLoop &mainloop,
++                                          ProcessLaunchInfo &launch_info) {
++  return Error();
++}
++
++::pid_t NativeProcessNetBSD::Attach(lldb::pid_t pid, Error &error) {
++  return -1;
++}
++
++Error NativeProcessNetBSD::SetDefaultPtraceOpts(lldb::pid_t pid) {
++  return Error();
++}
++
++// Handles all waitpid events from the inferior process.
++void NativeProcessNetBSD::MonitorCallback(lldb::pid_t pid, bool exited,
++                                          int signal, int status) {}
++
++Error NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) {
++  return Error();
++}
++
++Error NativeProcessNetBSD::Halt() { return Error(); }
++
++Error NativeProcessNetBSD::Detach() { return Error(); }
++
++Error NativeProcessNetBSD::Signal(int signo) { return Error(); }
++
++Error NativeProcessNetBSD::Interrupt() { return Error(); }
++
++Error NativeProcessNetBSD::Kill() { return Error(); }
++
++Error NativeProcessNetBSD::GetMemoryRegionInfo(lldb::addr_t load_addr,
++                                               MemoryRegionInfo &range_info) {
++  return Error();
++}
++
++Error NativeProcessNetBSD::PopulateMemoryRegionCache() { return Error(); }
++
++Error NativeProcessNetBSD::AllocateMemory(size_t size, uint32_t permissions,
++                                          lldb::addr_t &addr) {
++  return Error();
++}
++
++Error NativeProcessNetBSD::DeallocateMemory(lldb::addr_t addr) {
++  return Error("not implemented");
++}
++
++lldb::addr_t NativeProcessNetBSD::GetSharedLibraryInfoAddress() {
++  return LLDB_INVALID_ADDRESS;
++}
++
++size_t NativeProcessNetBSD::UpdateThreads() { return 0; }
++
++bool NativeProcessNetBSD::GetArchitecture(ArchSpec &arch) const {
++  arch = m_arch;
++  return true;
++}
++
++Error NativeProcessNetBSD::FixupBreakpointPCAsNeeded(
++    NativeThreadNetBSD &thread) {
++  return Error();
++}
++
++Error NativeProcessNetBSD::SetBreakpoint(lldb::addr_t addr, uint32_t size,
++                                         bool hardware) {
++  return Error();
++}
++
++Error NativeProcessNetBSD::GetSoftwareBreakpointTrapOpcode(
++    size_t trap_opcode_size_hint, size_t &actual_opcode_size,
++    const uint8_t *&trap_opcode_bytes) {
++  return Error();
++}
++
++Error NativeProcessNetBSD::GetSoftwareBreakpointPCOffset(
++    uint32_t &actual_opcode_size) {
++  return Error();
++}
++
++Error NativeProcessNetBSD::ReadMemory(lldb::addr_t addr, void *buf, size_t size,
++                                      size_t &bytes_read) {
++  return Error();
++}
++
++Error NativeProcessNetBSD::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf,
++                                                 size_t size,
++                                                 size_t &bytes_read) {
++  return Error();
++}
++
++Error NativeProcessNetBSD::WriteMemory(lldb::addr_t addr, const void *buf,
++                                       size_t size, size_t &bytes_written) {
++  return Error();
++}
++
++bool NativeProcessNetBSD::HasThreadNoLock(lldb::tid_t thread_id) {
++  return false;
++}
++
++NativeThreadNetBSDSP NativeProcessNetBSD::AddThread(lldb::tid_t 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) {
++  return Error();
++}
++
++Error NativeProcessNetBSD::GetFileLoadAddress(const llvm::StringRef &file_name,
++                                              lldb::addr_t &load_addr) {
++  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 {}
++
++//===----------------------------------------------------------------------===//
++
++void NativeProcessNetBSD::SigchldHandler() {}
++
++// 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) {
++  return Error();
++}
diff --git a/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
new file mode 100644
index 0000000000..c4e67830a0
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h
@@ -0,0 +1,189 @@
+$NetBSD$
+
+--- source/Plugins/Process/NetBSD/NativeProcessNetBSD.h.orig	2017-03-20 16:10:36.207245342 +0000
++++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
+@@ -0,0 +1,184 @@
++//===-- NativeProcessNetBSD.h --------------------------------- -*- C++ -*-===//
++//
++//                     The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++
++#ifndef liblldb_NativeProcessNetBSD_H_
++#define liblldb_NativeProcessNetBSD_H_
++
++// C++ Includes
++
++// Other libraries and framework includes
++
++#include "lldb/Core/ArchSpec.h"
++#include "lldb/Host/FileSpec.h"
++#include "lldb/Target/MemoryRegionInfo.h"
++
++#include "NativeThreadNetBSD.h"
++#include "lldb/Host/common/NativeProcessProtocol.h"
++
++namespace lldb_private {
++class Error;
++class Scalar;
++
++namespace process_netbsd {
++/// @class NativeProcessNetBSD
++/// @brief Manages communication with the inferior (debugee) process.
++///
++/// Upon construction, this class prepares and launches an inferior process for
++/// debugging.
++///
++/// Changes in the inferior process state are broadcasted.
++class NativeProcessNetBSD : public NativeProcessProtocol {
++  friend Error NativeProcessProtocol::Launch(
++      ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate,
++      MainLoop &mainloop, NativeProcessProtocolSP &process_sp);
++
++  friend Error NativeProcessProtocol::Attach(
++      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
++} // namespace lldb_private
++
++#endif // #ifndef liblldb_NativeProcessNetBSD_H_
diff --git a/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp
new file mode 100644
index 0000000000..aa7ac9e860
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp
@@ -0,0 +1,54 @@
+$NetBSD$
+
+--- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp.orig	2017-03-20 16:20:34.638783816 +0000
++++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
+@@ -0,0 +1,49 @@
++//===-- NativeRegisterContextNetBSD.cpp --------------------------*- C++
++//-*-===//
++//
++//                     The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++
++#include "NativeRegisterContextNetBSD.h"
++
++using namespace lldb_private;
++using namespace lldb_private::process_netbsd;
++
++NativeRegisterContextNetBSD::NativeRegisterContextNetBSD(
++    NativeThreadProtocol &native_thread, uint32_t concrete_frame_idx,
++    RegisterInfoInterface *reg_info_interface_p)
++    : NativeRegisterContextRegisterInfo(native_thread, concrete_frame_idx,
++                                        reg_info_interface_p) {}
++
++lldb::ByteOrder NativeRegisterContextNetBSD::GetByteOrder() const {
++  return lldb::eByteOrderInvalid;
++}
++
++Error NativeRegisterContextNetBSD::ReadGPR() { return Error(); }
++
++Error NativeRegisterContextNetBSD::WriteGPR() { return Error(); }
++
++Error NativeRegisterContextNetBSD::ReadFPR() { return Error(); }
++
++Error NativeRegisterContextNetBSD::WriteFPR() { return Error(); }
++
++Error NativeRegisterContextNetBSD::DoReadGPR(void *buf) { return Error(); }
++
++Error NativeRegisterContextNetBSD::DoWriteGPR(void *buf) { return Error(); }
++
++Error NativeRegisterContextNetBSD::DoReadFPR(void *buf) { return Error(); }
++
++Error NativeRegisterContextNetBSD::DoWriteFPR(void *buf) { return Error(); }
++
++NativeProcessNetBSD &NativeRegisterContextNetBSD::GetProcess() {
++  auto process_sp =
++      std::static_pointer_cast<NativeProcessNetBSD>(m_thread.GetProcess());
++  assert(process_sp);
++  return *process_sp;
++}
++
++::pid_t NativeRegisterContextNetBSD::GetProcessPid() { return -1; }
diff --git a/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
new file mode 100644
index 0000000000..a514474eb7
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
@@ -0,0 +1,81 @@
+$NetBSD$
+
+--- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h.orig	2017-03-20 16:20:31.692818842 +0000
++++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
+@@ -0,0 +1,76 @@
++//===-- NativeRegisterContextNetBSD.h ---------------------------*- C++ -*-===//
++//
++//                     The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++
++#ifndef lldb_NativeRegisterContextNetBSD_h
++#define lldb_NativeRegisterContextNetBSD_h
++
++#include "lldb/Host/common/NativeRegisterContextRegisterInfo.h"
++#include "lldb/Host/common/NativeThreadProtocol.h"
++
++#include "Plugins/Process/NetBSD/NativeProcessNetBSD.h"
++
++namespace lldb_private {
++namespace process_netbsd {
++
++class NativeRegisterContextNetBSD : public NativeRegisterContextRegisterInfo {
++public:
++  NativeRegisterContextNetBSD(NativeThreadProtocol &native_thread,
++                              uint32_t concrete_frame_idx,
++                              RegisterInfoInterface *reg_info_interface_p);
++
++  // This function is implemented in the NativeRegisterContextNetBSD_*
++  // subclasses to create a new instance of the host specific
++  // NativeRegisterContextNetBSD. The implementations can't collide as only one
++  // NativeRegisterContextNetBSD_* variant should be compiled into the final
++  // executable.
++  static NativeRegisterContextNetBSD *
++  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
++} // namespace lldb_private
++
++#endif // #ifndef lldb_NativeRegisterContextNetBSD_h
diff --git a/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
new file mode 100644
index 0000000000..c3fbb74ce6
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
@@ -0,0 +1,102 @@
+$NetBSD$
+
+--- source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp.orig	2017-03-20 16:13:14.305070457 +0000
++++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
+@@ -0,0 +1,97 @@
++//===-- NativeThreadNetBSD.cpp -------------------------------- -*- C++ -*-===//
++//
++//                     The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++
++#include "NativeThreadNetBSD.h"
++#include "NativeRegisterContextNetBSD.h"
++
++#include "NativeProcessNetBSD.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) {}
++} // namespace
++
++NativeThreadNetBSD::NativeThreadNetBSD(NativeProcessNetBSD *process,
++                                       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() { return std::string(); }
++
++lldb::StateType NativeThreadNetBSD::GetState() { return m_state; }
++
++bool NativeThreadNetBSD::GetStopReason(ThreadStopInfo &stop_info,
++                                       std::string &description) {
++  return false;
++}
++
++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) {}
++
++void NativeThreadNetBSD::SetStopped() {}
++
++void NativeThreadNetBSD::SetStoppedByExec() {}
++
++void NativeThreadNetBSD::SetRunning() {}
++
++void NativeThreadNetBSD::SetStepping() {}
++
++void NativeThreadNetBSD::SetStoppedByTrace() {}
++
++void NativeThreadNetBSD::SetStoppedByBreakpoint() {}
++
++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-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
new file mode 100644
index 0000000000..5527a040f5
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
@@ -0,0 +1,89 @@
+$NetBSD$
+
+--- source/Plugins/Process/NetBSD/NativeThreadNetBSD.h.orig	2017-03-20 16:13:07.667474250 +0000
++++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
+@@ -0,0 +1,84 @@
++//===-- NativeThreadNetBSD.h ---------------------------------- -*- C++ -*-===//
++//
++//                     The LLVM Compiler Infrastructure
++//
++// This file is distributed under the University of Illinois Open Source
++// License. See LICENSE.TXT for details.
++//
++//===----------------------------------------------------------------------===//
++
++#ifndef liblldb_NativeThreadNetBSD_H_
++#define liblldb_NativeThreadNetBSD_H_
++
++#include "lldb/Host/common/NativeThreadProtocol.h"
++
++namespace lldb_private {
++namespace process_netbsd {
++
++class NativeProcessNetBSD;
++
++class NativeThreadNetBSD : public NativeThreadProtocol {
++  friend class NativeProcessNetBSD;
++
++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;
++} // namespace process_netbsd
++} // namespace lldb_private
++
++#endif // #ifndef liblldb_NativeThreadNetBSD_H_
diff --git a/lldb-git/patches/patch-tools_lldb-server_CMakeLists.txt b/lldb-git/patches/patch-tools_lldb-server_CMakeLists.txt
new file mode 100644
index 0000000000..70025c050a
--- /dev/null
+++ b/lldb-git/patches/patch-tools_lldb-server_CMakeLists.txt
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- tools/lldb-server/CMakeLists.txt.orig	2017-02-23 07:09:45.000000000 +0000
++++ tools/lldb-server/CMakeLists.txt
+@@ -17,6 +17,7 @@ endif ()
+ if ( CMAKE_SYSTEM_NAME MATCHES "NetBSD" )
+ include_directories(
+   ../../../../llvm/include
++  ../../source/Plugins/Process/NetBSD
+   ../../source/Plugins/Process/POSIX
+   )
+ endif ()


Home | Main Index | Thread Index | Old Index