pkgsrc-WIP-changes archive

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

lldb-netbsd: Drop *RegisterValue(), adapt accessors for Registers for NetBSD



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Thu Mar 2 00:30:09 2017 +0100
Changeset:	d1cc9dcc31a01c52ef66c92064c8565941c13cb6

Modified Files:
	lldb-netbsd/distinfo
	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

Log Message:
lldb-netbsd: Drop *RegisterValue(), adapt accessors for Registers for NetBSD

This is work in progress.

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

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

diffstat:
 lldb-netbsd/distinfo                               |  6 +-
 ..._Process_NetBSD_NativeRegisterContextNetBSD.cpp | 72 +++++-----------------
 ...ns_Process_NetBSD_NativeRegisterContextNetBSD.h | 19 ++----
 ...NetBSD_NativeRegisterContextNetBSD__x86__64.cpp |  4 +-
 4 files changed, 28 insertions(+), 73 deletions(-)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index d13bd0fd38..3447e5f16a 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -25,9 +25,9 @@ SHA1 (patch-source_Plugins_Process_CMakeLists.txt) = c689ff4ec455234f8d506dc9eb8
 SHA1 (patch-source_Plugins_Process_NetBSD_CMakeLists.txt) = a77f397020ab752875813a7a93b53ccd3a130e6f
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 037094d3eaa832eaf2b3719833d2d3c46101e03e
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = c48bb2dd45682164ab904b8b3f7664b91ac35d5b
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp) = 0e03b713b3b6f5aeda45ac641d20fe6f86cb85d5
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h) = 4ad37620c68d28d7a5a9fec99d7c64f496a1d330
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp) = 2410f1f6861adf9ac43320827847ec070520ed5d
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp) = 2dff3507976723d6658e7b2527a9b689bdb7d2d6
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h) = d7f77fcd065f608a87e724a850dacf4e3fd8d056
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp) = a5db8c3cf6cd7157093bf77944722f88cbff6325
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h) = 58803697f65411d1ad62e45c6af68c9271633bac
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = 0985eaefb605c06185cc14fa1c02c0b9f8318472
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = c675af8495a75f99bb60cb4ab3fa36223f1cb6f4
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 59c8d56022..7245ae998b 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp
@@ -2,7 +2,7 @@ $NetBSD$
 
 --- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp.orig	2017-03-01 11:04:39.184136620 +0000
 +++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp
-@@ -0,0 +1,135 @@
+@@ -0,0 +1,97 @@
 +//===-- NativeRegisterContextNetBSD.cpp --------------------------*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -53,88 +53,50 @@ $NetBSD$
 +  void *buf = GetGPRBuffer();
 +  if (!buf)
 +    return Error("GPR buffer is NULL");
-+  size_t buf_size = GetGPRSize();
 +
