pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lldb-netbsd: Fixes in the breakpoint session
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Thu Mar 16 13:43:05 2017 +0100
Changeset: 2c9c8e7b56dd3b4b898c917b41bb9ff95ee66aa7
Modified Files:
lldb-netbsd/distinfo
lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
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: Fixes in the breakpoint session
Fix:
- kve_path resolving, noted by Christos Zoulas
- kinfo_getvmmap was called for invalid PID
- add support for writing registers
- introduce WriteRegisterSet()
Breakpoints appear to work and the number of passing tests has been doubled:
===================
Test Result Summary
===================
Test Methods: 1240
Reruns: 0
Success: 596
Expected Failure: 21
Failure: 86
Error: 91
Exceptional Exit: 0
Unexpected Success: 1
Skip: 444
Timeout: 1
Expected Timeout: 0
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=2c9c8e7b56dd3b4b898c917b41bb9ff95ee66aa7
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
lldb-netbsd/distinfo | 6 +-
..._Plugins_Process_NetBSD_NativeProcessNetBSD.cpp | 4 +-
...NetBSD_NativeRegisterContextNetBSD__x86__64.cpp | 139 +++++++++++++++++++--
...s_NetBSD_NativeRegisterContextNetBSD__x86__64.h | 5 +-
4 files changed, 137 insertions(+), 17 deletions(-)
diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index b43105e179..7cac777b92 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -26,12 +26,12 @@ SHA1 (patch-source_Plugins_DynamicLoader_POSIX-DYLD_DYLDRendezvous.cpp) = 32d683
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) = 78521c12fbd070ba6221fd2619630bf8306e4cbf
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = f3c6ca6bad6f30f9282c70d0144feb821386f147
SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = f051f86d7ca2047e9f4d414e46f454e626348c14
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_NativeRegisterContextNetBSD__x86__64.cpp) = 1f6c73419c4073cae519abf3259ccf3d7f48cb5b
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h) = dee7f3fafaf4688d573075897293d42b498484bf
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
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 70899b460a..83f155c66a 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp
@@ -943,7 +943,7 @@ $NetBSD$
+
+ struct kinfo_vmentry *vm;
+ size_t count, i;
-+ vm = kinfo_getvmmap(getpid(), &count);
++ vm = kinfo_getvmmap(GetID(), &count);
+ if (vm == NULL) {
+ m_supports_mem_region = LazyBool::eLazyBoolNo;
+ Error error;
@@ -972,7 +972,7 @@ $NetBSD$
+ else
+ info.SetExecutable(MemoryRegionInfo::OptionalBool::eNo);
+
-+ if (vm[i].kve_path)
++ if (vm[i].kve_path[0])
+ info.SetName(vm[i].kve_path);
+
+ m_mem_region_cache.emplace_back(
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 0db601fc13..4b0362154b 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,8 +1,8 @@
$NetBSD$
---- 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.orig 2017-03-14 16:45:14.549668075 +0000
+++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
-@@ -0,0 +1,434 @@
+@@ -0,0 +1,553 @@
+//===-- NativeRegisterContextNetBSD_x86_64.cpp ---------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
@@ -226,6 +226,20 @@ $NetBSD$
+ return -1;
+}
+
++int NativeRegisterContextNetBSD_x86_64::WriteRegisterSet(uint32_t set) {
++ switch (set) {
++ case GPRegSet:
++ WriteGPR();
++ return 0;
++ case FPRegSet:
++ WriteFPR();
++ return 0;
++ default:
++ break;
++ }
++ return -1;
++}
++
+Error NativeRegisterContextNetBSD_x86_64::ReadRegister(
+ const RegisterInfo *reg_info, RegisterValue ®_value) {
+ Error error;
@@ -342,16 +356,121 @@ $NetBSD$
+
+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>");
++ 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;
++ }
++
++ int set = GetSetForNativeRegNum(reg);
++ if (set == -1) {
++ // This is likely an internal register for lldb use only and should not be
++ // directly queried.
++ error.SetErrorStringWithFormat("register \"%s\" is in unrecognized set",
++ reg_info->name);
++ return error;
++ }
++
++ if (ReadRegisterSet(set, false) != 0) {
++ // This is likely an internal register for lldb use only and should not be
++ // directly queried.
++ error.SetErrorStringWithFormat("reading register set for register \"%s\" failed",
++ reg_info->name);
++ return error;
++ }
++
++ switch (reg) {
++ case lldb_rax_x86_64:
++ m_gpr_x86_64.regs[_REG_RAX] = reg_value.GetAsUInt64();
++ break;
++ case lldb_rbx_x86_64:
++ m_gpr_x86_64.regs[_REG_RBX] = reg_value.GetAsUInt64();
++ break;
++ case lldb_rcx_x86_64:
++ m_gpr_x86_64.regs[_REG_RCX] = reg_value.GetAsUInt64();
++ break;
++ case lldb_rdx_x86_64:
++ m_gpr_x86_64.regs[_REG_RDX] = reg_value.GetAsUInt64();
++ break;
++ case lldb_rdi_x86_64:
++ m_gpr_x86_64.regs[_REG_RDI] = reg_value.GetAsUInt64();
++ break;
++ case lldb_rsi_x86_64:
++ m_gpr_x86_64.regs[_REG_RSI] = reg_value.GetAsUInt64();
++ break;
++ case lldb_rbp_x86_64:
++ m_gpr_x86_64.regs[_REG_RBP] = reg_value.GetAsUInt64();
++ break;
++ case lldb_rsp_x86_64:
++ m_gpr_x86_64.regs[_REG_RSP] = reg_value.GetAsUInt64();
++ break;
++ case lldb_r8_x86_64:
++ m_gpr_x86_64.regs[_REG_R8] = reg_value.GetAsUInt64();
++ break;
++ case lldb_r9_x86_64:
++ m_gpr_x86_64.regs[_REG_R9] = reg_value.GetAsUInt64();
++ break;
++ case lldb_r10_x86_64:
++ m_gpr_x86_64.regs[_REG_R10] = reg_value.GetAsUInt64();
++ break;
++ case lldb_r11_x86_64:
++ m_gpr_x86_64.regs[_REG_R11] = reg_value.GetAsUInt64();
++ break;
++ case lldb_r12_x86_64:
++ m_gpr_x86_64.regs[_REG_R12] = reg_value.GetAsUInt64();
++ break;
++ case lldb_r13_x86_64:
++ m_gpr_x86_64.regs[_REG_R13] = reg_value.GetAsUInt64();
++ break;
++ case lldb_r14_x86_64:
++ m_gpr_x86_64.regs[_REG_R14] = reg_value.GetAsUInt64();
++ break;
++ case lldb_r15_x86_64:
++ m_gpr_x86_64.regs[_REG_R15] = reg_value.GetAsUInt64();
++ break;
++ case lldb_rip_x86_64:
++ m_gpr_x86_64.regs[_REG_RIP] = reg_value.GetAsUInt64();
++ break;
++ case lldb_rflags_x86_64:
++ m_gpr_x86_64.regs[_REG_RFLAGS] = reg_value.GetAsUInt64();
++ break;
++ case lldb_cs_x86_64:
++ m_gpr_x86_64.regs[_REG_CS] = reg_value.GetAsUInt64();
++ break;
++ case lldb_fs_x86_64:
++ m_gpr_x86_64.regs[_REG_FS] = reg_value.GetAsUInt64();
++ break;
++ case lldb_gs_x86_64:
++ m_gpr_x86_64.regs[_REG_GS] = reg_value.GetAsUInt64();
++ break;
++ case lldb_ss_x86_64:
++ m_gpr_x86_64.regs[_REG_SS] = reg_value.GetAsUInt64();
++ break;
++ case lldb_ds_x86_64:
++ m_gpr_x86_64.regs[_REG_DS] = reg_value.GetAsUInt64();
++ break;
++ case lldb_es_x86_64:
++ m_gpr_x86_64.regs[_REG_ES] = reg_value.GetAsUInt64();
++ break;
++ }
++
++ if (WriteRegisterSet(set) != 0)
++ error.SetErrorStringWithFormat(
++ "failed to write register set");
+
-+ return Error("failed - register wasn't recognized to be a GPR or an FPR, "
-+ "write strategy unknown");
++ return error;
+}
+
+Error NativeRegisterContextNetBSD_x86_64::ReadAllRegisterValues(
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 b111da44f3..da612280a3 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,8 +1,8 @@
$NetBSD$
---- 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.orig 2017-03-14 16:45:14.556385063 +0000
+++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
-@@ -0,0 +1,82 @@
+@@ -0,0 +1,83 @@
+//===-- NativeRegisterContextNetBSD_x86_64.h ---------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
@@ -77,6 +77,7 @@ $NetBSD$
+ enum { GPRegSet = 4, FPRegSet = 5, DBRegSet = 6 };
+
+ int ReadRegisterSet(uint32_t set, bool force);
++ int WriteRegisterSet(uint32_t set);
+};
+
+} // namespace process_netbsd
Home |
Main Index |
Thread Index |
Old Index