pkgsrc-WIP-changes archive

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

lldb-netbsd: Fix AUXV reading; fix setting brakpoint; update TODO



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Mon Mar 13 12:50:49 2017 +0100
Changeset:	ca5ff2e3f069aae45b17da689e9dbb987817a693

Modified Files:
	lldb-netbsd/TODO
	lldb-netbsd/distinfo
	lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
	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
Added Files:
	lldb-netbsd/patches/patch-source_Core_FormatEntity.cpp
	lldb-netbsd/patches/patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp
	lldb-netbsd/patches/patch-source_Plugins_DynamicLoader_POSIX-DYLD_DynamicLoaderPOSIXDYLD.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ThreadElfCore.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_minidump_ProcessMinidump.cpp

Log Message:
lldb-netbsd: Fix AUXV reading; fix setting brakpoint; update TODO

xmm2, ymm0-ymm15 recognizion works; but it's not finished

auxv reading works good enough for now; it might be taylored down later

getthreadname / setthreadname has been... moved to llvm

reading general purpose registers work

setting and detecting breakpoint appear to work, but a trap is not unset
and program is getting corrupted later

TODO on amd64:
 - fix breakpoints
 - FPR registers support
 - debug registers support

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

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

diffstat:
 lldb-netbsd/TODO                                   |  7 +-
 lldb-netbsd/distinfo                               | 15 ++--
 .../patches/patch-source_Core_FormatEntity.cpp     | 14 ++++
 ...ins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp | 12 +++
 ...micLoader_POSIX-DYLD_DynamicLoaderPOSIXDYLD.cpp | 14 ++++
 ..._Plugins_Process_NetBSD_NativeProcessNetBSD.cpp | 94 +++++++++++++++++++++-
 ..._Process_NetBSD_NativeRegisterContextNetBSD.cpp |  2 +-
 ...ns_Process_NetBSD_NativeRegisterContextNetBSD.h |  2 +-
 ...NetBSD_NativeRegisterContextNetBSD__x86__64.cpp |  2 +-
 ...s_NetBSD_NativeRegisterContextNetBSD__x86__64.h |  2 +-
 ...urce_Plugins_Process_elf-core_ThreadElfCore.cpp | 30 +++++++
 ...ce_Plugins_Process_minidump_ProcessMinidump.cpp | 14 ++++
 12 files changed, 192 insertions(+), 16 deletions(-)

diffs:
diff --git a/lldb-netbsd/TODO b/lldb-netbsd/TODO
index 7cefec1328..178aed67c5 100644
--- a/lldb-netbsd/TODO
+++ b/lldb-netbsd/TODO
@@ -24,11 +24,10 @@ Introduce objc++ setup with gcc(1) for "make test":
 
 To be done
 ==========
- - xmm2, ymm0-ymm15 unrecognized in qRegisterInfo??? calls
- - auxv reading verified and upstreamed
- - getthreadname / setthreadname verified and upstreamed
+ - breakpoint support (amd64)
+ - FPR registers' accessors (amd64)
+ - debug registers support (amd64)
  - Host::LaunchProcessPosixSpawn verify ::posix_spawnattr_setsigdefault on NetBSD
- - registers' accessors
  - single step support
  - thread resume/suspend operation
  - i386 support
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 39e7190a1b..3e5dd70948 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -14,6 +14,7 @@ RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
 SHA1 (patch-include_lldb_Host_netbsd_HostThreadNetBSD.h) = 79f207cdb9da2ef57d39eeb307ec6d10cf828925
 SHA1 (patch-source_CMakeLists.txt) = 5dacabc3f39c23bdfd432b5a4895866157b97aa0
+SHA1 (patch-source_Core_FormatEntity.cpp) = d0ccec75b69864f4b6c4e56587bd272f8b0beb01
 SHA1 (patch-source_Host_CMakeLists.txt) = 28c31759dd684ff44d2f3c5a53c97edf8abb3a17
 SHA1 (patch-source_Host_common_Host.cpp) = 7d48b8bb1e4350ba6d3ddc6357b9b8dc82d6b32d
 SHA1 (patch-source_Host_common_NativeProcessProtocol.cpp) = 23cc7da280b2123cf0206f3d5660d2647935edbc
@@ -21,16 +22,20 @@ SHA1 (patch-source_Host_netbsd_Host.cpp) = f18a87c0ac3b1549045a4d9bda964dfc2baa4
 SHA1 (patch-source_Host_netbsd_HostThreadNetBSD.cpp) = a1b0fbdad062309a845cfefe4469614fbbe9d20e
 SHA1 (patch-source_Host_netbsd_ThisThread.cpp) = f0d32c81bc1b8fe9aeb86519ea46ba2cb16571c2
 SHA1 (patch-source_Initialization_SystemInitializerCommon.cpp) = dc270227e68c655753ef5f5168e3fa9a8dab3696