-+  return DoReadGPR(buf, buf_size);
++  return DoReadGPR(buf);
 +}
 +
 +Error NativeRegisterContextNetBSD::WriteGPR() {
 +  void *buf = GetGPRBuffer();
 +  if (!buf)
 +    return Error("GPR buffer is NULL");
-+  size_t buf_size = GetGPRSize();
 +
-+  return DoWriteGPR(buf, buf_size);
++  return DoWriteGPR(buf);
 +}
 +
 +Error NativeRegisterContextNetBSD::ReadFPR() {
 +  void *buf = GetFPRBuffer();
 +  if (!buf)
 +    return Error("FPR buffer is NULL");
-+  size_t buf_size = GetFPRSize();
 +
-+  return DoReadFPR(buf, buf_size);
++  return DoReadFPR(buf);
 +}
 +
 +Error NativeRegisterContextNetBSD::WriteFPR() {
 +  void *buf = GetFPRBuffer();
 +  if (!buf)
 +    return Error("FPR buffer is NULL");
-+  size_t buf_size = GetFPRSize();
 +
-+  return DoWriteFPR(buf, buf_size);
++  return DoWriteFPR(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);
-+
-+  LLDB_LOG(log, "{0}: {1:x}", 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());
-+  LLDB_LOG(log, "{0}: {1}", reg_name, buf);
-+
-+#if 0
-+  return NativeProcessNetBSD::PtraceWrapper(
-+      PTRACE_POKEUSER, m_thread.GetID(), reinterpret_cast<void *>(offset), buf);
-+#else
-+  return Error();
-+#endif
-+}
-+
-+Error NativeRegisterContextNetBSD::DoReadGPR(void *buf, size_t buf_size) {
-+  return NativeProcessNetBSD::PtraceWrapper(PT_GETREGS, m_thread.GetID(),
-+                                           nullptr, 0);
++Error NativeRegisterContextNetBSD::DoReadGPR(void *buf) {
++  return NativeProcessNetBSD::PtraceWrapper(PT_GETREGS, 0,
++                                            buf, m_thread.GetID());
 +}
 +
-+Error NativeRegisterContextNetBSD::DoWriteGPR(void *buf, size_t buf_size) {
-+  return NativeProcessNetBSD::PtraceWrapper(PT_SETREGS, m_thread.GetID(),
-+                                           nullptr, 0);
++Error NativeRegisterContextNetBSD::DoWriteGPR(void *buf) {
++  return NativeProcessNetBSD::PtraceWrapper(PT_SETREGS, 0,
++                                            buf, m_thread.GetID());
 +}
 +
-+Error NativeRegisterContextNetBSD::DoReadFPR(void *buf, size_t buf_size) {
-+  return NativeProcessNetBSD::PtraceWrapper(PT_GETFPREGS, m_thread.GetID(),
-+                                           nullptr, 0);
++Error NativeRegisterContextNetBSD::DoReadFPR(void *buf) {
++  return NativeProcessNetBSD::PtraceWrapper(PT_GETFPREGS, 0,
++                                            buf, m_thread.GetID());
 +}
 +
-+Error NativeRegisterContextNetBSD::DoWriteFPR(void *buf, size_t buf_size) {
-+  return NativeProcessNetBSD::PtraceWrapper(PT_SETFPREGS, m_thread.GetID(),
-+                                           nullptr, 0);
++Error NativeRegisterContextNetBSD::DoWriteFPR(void *buf) {
++  return NativeProcessNetBSD::PtraceWrapper(PT_SETFPREGS, 0,
++                                            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
index 844a093f92..297b6086d5 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h
@@ -2,7 +2,7 @@ $NetBSD$
 
 --- source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h.orig	2017-03-01 11:04:42.048407244 +0000
 +++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
-@@ -0,0 +1,81 @@
+@@ -0,0 +1,72 @@
 +//===-- NativeRegisterContextNetBSD.h ----------------------------*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -62,22 +62,13 @@ $NetBSD$
 +
 +  virtual size_t GetFPRSize() { return 0; }
 +
-+  // 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 DoReadGPR(void *buf);
 +
-+  virtual Error DoWriteRegisterValue(uint32_t offset, const char *reg_name,
-+                                     const RegisterValue &value);
++  virtual Error DoWriteGPR(void *buf);
 +
-+  virtual Error DoReadGPR(void *buf, size_t buf_size);
++  virtual Error DoReadFPR(void *buf);
 +
-+  virtual Error DoWriteGPR(void *buf, size_t buf_size);
-+
-+  virtual Error DoReadFPR(void *buf, size_t buf_size);
-+
-+  virtual Error DoWriteFPR(void *buf, size_t buf_size);
++  virtual Error DoWriteFPR(void *buf);
 +};
 +
 +} // namespace process_netbsd
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp
index 4e6adb7b57..7a142d4833 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	2017-03-01 11:04:48.447830223 +0000
 +++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
-@@ -0,0 +1,1012 @@
+@@ -0,0 +1,1014 @@
 +//===-- NativeRegisterContextNetBSD_x86_64.cpp ---------------*- C++ -*-===//
 +//
 +//                     The LLVM Compiler Infrastructure
@@ -717,8 +717,10 @@ $NetBSD$
 +  if (reg_info == nullptr)
 +    reg_info = GetRegisterInfoInterface().GetDynamicRegisterInfo("orig_rax");
 +
++#if 0
 +  if (reg_info != nullptr)
 +    return DoWriteRegisterValue(reg_info->byte_offset, reg_info->name, value);
++#endif
 +
 +  return error;
 +}


Home | Main Index | Thread Index | Old Index