pkgsrc-WIP-changes archive

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

lldb-netbsd: Kill more i386 code, watchpoints and purge unneeded code



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Mon Dec 19 01:19:13 2016 +0100
Changeset:	5de006af330244259612838e5cdc68b76ee4d9b1

Modified Files:
	lldb-netbsd/distinfo
	lldb-netbsd/patches/patch-include_lldb_Host_netbsd_HostThreadNetBSD.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
Added Files:
	lldb-netbsd/patches/patch-source_Host_netbsd_ThisThread.cpp

Log Message:
lldb-netbsd: Kill more i386 code, watchpoints and purge unneeded code

Support for i386 is planned to be readded later, once amd64 will be finished.

Watchpoints are planned to be once the core will be functional.

Pure other minor code that is currently unneded.

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=5de006af330244259612838e5cdc68b76ee4d9b1

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

diffstat:
 lldb-netbsd/distinfo                               |  11 +-
 ...tch-include_lldb_Host_netbsd_HostThreadNetBSD.h |  14 --
 .../patch-source_Host_netbsd_ThisThread.cpp        |  23 ++
 ...NetBSD_NativeRegisterContextNetBSD__x86__64.cpp | 231 +--------------------
 ...s_NetBSD_NativeRegisterContextNetBSD__x86__64.h |  69 +-----
 ...e_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp |  82 +-------
 ...rce_Plugins_Process_NetBSD_NativeThreadNetBSD.h |  13 +-
 7 files changed, 36 insertions(+), 407 deletions(-)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 735104d..e1c0d63 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -13,21 +13,22 @@ SHA1 (llvm-3.6.2.src.tar.xz) = 7a00257eb2bc9431e4c77c3a36b033072c54bc7e
 RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
 SHA1 (patch-cmake_LLDBDependencies.cmake) = 81673d8624ca7a9ad60bcaf530587fbfbd695dca
-SHA1 (patch-include_lldb_Host_netbsd_HostThreadNetBSD.h) = 79f207cdb9da2ef57d39eeb307ec6d10cf828925
+SHA1 (patch-include_lldb_Host_netbsd_HostThreadNetBSD.h) = da39a3ee5e6b4b0d3255bfef95601890afd80709
 SHA1 (patch-include_lldb_Host_netbsd_ProcessLauncherNetBSD.h) = 5422ae06ff064f0b522148a576a7e8d3b4ea1974
 SHA1 (patch-include_lldb_Host_netbsd_Ptrace.h) = 3ef61ded004c2acb81e132dc0e46d0a764977f92
 SHA1 (patch-source_CMakeLists.txt) = 5dacabc3f39c23bdfd432b5a4895866157b97aa0
 SHA1 (patch-source_Host_netbsd_HostThreadNetBSD.cpp) = a1b0fbdad062309a845cfefe4469614fbbe9d20e
+SHA1 (patch-source_Host_netbsd_ThisThread.cpp) = f0d32c81bc1b8fe9aeb86519ea46ba2cb16571c2
 SHA1 (patch-source_Plugins_Process_CMakeLists.txt) = c0168f81da56d9896eb414e6b8bb7262de04ac33
 SHA1 (patch-source_Plugins_Process_NetBSD_CMakeLists.txt) = 8c1d8274523f6ef4bce90caa6c981160ef930cb9
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 8721193630aba8972204998b535fdb2cd64c7fb9
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = 201c4e5fcc7ac28f4c6d236d60935c0ee91f9259
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp) = 61512fb22cc5d1f4747a6af09d34723809fa8943
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h) = 2c45e7cd731a9c41fe14d866f9cd5ef5f838019b
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp) = 601b30ba2a3af18b6a6e8045d5a00415990c0fb1
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h) = b92d756199555c2ba890afa383808ec094266cf1
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = a0b092dfd8f20e692dd0f73866e2f72a9bfe68af
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = 500758493f60ff6c3394f686e3f9affb85fb023e
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp) = 98e3381d060880450b6760ed108a7d9f5ba8dce8
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h) = bec448e65a6c72506a821624eb3d107c76f732af
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = 2af7386b293d6a087fddd6b62a6712195bcd0892
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = b65394500b6c5d01fcf3294a57ec5a8a086df45a
 SHA1 (patch-source_Plugins_Process_NetBSD_ProcFileReader.cpp) = dff1193e16aa79d8a577a3db4a9056521911d6f1
 SHA1 (patch-source_Plugins_Process_NetBSD_ProcFileReader.h) = c8393049c7303b466d3ce98ec5581a3155b71aff
 SHA1 (patch-source_Plugins_Process_NetBSD_Procfs.h) = 5994fa837260136b78cd0b4988dafc6f96ca1e3d
