pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lldb-netbsd: Remove for now support for registers' accessors, fix fallout
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Mon Dec 19 02:34:02 2016 +0100
Changeset: dab62628e2e87e637b5255f8d5510d11b097d48b
Modified Files:
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_NativeThreadNetBSD.cpp
Removed Files:
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
Log Message:
lldb-netbsd: Remove for now support for registers' accessors, fix fallout
Keep fixing fallout after recent changes.
For now comment out code fragment for reading /proc
Kill usage of absent DEBUG_PTRACE_MAXBYTES.
Include <sys/ptrace.h> for now in this file.
Kill dead macro for tgkill.
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=dab62628e2e87e637b5255f8d5510d11b097d48b
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
lldb-netbsd/distinfo | 10 +-
...ch-source_Plugins_Process_NetBSD_CMakeLists.txt | 6 +-
..._Plugins_Process_NetBSD_NativeProcessNetBSD.cpp | 13 +-
..._Process_NetBSD_NativeRegisterContextNetBSD.cpp | 173 -----------
...ns_Process_NetBSD_NativeRegisterContextNetBSD.h | 79 -----
...NetBSD_NativeRegisterContextNetBSD__x86__64.cpp | 320 ---------------------
...s_NetBSD_NativeRegisterContextNetBSD__x86__64.h | 82 ------
...e_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp | 9 +-
8 files changed, 16 insertions(+), 676 deletions(-)
diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index feacbf0..80dd6ae 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -19,14 +19,10 @@ 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) = e40163a3895c34414438abf9950dd83e4d7621c9
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = e519d35fba49dd767b6238b754aa7d2456d3393e
+SHA1 (patch-source_Plugins_Process_NetBSD_CMakeLists.txt) = df17afdf71c29d945c887e318718904793cd48ad
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 9a95d51ba4f45ee532f68d041ed9d29653bcc339
SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = 7cf588554bab15f4cc5c8510e92884af52fff7e4
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp) = f52dff9949a190a2a97061cd6f357ae111728346
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h) = 83fdae48ce361a652709e126caae681e3af8428a
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp) = 43cfbfb9afc66c8d131f78847a65688e96a0f044
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h) = 18c60c7828dfa356dfe2cc6910a63137bb6143d3
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = a63d0770b6b00d3e71346fee52e2a0ca0c4c3704
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = f06d30a489349cbe0f92b876e7cc79d713cc2794
SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = b65394500b6c5d01fcf3294a57ec5a8a086df45a
SHA1 (patch-tools_lldb-mi_MICmnBase.cpp) = 851c82ac61e1241018755fbd7236af00379ac986
SHA1 (patch-tools_lldb-mi_MICmnBase.h) = f550d5e10bcf02fb46472733acdbb820791f22e5
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 d3d47aa..b941fb3 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_CMakeLists.txt
@@ -1,15 +1,13 @@
$NetBSD$
---- source/Plugins/Process/NetBSD/CMakeLists.txt.orig 2016-12-19 00:44:29.110049715 +0000
+--- source/Plugins/Process/NetBSD/CMakeLists.txt.orig 2016-12-19 01:22:58.074182561 +0000
+++ source/Plugins/Process/NetBSD/CMakeLists.txt
-@@ -0,0 +1,10 @@
+@@ -0,0 +1,8 @@
+include_directories(.)
+include_directories(../POSIX)
+include_directories(../Utility)
+
+add_lldb_library(lldbPluginProcessNetBSD
+ NativeProcessNetBSD.cpp
-+ NativeRegisterContextNetBSD.cpp
-+ NativeRegisterContextNetBSD_x86_64.cpp
+ NativeThreadNetBSD.cpp
+ )
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 3b33525..09218ba 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 2016-12-19 00:44:29.116428500 +0000
+--- source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp.orig 2016-12-19 01:22:58.080559848 +0000
+++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
-@@ -0,0 +1,1847 @@
+@@ -0,0 +1,1852 @@
+//===-- NativeProcessNetBSD.cpp -------------------------------- -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
@@ -27,6 +27,7 @@ $NetBSD$
+#include <string>
+#include <unordered_map>
+
++
+// Other libraries and framework includes
+#include "lldb/Core/EmulateInstruction.h"
+#include "lldb/Core/Error.h"
@@ -55,6 +56,7 @@ $NetBSD$
+// 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>
@@ -98,7 +100,7 @@ $NetBSD$
+
+void DisplayBytes(StreamString &s, void *bytes, uint32_t count) {
+ uint8_t *ptr = (uint8_t *)bytes;
-+ const uint32_t loop_count = std::min<uint32_t>(DEBUG_PTRACE_MAXBYTES, count);
++ const uint32_t loop_count = count;
+ for (uint32_t i = 0; i < loop_count; i++) {
+ s.Printf("[%x]", *ptr);
+ ptr++;
@@ -1046,6 +1048,7 @@ $NetBSD$
+ return error;
+ }
+
++#if 0
+ // If our cache is empty, pull the latest. There should always be at least
+ // one memory region
+ // if memory region handling is supported.
@@ -1093,7 +1096,9 @@ $NetBSD$
+
+ // We support memory retrieval, remember that.
+ m_supports_mem_region = LazyBool::eLazyBoolYes;
-+ } else {
++ } else
++#endif
++ {
+ if (log)
+ log->Printf("NativeProcessNetBSD::%s reusing %" PRIu64
+ " cached memory region entries",
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp
deleted file mode 100644
index 034920e1..0000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-$NetBSD$
-
---- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp.orig 2016-12-19 00:44:29.129031560 +0000
-+++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
-@@ -0,0 +1,168 @@
-+//===-- 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"
-+
-+#include "lldb/Core/RegisterValue.h"
-+#include "lldb/Host/common/NativeProcessProtocol.h"
-+#include "lldb/Host/common/NativeThreadProtocol.h"
-+
-+#include "Plugins/Process/POSIX/ProcessPOSIXLog.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 {
-+ // Get the target process whose privileged thread was used for the register
-+ // read.
-+ lldb::ByteOrder byte_order = lldb::eByteOrderInvalid;
-+
-+ NativeProcessProtocolSP process_sp(m_thread.GetProcess());
-+ if (!process_sp)
-+ return byte_order;
-+
-+ if (!process_sp->GetByteOrder(byte_order)) {
-+ // FIXME log here
-+ }
-+
-+ return byte_order;
-+}
-+
-+Error NativeRegisterContextNetBSD::ReadRegisterRaw(uint32_t reg_index,
-+ RegisterValue ®_value) {
-+ const RegisterInfo *const reg_info = GetRegisterInfoAtIndex(reg_index);
-+ if (!reg_info)
-+ return Error("register %" PRIu32 " not found", reg_index);
-+
-+ return DoReadRegisterValue(reg_info->byte_offset, reg_info->name,
-+ reg_info->byte_size, reg_value);
-+}
-+
-+Error NativeRegisterContextNetBSD::WriteRegisterRaw(
-+ uint32_t reg_index, const RegisterValue ®_value) {
-+ uint32_t reg_to_write = reg_index;
-+ RegisterValue value_to_write = reg_value;
-+
-+ // Check if this is a subregister of a full register.
-+ const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg_index);
-+ if (reg_info->invalidate_regs &&
-+ (reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM)) {
-+ Error error;
-+
-+ RegisterValue full_value;
-+ uint32_t full_reg = reg_info->invalidate_regs[0];
-+ const RegisterInfo *full_reg_info = GetRegisterInfoAtIndex(full_reg);
-+
-+ // Read the full register.
-+ error = ReadRegister(full_reg_info, full_value);
-+ if (error.Fail())
-+ return error;
-+
-+ lldb::ByteOrder byte_order = GetByteOrder();
-+ uint8_t dst[RegisterValue::kMaxRegisterByteSize];
-+
-+ // Get the bytes for the full register.
-+ const uint32_t dest_size = full_value.GetAsMemoryData(
-+ full_reg_info, dst, sizeof(dst), byte_order, error);
-+ if (error.Success() && dest_size) {
-+ uint8_t src[RegisterValue::kMaxRegisterByteSize];
-+
-+ // Get the bytes for the source data.
-+ const uint32_t src_size = reg_value.GetAsMemoryData(
-+ reg_info, src, sizeof(src), byte_order, error);
-+ if (error.Success() && src_size && (src_size < dest_size)) {
-+ // Copy the src bytes to the destination.
-+ memcpy(dst + (reg_info->byte_offset & 0x1), src, src_size);
-+ // Set this full register as the value to write.
-+ value_to_write.SetBytes(dst, full_value.GetByteSize(), byte_order);
-+ value_to_write.SetType(full_reg_info);
-+ reg_to_write = full_reg;
-+ }
-+ }
-+ }
-+
-+ const RegisterInfo *const register_to_write_info_p =
-+ GetRegisterInfoAtIndex(reg_to_write);
-+ assert(register_to_write_info_p &&
-+ "register to write does not have valid RegisterInfo");
-+ if (!register_to_write_info_p)
-+ return Error("NativeRegisterContextNetBSD::%s failed to get RegisterInfo "
-+ "for write register index %" PRIu32,
-+ __FUNCTION__, reg_to_write);
-+
-+ return DoWriteRegisterValue(reg_info->byte_offset, reg_info->name, reg_value);
-+}
-+
-+Error NativeRegisterContextNetBSD::ReadGPR() {
-+ void *buf = GetGPRBuffer();
-+ if (!buf)
-+ return Error("GPR buffer is NULL");
-+
-+ return DoReadGPR(buf);
-+}
-+
-+Error NativeRegisterContextNetBSD::WriteGPR() {
-+ void *buf = GetGPRBuffer();
-+ if (!buf)
-+ return Error("GPR buffer is NULL");
-+
-+ return DoWriteGPR(buf);
-+}
-+
-+Error NativeRegisterContextNetBSD::DoReadRegisterValue(uint32_t offset,
-+ const char *reg_name,
-+ uint32_t size,
-+ RegisterValue &value) {
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_REGISTERS));
-+
-+ long data;
-+ Error error = NativeProcessNetBSD::PtraceWrapper(
-+ PTRACE_PEEKUSER, m_thread.GetID(), reinterpret_cast<void *>(offset),
-+ nullptr, 0, &data);
-+
-+ if (error.Success())
-+ // First cast to an unsigned of the same size to avoid sign extension.
-+ value.SetUInt(static_cast<unsigned long>(data), size);
-+
-+ if (log)
-+ log->Printf("NativeRegisterContextNetBSD::%s() reg %s: 0x%lx", __FUNCTION__,
-+ reg_name, data);
-+
-+ return error;
-+}
-+
-+Error NativeRegisterContextNetBSD::DoWriteRegisterValue(
-+ uint32_t offset, const char *reg_name, const RegisterValue &value) {
-+ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_REGISTERS));
-+
-+ void *buf = reinterpret_cast<void *>(value.GetAsUInt64());
-+
-+ if (log)
-+ log->Printf("NativeRegisterContextNetBSD::%s() reg %s: %p", __FUNCTION__,
-+ reg_name, buf);
-+
-+ return NativeProcessNetBSD::PtraceWrapper(
-+ PTRACE_POKEUSER, m_thread.GetID(), reinterpret_cast<void *>(offset), buf);
-+}
-+
-+Error NativeRegisterContextNetBSD::DoReadGPR(void *buf) {
-+ return NativeProcessNetBSD::PtraceWrapper(PT_GETREGS, GetID(), buf,
-+ m_thread.GetID());
-+}
-+
-+Error NativeRegisterContextNetBSD::DoWriteGPR(void *buf) {
-+ return NativeProcessNetBSD::PtraceWrapper(PT_SETREGS, GetID(), buf,
-+ m_thread.GetID());
-+}
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
deleted file mode 100644
index b8d2ff8..0000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
+++ /dev/null
@@ -1,79 +0,0 @@
-$NetBSD$
-
---- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h.orig 2016-12-17 13:23:23.783738014 +0000
-+++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
-@@ -0,0 +1,74 @@
-+//===-- 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 ReadRegisterRaw(uint32_t reg_index, RegisterValue ®_value);
-+
-+ virtual Error WriteRegisterRaw(uint32_t reg_index,
-+ const RegisterValue ®_value);
-+
-+ virtual Error ReadGPR();
-+
-+ virtual Error WriteGPR();
-+
-+ virtual void *GetGPRBuffer() { return nullptr; }
-+
-+ virtual size_t GetGPRSize() {
-+ return GetRegisterInfoInterface().GetGPRSize();
-+ }
-+
-+ // The Do*** functions are executed on the privileged thread and can perform
-+ // ptrace
-+ // operations directly.
-+ virtual Error DoReadRegisterValue(uint32_t offset, const char *reg_name,
-+ uint32_t size, RegisterValue &value);
-+
-+ virtual Error DoWriteRegisterValue(uint32_t offset, const char *reg_name,
-+ const RegisterValue &value);
-+
-+ virtual Error DoReadGPR(void *buf);
-+
-+ virtual Error DoWriteGPR(void *buf);
-+};
-+
-+} // namespace process_netbsd
-+} // namespace lldb_private
-+
-+#endif // #ifndef lldb_NativeRegisterContextNetBSD_h
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
deleted file mode 100644
index 04f7d62..0000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp
+++ /dev/null
@@ -1,320 +0,0 @@
-$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,315 @@
-+//===-- 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/DataBufferHeap.h"
-+#include "lldb/Core/Error.h"
-+#include "lldb/Core/Log.h"
-+#include "lldb/Core/RegisterValue.h"
-+#include "lldb/Host/HostInfo.h"
-+
-+#include "Plugins/Process/Utility/RegisterContextNetBSD_x86_64.h"
-+
-+#include <sys/exec_elf.h>
-+
-+using namespace lldb_private;
-+using namespace lldb_private::process_netbsd;
-+
-+// ----------------------------------------------------------------------------
-+// Private namespace.
-+// ----------------------------------------------------------------------------
-+
-+namespace {
-+// 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,
-+ lldb_rdi_x86_64, lldb_rsi_x86_64, lldb_rbp_x86_64, lldb_rsp_x86_64,
-+ lldb_r8_x86_64, lldb_r9_x86_64, lldb_r10_x86_64, lldb_r11_x86_64,
-+ lldb_r12_x86_64, lldb_r13_x86_64, lldb_r14_x86_64, lldb_r15_x86_64,
-+ lldb_rip_x86_64, lldb_rflags_x86_64, lldb_cs_x86_64, lldb_fs_x86_64,
-+ lldb_gs_x86_64, lldb_ss_x86_64, lldb_ds_x86_64, lldb_es_x86_64,
-+ lldb_eax_x86_64, lldb_ebx_x86_64, lldb_ecx_x86_64, lldb_edx_x86_64,
-+ lldb_edi_x86_64, lldb_esi_x86_64, lldb_ebp_x86_64, lldb_esp_x86_64,
-+ lldb_r8d_x86_64, // Low 32 bits or r8
-+ lldb_r9d_x86_64, // Low 32 bits or r9
-+ lldb_r10d_x86_64, // Low 32 bits or r10
-+ lldb_r11d_x86_64, // Low 32 bits or r11
-+ lldb_r12d_x86_64, // Low 32 bits or r12
-+ lldb_r13d_x86_64, // Low 32 bits or r13
-+ lldb_r14d_x86_64, // Low 32 bits or r14
-+ lldb_r15d_x86_64, // Low 32 bits or r15
-+ lldb_ax_x86_64, lldb_bx_x86_64, lldb_cx_x86_64, lldb_dx_x86_64,
-+ lldb_di_x86_64, lldb_si_x86_64, lldb_bp_x86_64, lldb_sp_x86_64,
-+ lldb_r8w_x86_64, // Low 16 bits or r8
-+ lldb_r9w_x86_64, // Low 16 bits or r9
-+ lldb_r10w_x86_64, // Low 16 bits or r10
-+ lldb_r11w_x86_64, // Low 16 bits or r11
-+ lldb_r12w_x86_64, // Low 16 bits or r12
-+ lldb_r13w_x86_64, // Low 16 bits or r13
-+ lldb_r14w_x86_64, // Low 16 bits or r14
-+ lldb_r15w_x86_64, // Low 16 bits or r15
-+ lldb_ah_x86_64, lldb_bh_x86_64, lldb_ch_x86_64, lldb_dh_x86_64,
-+ lldb_al_x86_64, lldb_bl_x86_64, lldb_cl_x86_64, lldb_dl_x86_64,
-+ lldb_dil_x86_64, lldb_sil_x86_64, lldb_bpl_x86_64, lldb_spl_x86_64,
-+ lldb_r8l_x86_64, // Low 8 bits or r8
-+ lldb_r9l_x86_64, // Low 8 bits or r9
-+ lldb_r10l_x86_64, // Low 8 bits or r10
-+ lldb_r11l_x86_64, // Low 8 bits or r11
-+ lldb_r12l_x86_64, // Low 8 bits or r12
-+ lldb_r13l_x86_64, // Low 8 bits or r13
-+ lldb_r14l_x86_64, // Low 8 bits or r14
-+ lldb_r15l_x86_64, // Low 8 bits or r15
-+ LLDB_INVALID_REGNUM // register sets need to end with this flag
-+};
-+static_assert((sizeof(g_gpr_regnums_x86_64) / sizeof(g_gpr_regnums_x86_64[0])) -
-+ 1 ==
-+ k_num_gpr_registers_x86_64,
-+ "g_gpr_regnums_x86_64 has wrong number of register infos");
-+
-+// Number of register sets provided by this context.
-+enum { k_num_extended_register_sets = 2, k_num_register_sets = 4 };
-+
-+// Register sets for x86 64-bit.
-+static const RegisterSet g_reg_sets_x86_64[k_num_register_sets] = {
-+ {"General Purpose Registers", "gpr", k_num_gpr_registers_x86_64,
-+ g_gpr_regnums_x86_64}};
-+}
-+
-+#define REG_CONTEXT_SIZE (GetRegisterInfoInterface().GetGPRSize())
-+
-+// ----------------------------------------------------------------------------
-+// NativeRegisterContextNetBSD_x86_64 members.
-+// ----------------------------------------------------------------------------
-+
-+static RegisterInfoInterface *
-+CreateRegisterInfoInterface(const ArchSpec &target_arch) {
-+ assert((HostInfo::GetArchitecture().GetAddressByteSize() == 8) &&
-+ "Register setting path assumes this is a 64-bit host");
-+ // X86_64 hosts know how to work with 64-bit and 32-bit EXEs using the
-+ // x86_64 register context.
-+ return new RegisterContextNetBSD_x86_64(target_arch);
-+}
-+
-+NativeRegisterContextNetBSD_x86_64::NativeRegisterContextNetBSD_x86_64(
-+ const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
-+ uint32_t concrete_frame_idx)
-+ : NativeRegisterContextNetBSD(native_thread, concrete_frame_idx,
-+ CreateRegisterInfoInterface(target_arch)),
-+ m_reg_info(), m_gpr_x86_64() {
-+ // Set up data about ranges of valid registers.
-+ switch (target_arch.GetMachine()) {
-+ case llvm::Triple::x86_64:
-+ m_reg_info.num_registers = k_num_registers_x86_64;
-+ m_reg_info.num_gpr_registers = k_num_gpr_registers_x86_64;
-+ break;
-+ default:
-+ assert(false && "Unhandled target architecture.");
-+ break;
-+ }
-+}
-+
-+// CONSIDER after local and llgs debugging are merged, register set support can
-+// be moved into a base x86-64 class with IsRegisterSetAvailable made virtual.
-+uint32_t NativeRegisterContextNetBSD_x86_64::GetRegisterSetCount() const {
-+ uint32_t sets = 0;
-+ for (uint32_t set_index = 0; set_index < k_num_register_sets; ++set_index) {
-+ if (IsRegisterSetAvailable(set_index))
-+ ++sets;
-+ }
-+
-+ return sets;
-+}
-+
-+uint32_t NativeRegisterContextNetBSD_x86_64::GetUserRegisterCount() const {
-+ uint32_t count = 0;
-+ for (uint32_t set_index = 0; set_index < k_num_register_sets; ++set_index) {
-+ const RegisterSet *set = GetRegisterSet(set_index);
-+ if (set)
-+ count += set->num_registers;
-+ }
-+ return count;
-+}
-+
-+const RegisterSet *
-+NativeRegisterContextNetBSD_x86_64::GetRegisterSet(uint32_t set_index) const {
-+ if (!IsRegisterSetAvailable(set_index))
-+ return nullptr;
-+
-+ switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
-+ case llvm::Triple::x86_64:
-+ return &g_reg_sets_x86_64[set_index];
-+ default:
-+ assert(false && "Unhandled target architecture.");
-+ return nullptr;
-+ }
-+
-+ return nullptr;
-+}
-+
-+Error NativeRegisterContextNetBSD_x86_64::ReadRegister(
-+ const RegisterInfo *reg_info, RegisterValue ®_value) {
-+ Error error;
-+
-+ if (!reg_info) {
-+ error.SetErrorString("reg_info NULL");
-+ return error;
-+ }
-+
-+ const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];
-+ if (reg == LLDB_INVALID_REGNUM) {
-+ // This is likely an internal register for lldb use only and should not be
-+ // directly queried.
-+ error.SetErrorStringWithFormat("register \"%s\" is an internal-only lldb "
-+ "register, cannot read directly",
-+ reg_info->name);
-+ return error;
-+ }
-+
-+ uint32_t full_reg = reg;
-+ bool is_subreg = reg_info->invalidate_regs &&
-+ (reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM);
-+
-+ if (is_subreg) {
-+ // Read the full aligned 64-bit register.
-+ full_reg = reg_info->invalidate_regs[0];
-+ }
-+
-+ error = ReadRegisterRaw(full_reg, reg_value);
-+
-+ if (error.Success()) {
-+ // If our read was not aligned (for ah,bh,ch,dh), shift our returned value
-+ // one byte to the right.
-+ if (is_subreg && (reg_info->byte_offset & 0x1))
-+ reg_value.SetUInt64(reg_value.GetAsUInt64() >> 8);
-+
-+ // If our return byte size was greater than the return value reg size,
-+ // then
-+ // use the type specified by reg_info rather than the uint64_t default
-+ if (reg_value.GetByteSize() > reg_info->byte_size)
-+ reg_value.SetType(reg_info);
-+ }
-+ return error;
-+}
-+
-+Error NativeRegisterContextNetBSD_x86_64::WriteRegister(
-+ const RegisterInfo *reg_info, const RegisterValue ®_value) {
-+ assert(reg_info && "reg_info is null");
-+
-+ const uint32_t reg_index = reg_info->kinds[lldb::eRegisterKindLLDB];
-+ if (reg_index == LLDB_INVALID_REGNUM)
-+ return Error("no lldb regnum for %s", reg_info && reg_info->name
-+ ? reg_info->name
-+ : "<unknown register>");
-+
-+ return WriteRegisterRaw(reg_index, reg_value);
-+
-+ return Error("failed - register wasn't recognized to be a GPR, "
-+ "write strategy unknown");
-+}
-+
-+Error NativeRegisterContextNetBSD_x86_64::ReadAllRegisterValues(
-+ lldb::DataBufferSP &data_sp) {
-+ Error error;
-+
-+ data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
-+ if (!data_sp) {
-+ error.SetErrorStringWithFormat(
-+ "failed to allocate DataBufferHeap instance of size %" PRIu64,
-+ REG_CONTEXT_SIZE);
-+ return error;
-+ }
-+
-+ error = ReadGPR();
-+ if (error.Fail())
-+ return error;
-+
-+ uint8_t *dst = data_sp->GetBytes();
-+ if (dst == nullptr) {
-+ error.SetErrorStringWithFormat("DataBufferHeap instance of size %" PRIu64
-+ " returned a null pointer",
-+ REG_CONTEXT_SIZE);
-+ return error;
-+ }
-+
-+ ::memcpy(dst, &m_gpr_x86_64, GetRegisterInfoInterface().GetGPRSize());
-+ dst += GetRegisterInfoInterface().GetGPRSize();
-+
-+ RegisterValue value((uint64_t)-1);
-+ const RegisterInfo *reg_info =
-+ GetRegisterInfoInterface().GetDynamicRegisterInfo("orig_eax");
-+ if (reg_info == nullptr)
-+ reg_info = GetRegisterInfoInterface().GetDynamicRegisterInfo("orig_rax");
-+
-+ if (reg_info != nullptr)
-+ return DoWriteRegisterValue(reg_info->byte_offset, reg_info->name, value);
-+
-+ return error;
-+}
-+
-+Error NativeRegisterContextNetBSD_x86_64::WriteAllRegisterValues(
-+ const lldb::DataBufferSP &data_sp) {
-+ Error error;
-+
-+ if (!data_sp) {
-+ error.SetErrorStringWithFormat(
-+ "NativeRegisterContextNetBSD_x86_64::%s invalid data_sp provided",
-+ __FUNCTION__);
-+ return error;
-+ }
-+
-+ if (data_sp->GetByteSize() != REG_CONTEXT_SIZE) {
-+ error.SetErrorStringWithFormat(
-+ "NativeRegisterContextNetBSD_x86_64::%s data_sp contained mismatched "
-+ "data size, expected %" PRIu64 ", actual %" PRIu64,
-+ __FUNCTION__, REG_CONTEXT_SIZE, data_sp->GetByteSize());
-+ return error;
-+ }
-+
-+ uint8_t *src = data_sp->GetBytes();
-+ if (src == nullptr) {
-+ error.SetErrorStringWithFormat("NativeRegisterContextNetBSD_x86_64::%s "
-+ "DataBuffer::GetBytes() returned a null "
-+ "pointer",
-+ __FUNCTION__);
-+ return error;
-+ }
-+ ::memcpy(&m_gpr_x86_64, src, GetRegisterInfoInterface().GetGPRSize());
-+
-+ error = WriteGPR();
-+ if (error.Fail())
-+ return error;
-+
-+ src += GetRegisterInfoInterface().GetGPRSize();
-+
-+ return error;
-+}
-+
-+bool NativeRegisterContextNetBSD_x86_64::IsCPUFeatureAvailable(
-+ RegSet feature_code) const {
-+
-+ switch (feature_code) {
-+ case RegSet::gpr:
-+ return true;
-+ }
-+ return false;
-+}
-+
-+bool NativeRegisterContextNetBSD_x86_64::IsRegisterSetAvailable(
-+ uint32_t set_index) const {
-+ uint32_t num_sets = k_num_register_sets - k_num_extended_register_sets;
-+
-+ switch (static_cast<RegSet>(set_index)) {
-+ }
-+ return false;
-+}
-+
-+#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
deleted file mode 100644
index dc82f27..0000000
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h
+++ /dev/null
@@ -1,82 +0,0 @@
-$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,77 @@
-+//===-- NativeRegisterContextNetBSD_x86_64.h ---------------------*- 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__)
-+
-+#ifndef lldb_NativeRegisterContextNetBSD_x86_64_h
-+#define lldb_NativeRegisterContextNetBSD_x86_64_h
-+
-+#include "Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h"
-+#include "Plugins/Process/Utility/RegisterContext_x86.h"
-+#include "Plugins/Process/Utility/lldb-x86-register-enums.h"
-+
-+namespace lldb_private {
-+namespace process_netbsd {
-+
-+class NativeProcessNetBSD;
-+
-+class NativeRegisterContextNetBSD_x86_64 : public NativeRegisterContextNetBSD {
-+public:
-+ NativeRegisterContextNetBSD_x86_64(const ArchSpec &target_arch,
-+ NativeThreadProtocol &native_thread,
-+ uint32_t concrete_frame_idx);
-+
-+ uint32_t GetRegisterSetCount() const override;
-+
-+ const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
-+
-+ uint32_t GetUserRegisterCount() const override;
-+
-+ Error ReadRegister(const RegisterInfo *reg_info,
-+ RegisterValue ®_value) override;
-+
-+ Error WriteRegister(const RegisterInfo *reg_info,
-+ const RegisterValue ®_value) override;
-+
-+ Error ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
-+
-+ Error WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
-+
-+protected:
-+ void *GetGPRBuffer() override { return &m_gpr_x86_64; }
-+
-+private:
-+ // Private member types.
-+ enum class XStateType { Invalid, FXSAVE, XSAVE };
-+ enum class RegSet { gpr, fpu, avx, mpx };
-+
-+ // Info about register ranges.
-+ struct RegInfo {
-+ uint32_t num_registers;
-+ uint32_t num_gpr_registers;
-+ };
-+
-+ // Private member variables.
-+ IOVEC m_iovec;
-+ RegInfo m_reg_info;
-+ uint64_t m_gpr_x86_64[k_num_gpr_registers_x86_64];
-+ uint32_t m_fctrl_offset_in_userarea;
-+
-+ // Private member methods.
-+ bool IsCPUFeatureAvailable(RegSet feature_code) const;
-+
-+ bool IsRegisterSetAvailable(uint32_t set_index) const;
-+};
-+
-+} // namespace process_netbsd
-+} // namespace lldb_private
-+
-+#endif // #ifndef lldb_NativeRegisterContextNetBSD_x86_64_h
-+
-+#endif defined(__x86_64__)
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 ef33e5a..fdc6f3d 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp
@@ -1,8 +1,8 @@
$NetBSD$
---- source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp.orig 2016-12-19 00:44:29.153254744 +0000
+--- source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp.orig 2016-12-19 01:22:58.093122208 +0000
+++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
-@@ -0,0 +1,318 @@
+@@ -0,0 +1,313 @@
+//===-- NativeThreadNetBSD.cpp --------------------------------- -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
@@ -18,7 +18,6 @@ $NetBSD$
+#include <sstream>
+
+#include "NativeProcessNetBSD.h"
-+#include "NativeRegisterContextNetBSD.h"
+
+#include "lldb/Core/Log.h"
+#include "lldb/Core/State.h"
@@ -31,10 +30,6 @@ $NetBSD$
+#include "Plugins/Process/POSIX/CrashReason.h"
+
+#include <sys/syscall.h>
-+// Try to define a macro to encapsulate the tgkill syscall
-+#define tgkill(pid, tid, sig) \
-+ syscall(__NR_tgkill, static_cast<::pid_t>(pid), static_cast<::pid_t>(tid), \
-+ sig)
+
+using namespace lldb;
+using namespace lldb_private;
Home |
Main Index |
Thread Index |
Old Index