+SHA1 (patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp) = 32d683eb388ded96e7f9aedec827202b5b056392
+SHA1 (patch-source_Plugins_DynamicLoader_POSIX-DYLD_DynamicLoaderPOSIXDYLD.cpp) = ed8077e029281f6d1a9f043edc5a3b16d126eea2
 SHA1 (patch-source_Plugins_Process_CMakeLists.txt) = c689ff4ec455234f8d506dc9eb8e0ed7f750d426
 SHA1 (patch-source_Plugins_Process_NetBSD_CMakeLists.txt) = a77f397020ab752875813a7a93b53ccd3a130e6f
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 533e215f48d9d5569771082611be3fee059744ec
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 2d386cfc851c9f8e49959ae2e74001f58b61bfe5
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = c48bb2dd45682164ab904b8b3f7664b91ac35d5b
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp) = c503ae3b197da1c9555e314d17cb88b4ce2b4ba9
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h) = 8c0e41f16445e894a18eee6cae8d3d31ba7c8dd9
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp) = 196f33520950262d2ca59f1dc6a019e0ba2e3e7c
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h) = fa3980158bfe07b476c883b2354329dac9eb0c22
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp) = 89a9f56d1ee3103ac73c274f233f0d6816e20363
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h) = dccd470b53937f58c5697f7e2507cc76db497ce8
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp) = cd0965e27e5b2374708b392ec707a5f98f2392d8
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h) = 1b0894efeedb9724ed46e8a6c7257642f542aab1
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = cb8757705327e62273bfe9a84dbdbf9cb9b0751a
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = c675af8495a75f99bb60cb4ab3fa36223f1cb6f4
+SHA1 (patch-source_Plugins_Process_elf-core_ThreadElfCore.cpp) = 3427bd2e2de3cd2947123c2f20ed8d5082a16ace
 SHA1 (patch-source_Plugins_Process_gdb-remote_GDBRemoteCommunicationServerCommon.cpp) = 76e3f6a3e0a24a28a2f5a30e8812906f8a2b2649
 SHA1 (patch-source_Plugins_Process_gdb-remote_GDBRemoteCommunicationServerLLGS.cpp) = 150f5564b91eb4e39165e24cd68bda4182be8a7a
+SHA1 (patch-source_Plugins_Process_minidump_ProcessMinidump.cpp) = a71464df2ef56b8b2c8905e8169a85a05cfd27ba
 SHA1 (patch-tools_lldb-server_CMakeLists.txt) = 9804b083a1aa0cb7fa06b840a71c28424ad8e01d
diff --git a/lldb-netbsd/patches/patch-source_Core_FormatEntity.cpp b/lldb-netbsd/patches/patch-source_Core_FormatEntity.cpp
new file mode 100644
index 0000000000..82b185a1d5
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Core_FormatEntity.cpp
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- source/Core/FormatEntity.cpp.orig	2017-02-04 18:35:35.000000000 +0000
++++ source/Core/FormatEntity.cpp
+@@ -1187,7 +1187,8 @@ bool FormatEntity::Format(const Entry &e
+                                               ? arch.GetTriple().getOS()
+                                               : llvm::Triple::UnknownOS;
+             if ((ostype == llvm::Triple::FreeBSD) ||
+-                (ostype == llvm::Triple::Linux)) {
++                (ostype == llvm::Triple::Linux) ||
++                (ostype == llvm::Triple::NetBSD)) {
+               format = "%" PRIu64;
+             }
+           } else {
diff --git a/lldb-netbsd/patches/patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp b/lldb-netbsd/patches/patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp
new file mode 100644
index 0000000000..86f38c054e
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp.orig	2017-02-04 18:35:34.000000000 +0000
++++ source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
+@@ -385,6 +385,7 @@ bool DYLDRendezvous::SOEntryIsMainExecut
+   auto triple = m_process->GetTarget().GetArchitecture().GetTriple();
+   switch (triple.getOS()) {
+   case llvm::Triple::FreeBSD:
++  case llvm::Triple::NetBSD:
+     return entry.file_spec == m_exe_file_spec;
+   case llvm::Triple::Linux:
+     if (triple.isAndroid())
diff --git a/lldb-netbsd/patches/patch-source_Plugins_DynamicLoader_POSIX-DYLD_DynamicLoaderPOSIXDYLD.cpp b/lldb-netbsd/patches/patch-source_Plugins_DynamicLoader_POSIX-DYLD_DynamicLoaderPOSIXDYLD.cpp
new file mode 100644
index 0000000000..aed602e31d
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_DynamicLoader_POSIX-DYLD_DynamicLoaderPOSIXDYLD.cpp
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp.orig	2016-12-17 10:29:49.000000000 +0000
++++ source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+@@ -64,7 +64,8 @@ DynamicLoader *DynamicLoaderPOSIXDYLD::C
+     const llvm::Triple &triple_ref =
+         process->GetTarget().GetArchitecture().GetTriple();
+     if (triple_ref.getOS() == llvm::Triple::Linux ||
+-        triple_ref.getOS() == llvm::Triple::FreeBSD)
++        triple_ref.getOS() == llvm::Triple::FreeBSD ||
++        triple_ref.getOS() == llvm::Triple::NetBSD)
+       create = true;
+   }
+ 
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 3374a9b7d1..deed242c5e 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
@@ -1,8 +1,8 @@
 $NetBSD$
 