diff --git a/lldb-netbsd/patches/patch-include_lldb_Host_netbsd_HostThreadNetBSD.h b/lldb-netbsd/patches/patch-include_lldb_Host_netbsd_HostThreadNetBSD.h
index e278507..e69de29 100644
--- a/lldb-netbsd/patches/patch-include_lldb_Host_netbsd_HostThreadNetBSD.h
+++ b/lldb-netbsd/patches/patch-include_lldb_Host_netbsd_HostThreadNetBSD.h
@@ -1,14 +0,0 @@
-$NetBSD$
-
---- include/lldb/Host/netbsd/HostThreadNetBSD.h.orig	2016-12-17 10:34:14.000000000 +0000
-+++ include/lldb/Host/netbsd/HostThreadNetBSD.h
-@@ -22,8 +22,7 @@ public:
-   HostThreadNetBSD();
-   HostThreadNetBSD(lldb::thread_t thread);
- 
--  static void SetName(lldb::thread_t tid, llvm::StringRef &name);
--  static void GetName(lldb::thread_t tid, llvm::SmallVectorImpl<char> &name);
-+  static void GetName(lldb::tid_t tid, llvm::SmallVectorImpl<char> &name);
- };
- }
- 
diff --git a/lldb-netbsd/patches/patch-source_Host_netbsd_ThisThread.cpp b/lldb-netbsd/patches/patch-source_Host_netbsd_ThisThread.cpp
new file mode 100644
index 0000000..f4b7b76
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Host_netbsd_ThisThread.cpp
@@ -0,0 +1,23 @@
+$NetBSD$
+
+--- source/Host/netbsd/ThisThread.cpp.orig	2016-12-17 10:30:35.000000000 +0000
++++ source/Host/netbsd/ThisThread.cpp
+@@ -12,15 +12,15 @@
+ 
+ #include "llvm/ADT/SmallVector.h"
+ 
+-#include <pthread.h>
++#include <lwp.h>
+ #include <string.h>
+ 
+ using namespace lldb_private;
+ 
+ void ThisThread::SetName(llvm::StringRef name) {
+-  HostNativeThread::SetName(::pthread_self(), name);
++//  HostNativeThread::SetName(_lwp_self(), name);
+ }
+ 
+ void ThisThread::GetName(llvm::SmallVectorImpl<char> &name) {
+-  HostNativeThread::GetName(::pthread_self(), name);
++  HostNativeThread::GetName(_lwp_self(), name);
+ }
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 b8ec39c..9236ea5 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
@@ -2,7 +2,7 @@ $NetBSD$
 
 --- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp.orig	2016-12-17 13:23:23.784160224 +0000
 +++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
-@@ -0,0 +1,546 @@
+@@ -0,0 +1,321 @@
 +//===-- NativeRegisterContextNetBSD_x86_64.cpp ---------------*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -12,7 +12,7 @@ $NetBSD$
 +//
 +//===----------------------------------------------------------------------===//
 +
-+#if defined(__i386__) || defined(__x86_64__)
++#if defined(__x86_64__)
 +
 +#include "NativeRegisterContextNetBSD_x86_64.h"
 +
@@ -34,23 +34,6 @@ $NetBSD$
 +// ----------------------------------------------------------------------------
 +
 +namespace {
-+// x86 32-bit general purpose registers.
-+const uint32_t g_gpr_regnums_i386[] = {
-+    lldb_eax_i386,      lldb_ebx_i386,    lldb_ecx_i386, lldb_edx_i386,
-+    lldb_edi_i386,      lldb_esi_i386,    lldb_ebp_i386, lldb_esp_i386,
-+    lldb_eip_i386,      lldb_eflags_i386, lldb_cs_i386,  lldb_fs_i386,
-+    lldb_gs_i386,       lldb_ss_i386,     lldb_ds_i386,  lldb_es_i386,
-+    lldb_ax_i386,       lldb_bx_i386,     lldb_cx_i386,  lldb_dx_i386,
-+    lldb_di_i386,       lldb_si_i386,     lldb_bp_i386,  lldb_sp_i386,
-+    lldb_ah_i386,       lldb_bh_i386,     lldb_ch_i386,  lldb_dh_i386,
-+    lldb_al_i386,       lldb_bl_i386,     lldb_cl_i386,  lldb_dl_i386,
-+    LLDB_INVALID_REGNUM // register sets need to end with this flag
-+};
-+static_assert((sizeof(g_gpr_regnums_i386) / sizeof(g_gpr_regnums_i386[0])) -
-+                      1 ==
-+                  k_num_gpr_registers_i386,
-+              "g_gpr_regnums_i386 has wrong number of register infos");
-+
 +// x86 64-bit general purpose registers.
 +static const uint32_t g_gpr_regnums_x86_64[] = {
 +    lldb_rax_x86_64,    lldb_rbx_x86_64,    lldb_rcx_x86_64, lldb_rdx_x86_64,
@@ -167,8 +150,6 @@ $NetBSD$
 +    return nullptr;
 +
 +  switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
-+  case llvm::Triple::x86:
-+    return &g_reg_sets_i386[set_index];
 +  case llvm::Triple::x86_64:
 +    return &g_reg_sets_x86_64[set_index];
 +  default:
@@ -333,7 +314,6 @@ $NetBSD$
 +  uint32_t num_sets = k_num_register_sets - k_num_extended_register_sets;
 +
 +  switch (static_cast<RegSet>(set_index)) {
-+  case RegSet::gpr:
 +  }
 +  return false;
 +}
@@ -343,209 +323,4 @@ $NetBSD$
 +  return reg_index <= m_reg_info.last_gpr;
 +}
 +