---- source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp.orig	2017-03-11 07:50:19.309994898 +0000
+--- source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp.orig	2017-03-13 11:59:28.701374714 +0000
 +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
-@@ -0,0 +1,1307 @@
+@@ -0,0 +1,1395 @@
 +//===-- NativeProcessNetBSD.cpp -------------------------------- -*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -521,6 +521,7 @@ $NetBSD$
 +      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;
@@ -1087,6 +1088,78 @@ $NetBSD$
 +  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)
@@ -1112,6 +1185,21 @@ $NetBSD$
 +  }
 +}
 +
++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);
@@ -1163,7 +1251,7 @@ $NetBSD$
 +  io.piod_len = size;
 +
 +  do {
-+    io.piod_offs = (void *)(src + bytes_written);
++    io.piod_addr = (void *)(src + bytes_written);
 +    io.piod_offs = (void *)(addr + bytes_written);
 +
 +    Error error = NativeProcessNetBSD::PtraceWrapper(
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 25e9e0f70b..9c6172640a 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp.orig	2017-03-11 07:50:19.322535530 +0000
+--- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp.orig	2017-03-13 11:59:28.714727351 +0000
 +++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
 @@ -0,0 +1,112 @@
 +//===-- NativeRegisterContextNetBSD.cpp --------------------------*- C++ -*-===//
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 a212799e42..2029fae990 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h.orig	2017-03-11 07:50:19.328597210 +0000
+--- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h.orig	2017-03-13 11:59:28.721350583 +0000
 +++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
 @@ -0,0 +1,78 @@
 +//===-- NativeRegisterContextNetBSD.h ----------------------------*- C++ -*-===//
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 6282f5f8c4..0db601fc13 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,6 +1,6 @@
 $NetBSD$
 
---- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp.orig	2017-03-11 07:50:19.335169838 +0000
+--- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp.orig	2017-03-13 11:59:28.728169966 +0000
 +++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
 @@ -0,0 +1,434 @@
 +//===-- NativeRegisterContextNetBSD_x86_64.cpp ---------------*- C++ -*-===//
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 738a4f3cfd..b111da44f3 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,6 +1,6 @@
 $NetBSD$
 
---- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h.orig	2017-03-11 07:50:19.341693363 +0000
+--- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h.orig	2017-03-13 11:59:28.735009161 +0000
 +++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
 @@ -0,0 +1,82 @@
 +//===-- NativeRegisterContextNetBSD_x86_64.h ---------------------*- C++ -*-===//
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ThreadElfCore.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ThreadElfCore.cpp
new file mode 100644
index 0000000000..466d39fd74
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ThreadElfCore.cpp
@@ -0,0 +1,30 @@
+$NetBSD$
+
+--- source/Plugins/Process/elf-core/ThreadElfCore.cpp.orig	2017-02-27 20:47:52.000000000 +0000
++++ source/Plugins/Process/elf-core/ThreadElfCore.cpp
+@@ -18,6 +18,7 @@
+ #include "Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h"
+ #include "Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h"
+ #include "Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h"
++#include "Plugins/Process/Utility/RegisterContextNetBSD_x86_64.h"
+ #include "Plugins/Process/Utility/RegisterContextLinux_i386.h"
+ #include "Plugins/Process/Utility/RegisterContextLinux_s390x.h"
+ #include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h"
+@@ -110,6 +111,17 @@ ThreadElfCore::CreateRegisterContextForF
+       break;
+     }
+ 
++    case llvm::Triple::NetBSD: {
++      switch (arch.GetMachine()) {
++      case llvm::Triple::x86_64:
++        reg_interface = new RegisterContextNetBSD_x86_64(arch);
++        break;
++      default:
++        break;
++      }
++      break;
++    }
++
+     case llvm::Triple::Linux: {
+       switch (arch.GetMachine()) {
+       case llvm::Triple::arm:
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_minidump_ProcessMinidump.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_minidump_ProcessMinidump.cpp
new file mode 100644
index 0000000000..287e001412
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_minidump_ProcessMinidump.cpp
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- source/Plugins/Process/minidump/ProcessMinidump.cpp.orig	2017-02-27 20:47:52.000000000 +0000
++++ source/Plugins/Process/minidump/ProcessMinidump.cpp
+@@ -159,7 +159,8 @@ void ProcessMinidump::RefreshStateAfterS
+   stop_thread = Process::m_thread_list.GetSelectedThread();
+   ArchSpec arch = GetArchitecture();
+ 
+-  if (arch.GetTriple().getOS() == llvm::Triple::Linux) {
++  if (arch.GetTriple().getOS() == llvm::Triple::Linux ||
++      arch.GetTriple().getOS() == llvm::Triple::NetBSD) {
+     stop_info = StopInfo::CreateStopReasonWithSignal(
+         *stop_thread, m_active_exception->exception_record.exception_code);
+   } else {


Home | Main Index | Thread Index | Old Index