-+Error NativeRegisterContextNetBSD_x86_64::IsWatchpointHit(uint32_t wp_index,
-+                                                         bool &is_hit) {
-+  if (wp_index >= NumSupportedHardwareWatchpoints())
-+    return Error("Watchpoint index out of range");
-+
-+  RegisterValue reg_value;
-+  Error error = ReadRegisterRaw(m_reg_info.first_dr + 6, reg_value);
-+  if (error.Fail()) {
-+    is_hit = false;
-+    return error;
-+  }
-+
-+  uint64_t status_bits = reg_value.GetAsUInt64();
-+
-+  is_hit = status_bits & (1 << wp_index);
-+
-+  return error;
-+}
-+
-+Error NativeRegisterContextNetBSD_x86_64::GetWatchpointHitIndex(
-+    uint32_t &wp_index, lldb::addr_t trap_addr) {
-+  uint32_t num_hw_wps = NumSupportedHardwareWatchpoints();
-+  for (wp_index = 0; wp_index < num_hw_wps; ++wp_index) {
-+    bool is_hit;
-+    Error error = IsWatchpointHit(wp_index, is_hit);
-+    if (error.Fail()) {
-+      wp_index = LLDB_INVALID_INDEX32;
-+      return error;
-+    } else if (is_hit) {
-+      return error;
-+    }
-+  }
-+  wp_index = LLDB_INVALID_INDEX32;
-+  return Error();
-+}
-+
-+Error NativeRegisterContextNetBSD_x86_64::IsWatchpointVacant(uint32_t wp_index,
-+                                                            bool &is_vacant) {
-+  if (wp_index >= NumSupportedHardwareWatchpoints())
-+    return Error("Watchpoint index out of range");
-+
-+  RegisterValue reg_value;
-+  Error error = ReadRegisterRaw(m_reg_info.first_dr + 7, reg_value);
-+  if (error.Fail()) {
-+    is_vacant = false;
-+    return error;
-+  }
-+
-+  uint64_t control_bits = reg_value.GetAsUInt64();
-+
-+  is_vacant = !(control_bits & (1 << (2 * wp_index)));
-+
-+  return error;
-+}
-+
-+Error NativeRegisterContextNetBSD_x86_64::SetHardwareWatchpointWithIndex(
-+    lldb::addr_t addr, size_t size, uint32_t watch_flags, uint32_t wp_index) {
-+
-+  if (wp_index >= NumSupportedHardwareWatchpoints())
-+    return Error("Watchpoint index out of range");
-+
-+  // Read only watchpoints aren't supported on x86_64. Fall back to read/write
-+  // waitchpoints instead.
-+  // TODO: Add logic to detect when a write happens and ignore that watchpoint
-+  // hit.
-+  if (watch_flags == 0x2)
-+    watch_flags = 0x3;
-+
-+  if (watch_flags != 0x1 && watch_flags != 0x3)
-+    return Error("Invalid read/write bits for watchpoint");
-+
-+  if (size != 1 && size != 2 && size != 4 && size != 8)
-+    return Error("Invalid size for watchpoint");
-+
-+  bool is_vacant;
-+  Error error = IsWatchpointVacant(wp_index, is_vacant);
-+  if (error.Fail())
-+    return error;
-+  if (!is_vacant)
-+    return Error("Watchpoint index not vacant");
-+
-+  RegisterValue reg_value;
-+  error = ReadRegisterRaw(m_reg_info.first_dr + 7, reg_value);
-+  if (error.Fail())
-+    return error;
-+
-+  // for watchpoints 0, 1, 2, or 3, respectively,
-+  // set bits 1, 3, 5, or 7
-+  uint64_t enable_bit = 1 << (2 * wp_index);
-+
-+  // set bits 16-17, 20-21, 24-25, or 28-29
-+  // with 0b01 for write, and 0b11 for read/write
-+  uint64_t rw_bits = watch_flags << (16 + 4 * wp_index);
-+
-+  // set bits 18-19, 22-23, 26-27, or 30-31
-+  // with 0b00, 0b01, 0b10, or 0b11
-+  // for 1, 2, 8 (if supported), or 4 bytes, respectively
-+  uint64_t size_bits = (size == 8 ? 0x2 : size - 1) << (18 + 4 * wp_index);
-+
-+  uint64_t bit_mask = (0x3 << (2 * wp_index)) | (0xF << (16 + 4 * wp_index));
-+
-+  uint64_t control_bits = reg_value.GetAsUInt64() & ~bit_mask;
-+
-+  control_bits |= enable_bit | rw_bits | size_bits;
-+
-+  error = WriteRegisterRaw(m_reg_info.first_dr + wp_index, RegisterValue(addr));
-+  if (error.Fail())
-+    return error;
-+
-+  error =
-+      WriteRegisterRaw(m_reg_info.first_dr + 7, RegisterValue(control_bits));
-+  if (error.Fail())
-+    return error;
-+
-+  error.Clear();
-+  return error;
-+}
-+
-+bool NativeRegisterContextNetBSD_x86_64::ClearHardwareWatchpoint(
-+    uint32_t wp_index) {
-+  if (wp_index >= NumSupportedHardwareWatchpoints())
-+    return false;
-+
-+  RegisterValue reg_value;
-+
-+  // for watchpoints 0, 1, 2, or 3, respectively,
-+  // clear bits 0, 1, 2, or 3 of the debug status register (DR6)
-+  Error error = ReadRegisterRaw(m_reg_info.first_dr + 6, reg_value);
-+  if (error.Fail())
-+    return false;
-+  uint64_t bit_mask = 1 << wp_index;
-+  uint64_t status_bits = reg_value.GetAsUInt64() & ~bit_mask;
-+  error = WriteRegisterRaw(m_reg_info.first_dr + 6, RegisterValue(status_bits));
-+  if (error.Fail())
-+    return false;
-+
-+  // for watchpoints 0, 1, 2, or 3, respectively,
-+  // clear bits {0-1,16-19}, {2-3,20-23}, {4-5,24-27}, or {6-7,28-31}
-+  // of the debug control register (DR7)
-+  error = ReadRegisterRaw(m_reg_info.first_dr + 7, reg_value);
-+  if (error.Fail())
-+    return false;
-+  bit_mask = (0x3 << (2 * wp_index)) | (0xF << (16 + 4 * wp_index));
-+  uint64_t control_bits = reg_value.GetAsUInt64() & ~bit_mask;
-+  return WriteRegisterRaw(m_reg_info.first_dr + 7, RegisterValue(control_bits))
-+      .Success();
-+}
-+
-+Error NativeRegisterContextNetBSD_x86_64::ClearAllHardwareWatchpoints() {
-+  RegisterValue reg_value;
-+
-+  // clear bits {0-4} of the debug status register (DR6)
-+  Error error = ReadRegisterRaw(m_reg_info.first_dr + 6, reg_value);
-+  if (error.Fail())
-+    return error;
-+  uint64_t bit_mask = 0xF;
-+  uint64_t status_bits = reg_value.GetAsUInt64() & ~bit_mask;
-+  error = WriteRegisterRaw(m_reg_info.first_dr + 6, RegisterValue(status_bits));
-+  if (error.Fail())
-+    return error;
-+
-+  // clear bits {0-7,16-31} of the debug control register (DR7)
-+  error = ReadRegisterRaw(m_reg_info.first_dr + 7, reg_value);
-+  if (error.Fail())
-+    return error;
-+  bit_mask = 0xFF | (0xFFFF << 16);
-+  uint64_t control_bits = reg_value.GetAsUInt64() & ~bit_mask;
-+  return WriteRegisterRaw(m_reg_info.first_dr + 7, RegisterValue(control_bits));
-+}
-+
-+uint32_t NativeRegisterContextNetBSD_x86_64::SetHardwareWatchpoint(
-+    lldb::addr_t addr, size_t size, uint32_t watch_flags) {
-+  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS));
-+  const uint32_t num_hw_watchpoints = NumSupportedHardwareWatchpoints();
-+  for (uint32_t wp_index = 0; wp_index < num_hw_watchpoints; ++wp_index) {
-+    bool is_vacant;
-+    Error error = IsWatchpointVacant(wp_index, is_vacant);
-+    if (is_vacant) {
-+      error = SetHardwareWatchpointWithIndex(addr, size, watch_flags, wp_index);
-+      if (error.Success())
-+        return wp_index;
-+    }
-+    if (error.Fail() && log) {
-+      log->Printf("NativeRegisterContextNetBSD_x86_64::%s Error: %s",
-+                  __FUNCTION__, error.AsCString());
-+    }
-+  }
-+  return LLDB_INVALID_INDEX32;
-+}
-+
-+lldb::addr_t
-+NativeRegisterContextNetBSD_x86_64::GetWatchpointAddress(uint32_t wp_index) {
-+  if (wp_index >= NumSupportedHardwareWatchpoints())
-+    return LLDB_INVALID_ADDRESS;
-+  RegisterValue reg_value;
-+  if (ReadRegisterRaw(m_reg_info.first_dr + wp_index, reg_value).Fail())
-+    return LLDB_INVALID_ADDRESS;
-+  return reg_value.GetAsUInt64();
-+}
-+
-+uint32_t NativeRegisterContextNetBSD_x86_64::NumSupportedHardwareWatchpoints() {
-+  // Available debug address registers: dr0, dr1, dr2, dr3
-+  return 4;
-+}
-+
-+#endif // defined(__i386__) || defined(__x86_64__)
++#endif // defined(__x86_64__)
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 21886df..2c5838b 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
@@ -2,7 +2,7 @@ $NetBSD$
 
 --- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h.orig	2016-12-17 13:23:23.784681789 +0000
 +++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
-@@ -0,0 +1,146 @@
+@@ -0,0 +1,79 @@
 +//===-- NativeRegisterContextNetBSD_x86_64.h ---------------------*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -48,38 +48,9 @@ $NetBSD$
 +
 +  Error WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
 +
-+  Error IsWatchpointHit(uint32_t wp_index, bool &is_hit) override;
-+
-+  Error GetWatchpointHitIndex(uint32_t &wp_index,
-+                              lldb::addr_t trap_addr) override;
-+
-+  Error IsWatchpointVacant(uint32_t wp_index, bool &is_vacant) override;
-+
-+  bool ClearHardwareWatchpoint(uint32_t wp_index) override;
-+
-+  Error ClearAllHardwareWatchpoints() override;
-+
-+  Error SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size,
-+                                       uint32_t watch_flags, uint32_t wp_index);
-+
-+  uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size,
-+                                 uint32_t watch_flags) override;
-+
-+  lldb::addr_t GetWatchpointAddress(uint32_t wp_index) override;
-+
-+  uint32_t NumSupportedHardwareWatchpoints() override;
-+
 +protected:
 +  void *GetGPRBuffer() override { return &m_gpr_x86_64; }
 +
-+  void *GetFPRBuffer() override;
-+
-+  size_t GetFPRSize() override;
-+
-+  Error ReadFPR() override;
-+
-+  Error WriteFPR() override;
-+
 +private:
 +  // Private member types.
 +  enum class XStateType { Invalid, FXSAVE, XSAVE };
@@ -89,34 +60,10 @@ $NetBSD$
 +  struct RegInfo {
 +    uint32_t num_registers;
 +    uint32_t num_gpr_registers;
-+    uint32_t num_fpr_registers;
-+    uint32_t num_avx_registers;
-+    uint32_t num_mpx_registers;
-+    uint32_t last_gpr;
-+    uint32_t first_fpr;
-+    uint32_t last_fpr;
-+    uint32_t first_st;
-+    uint32_t last_st;
-+    uint32_t first_mm;
-+    uint32_t last_mm;
-+    uint32_t first_xmm;
-+    uint32_t last_xmm;
-+    uint32_t first_ymm;
-+    uint32_t last_ymm;
-+    uint32_t first_mpxr;
-+    uint32_t last_mpxr;
-+    uint32_t first_mpxc;
-+    uint32_t last_mpxc;
-+    uint32_t first_dr;
-+    uint32_t gpr_flags;
 +  };
 +
 +  // Private member variables.
-+  mutable XStateType m_xstate_type;
-+  FPR m_fpr; // Extended States Area, named FPR for historical reasons.
 +  IOVEC m_iovec;
-+  YMM m_ymm_set;
-+  MPX m_mpx_set;
 +  RegInfo m_reg_info;
 +  uint64_t m_gpr_x86_64[k_num_gpr_registers_x86_64];
 +  uint32_t m_fctrl_offset_in_userarea;
@@ -127,20 +74,6 @@ $NetBSD$
 +  bool IsRegisterSetAvailable(uint32_t set_index) const;
 +
 +  bool IsGPR(uint32_t reg_index) const;
-+
-+  bool IsFPR(uint32_t reg_index) const;
-+
-+  bool CopyXSTATEtoYMM(uint32_t reg_index, lldb::ByteOrder byte_order);
-+
-+  bool CopyYMMtoXSTATE(uint32_t reg, lldb::ByteOrder byte_order);
-+
-+  bool IsAVX(uint32_t reg_index) const;
-+
-+  bool CopyXSTATEtoMPX(uint32_t reg);
-+
-+  bool CopyMPXtoXSTATE(uint32_t reg);
-+
-+  bool IsMPX(uint32_t reg_index) const;
 +};
 +
 +} // namespace process_netbsd
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 bdae333..38b940b 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
@@ -2,7 +2,7 @@ $NetBSD$
 
 --- source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp.orig	2016-12-17 13:23:23.784878149 +0000
 +++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
-@@ -0,0 +1,397 @@
+@@ -0,0 +1,319 @@
 +//===-- NativeThreadNetBSD.cpp --------------------------------- -*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -56,10 +56,6 @@ $NetBSD$
 +    log.Printf("%s: %s breakpoint, stopping signal 0x%" PRIx32, __FUNCTION__,
 +               header, stop_info.details.signal.signo);
 +    return;
-+  case eStopReasonWatchpoint:
-+    log.Printf("%s: %s watchpoint, 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);
@@ -166,34 +162,6 @@ $NetBSD$
 +  return m_reg_context_sp;
 +}
 +
-+Error NativeThreadNetBSD::SetWatchpoint(lldb::addr_t addr, size_t size,
-+                                       uint32_t watch_flags, bool hardware) {
-+  if (!hardware)
-+    return Error("not implemented");
-+  if (m_state == eStateLaunching)
-+    return Error();
-+  Error error = RemoveWatchpoint(addr);
-+  if (error.Fail())
-+    return error;
-+  NativeRegisterContextSP reg_ctx = GetRegisterContext();
-+  uint32_t wp_index = reg_ctx->SetHardwareWatchpoint(addr, size, watch_flags);
-+  if (wp_index == LLDB_INVALID_INDEX32)
-+    return Error("Setting hardware watchpoint failed.");
-+  m_watchpoint_index_map.insert({addr, wp_index});
-+  return Error();
-+}
-+
-+Error NativeThreadNetBSD::RemoveWatchpoint(lldb::addr_t addr) {
-+  auto wp = m_watchpoint_index_map.find(addr);
-+  if (wp == m_watchpoint_index_map.end())
-+    return Error();
-+  uint32_t wp_index = wp->second;
-+  m_watchpoint_index_map.erase(wp);
-+  if (GetRegisterContext()->ClearHardwareWatchpoint(wp_index))
-+    return Error();
-+  return Error("Clearing hardware watchpoint failed.");
-+}
-+
 +Error NativeThreadNetBSD::Resume(uint32_t signo) {
 +  const StateType new_state = StateType::eStateRunning;
 +  MaybeLogStateChange(new_state);
@@ -202,20 +170,7 @@ $NetBSD$
 +  m_stop_info.reason = StopReason::eStopReasonNone;
 +  m_stop_description.clear();
 +
-+  // If watchpoints have been set, but none on this thread,
-+  // then this is a new thread. So set all existing watchpoints.
-+  if (m_watchpoint_index_map.empty()) {
-+    NativeProcessNetBSD &process = GetProcess();
-+
-+    const auto &watchpoint_map = process.GetWatchpointMap();
-+    GetRegisterContext()->ClearAllHardwareWatchpoints();
-+    for (const auto &pair : watchpoint_map) {
-+      const auto &wp = pair.second;
-+      SetWatchpoint(wp.m_addr, wp.m_size, wp.m_watch_flags, wp.m_hardware);
-+    }
-+  }
-+
-+  intptr_t data = 0;
++  int data = 0;
 +
 +  if (signo != LLDB_INVALID_SIGNAL_NUMBER)
 +    data = signo;
@@ -312,44 +267,11 @@ $NetBSD$
 +  m_stop_description.clear();
 +}
 +
-+void NativeThreadNetBSD::SetStoppedByWatchpoint(uint32_t wp_index) {
-+  SetStopped();
-+
-+  lldbassert(wp_index != LLDB_INVALID_INDEX32 && "wp_index cannot be invalid");
-+
-+  std::ostringstream ostr;
-+  ostr << GetRegisterContext()->GetWatchpointAddress(wp_index) << " ";
-+  ostr << wp_index;
-+
-+  /*
-+   * MIPS: Last 3bits of the watchpoint address are masked by the kernel. For
-+   * example:
-+   * 'n' is at 0x120010d00 and 'm' is 0x120010d04. When a watchpoint is set at
-+   * 'm', then
-+   * watch exception is generated even when 'n' is read/written. To handle this
-+   * case,
-+   * find the base address of the load/store instruction and append it in the
-+   * stop-info
-+   * packet.
-+  */
-+  ostr << " " << GetRegisterContext()->GetWatchpointHitAddress(wp_index);
-+
-+  m_stop_description = ostr.str();
-+
-+  m_stop_info.reason = StopReason::eStopReasonWatchpoint;
-+  m_stop_info.details.signal.signo = SIGTRAP;
-+}
-+
 +bool NativeThreadNetBSD::IsStoppedAtBreakpoint() {
 +  return GetState() == StateType::eStateStopped &&
 +         m_stop_info.reason == StopReason::eStopReasonBreakpoint;
 +}
 +
-+bool NativeThreadNetBSD::IsStoppedAtWatchpoint() {
-+  return GetState() == StateType::eStateStopped &&
-+         m_stop_info.reason == StopReason::eStopReasonWatchpoint;
-+}
-+
 +void NativeThreadNetBSD::SetStoppedByTrace() {
 +  SetStopped();
 +
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 d74cb2e..7c6d4d9 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h
@@ -2,7 +2,7 @@ $NetBSD$
 
 --- source/Plugins/Process/NetBSD/NativeThreadNetBSD.h.orig	2016-12-17 13:23:23.784994923 +0000
 +++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
-@@ -0,0 +1,114 @@
+@@ -0,0 +1,103 @@
 +//===-- NativeThreadNetBSD.h ----------------------------------- -*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -47,11 +47,6 @@ $NetBSD$
 +
 +  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;
-+
 +private:
 +  // ---------------------------------------------------------------------
 +  // Interface for friend classes
@@ -76,12 +71,8 @@ $NetBSD$
 +
 +  void SetStoppedByBreakpoint();
 +
-+  void SetStoppedByWatchpoint(uint32_t wp_index);
-+
 +  bool IsStoppedAtBreakpoint();
 +
-+  bool IsStoppedAtWatchpoint();
-+
 +  void SetStoppedByTrace();
 +
 +  void SetStoppedWithNoReason();
@@ -108,8 +99,6 @@ $NetBSD$
 +  ThreadStopInfo m_stop_info;
 +  NativeRegisterContextSP m_reg_context_sp;
 +  std::string m_stop_description;
-+  using WatchpointIndexMap = std::map<lldb::addr_t, uint32_t>;
-+  WatchpointIndexMap m_watchpoint_index_map;
 +};
 +
 +typedef std::shared_ptr<NativeThreadNetBSD> NativeThreadNetBSDSP;


Home | Main Index | Thread Index | Old Index