pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lldb-netbsd: Anoter round with watchpoints/NetBSD fixes
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Tue Apr 11 14:01:11 2017 +0200
Changeset: 79db378dce2e5dc558802374fa9e9aad7037a9c7
Modified Files:
lldb-netbsd/distinfo
lldb-netbsd/patches/patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp
Log Message:
lldb-netbsd: Anoter round with watchpoints/NetBSD fixes
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=79db378dce2e5dc558802374fa9e9aad7037a9c7
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
lldb-netbsd/distinfo | 2 +-
...NetBSD_NativeRegisterContextNetBSD__x86__64.cpp | 89 +++++++++++++++++-----
2 files changed, 69 insertions(+), 22 deletions(-)
diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index e1c2542975..ad9506ade2 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -16,7 +16,7 @@ SHA1 (patch-source_Core_ArchSpec.cpp) = 1585f4ffa707bc69e96f7dd3b5137e00858ed7be
SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = f20a1520d282f40c92408d3106a3bba1027e3069
SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.cpp) = abeb0ceb532831404f692f2e25532f81f2a83163
SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD.h) = 30ef94fb108271313ec61cf4d293fe5d9709948b
-SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp) = 8cae520fcce66b16075d2ecb20cae338700ec506
+SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.cpp) = f17e4d86dde6d2bc93bbaf5529f079a3386ff7df
SHA1 (patch-source_Plugins_Process_NetBSD_NativeRegisterContextNetBSD__x86__64.h) = e6f51be1b1a0d14242dffc971a71fb7b9e10fda8
SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = 6bcf4b7fafe63e74e5f6127d5dc816e95070e7c6
SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = d2586e2ecdc2c979c59fc1a6a569e7870d3334ba
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 6093f0e082..ca0c2ccf7f 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
@@ -20,7 +20,7 @@ $NetBSD$
+ else if (reg_num <= k_last_avx_x86_64)
+ return -1; // AVX
+ else if (reg_num <= lldb_dr7_x86_64)
-+ return -1; // AVX
++ return DBRegSet; // DBR
else
return -1;
}
@@ -44,7 +44,41 @@ $NetBSD$
default:
break;
}
-@@ -480,4 +498,214 @@ Error NativeRegisterContextNetBSD_x86_64
+@@ -285,6 +303,16 @@ Error NativeRegisterContextNetBSD_x86_64
+ case lldb_es_x86_64:
+ reg_value = (uint64_t)m_gpr_x86_64.regs[_REG_ES];
+ break;
++ case lldb_dr0_x86_64:
++ case lldb_dr1_x86_64:
++ case lldb_dr2_x86_64:
++ case lldb_dr3_x86_64:
++ case lldb_dr4_x86_64:
++ case lldb_dr5_x86_64:
++ case lldb_dr6_x86_64:
++ case lldb_dr7_x86_64:
++ reg_value = (uint64_t)m_dbr_x86_64.regs[reg - lldb_dr0_x86_64];
++ break;
+ }
+
+ return error;
+@@ -400,6 +428,16 @@ Error NativeRegisterContextNetBSD_x86_64
+ case lldb_es_x86_64:
+ m_gpr_x86_64.regs[_REG_ES] = reg_value.GetAsUInt64();
+ break;
++ case lldb_dr0_x86_64:
++ case lldb_dr1_x86_64:
++ case lldb_dr2_x86_64:
++ case lldb_dr3_x86_64:
++ case lldb_dr4_x86_64:
++ case lldb_dr5_x86_64:
++ case lldb_dr6_x86_64:
++ case lldb_dr7_x86_64:
++ m_dbr_x86_64.regs[reg - lldb_dr0_x86_64] = reg_value.GetAsUInt64();
++ break;
+ }
+
+ if (WriteRegisterSet(set) != 0)
+@@ -480,4 +518,227 @@ Error NativeRegisterContextNetBSD_x86_64
return error;
}
@@ -54,7 +88,9 @@ $NetBSD$
+ return Error("Watchpoint index out of range");
+
+ RegisterValue reg_value;
-+ Error error = ReadRegisterRaw(m_reg_info.first_dr + 6, reg_value);
++ const RegisterInfo *const reg_info =
++ register_context_sp->GetRegisterInfoAtIndex(lldb_dr6_x86_64);
++ Error error = ReadRegister(reg_info, reg_value);
+ if (error.Fail()) {
+ is_hit = false;
+ return error;
@@ -90,7 +126,9 @@ $NetBSD$
+ return Error("Watchpoint index out of range");
+
+ RegisterValue reg_value;
-+ Error error = ReadRegisterRaw(m_reg_info.first_dr + 7, reg_value);
++ const RegisterInfo *const reg_info =
++ register_context_sp->GetRegisterInfoAtIndex(lldb_dr7_x86_64);
++ Error error = ReadRegister(reg_info, reg_value);
+ if (error.Fail()) {
+ is_vacant = false;
+ return error;
@@ -130,7 +168,9 @@ $NetBSD$
+ return Error("Watchpoint index not vacant");
+
+ RegisterValue reg_value;
-+ error = ReadRegisterRaw(m_reg_info.first_dr + 7, reg_value);
++ const RegisterInfo *const reg_info_dr7 =
++ register_context_sp->GetRegisterInfoAtIndex(lldb_dr7_x86_64);
++ error = ReadRegister(reg_info, reg_value);
+ if (error.Fail())
+ return error;
+
@@ -153,17 +193,14 @@ $NetBSD$
+
+ 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));
++ const RegisterInfo *const reg_info_drN =
++ register_context_sp->GetRegisterInfoAtIndex(lldb_dr0_x86_64 + wp_index);
++ error = WriteRegister(reg_info_drN, RegisterValue(addr));
+ if (error.Fail())
+ return error;
+
+ error =
-+ WriteRegisterRaw(m_reg_info.first_dr + 7, RegisterValue(control_bits));
++ WriteRegisterRaw(reg_info_dr7, RegisterValue(control_bits));
+ if (error.Fail())
+ return error;
+
@@ -180,24 +217,28 @@ $NetBSD$
+
+ // 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);
++ const RegisterInfo *const reg_info_dr6 =
++ register_context_sp->GetRegisterInfoAtIndex(lldb_dr6_x86_64);
++ Error error = ReadRegister(reg_info_dr6, 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));
++ error = WriteRegister(reg_info_dr6, 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);
++ const RegisterInfo *const reg_info_dr7 =
++ register_context_sp->GetRegisterInfoAtIndex(lldb_dr7_x86_64);
++ error = ReadRegisterRaw(reg_info_dr7, 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))
++ return WriteRegister(reg_info_dr7, RegisterValue(control_bits))
+ .Success();
+}
+
@@ -205,22 +246,26 @@ $NetBSD$
+ RegisterValue reg_value;
+
+ // clear bits {0-4} of the debug status register (DR6)
-+ Error error = ReadRegisterRaw(m_reg_info.first_dr + 6, reg_value);
++ const RegisterInfo *const reg_info_dr6 =
++ register_context_sp->GetRegisterInfoAtIndex(lldb_dr6_x86_64);
++ Error error = ReadRegister(reg_info_dr6, 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));
++ error = WriteRegister(reg_info_dr6, 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);
++ const RegisterInfo *const reg_info_dr7 =
++ register_context_sp->GetRegisterInfoAtIndex(lldb_dr7_x86_64);
++ error = ReadRegister(reg_info_dr7, 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));
++ return WriteRegister(reg_info_dr7, RegisterValue(control_bits));
+}
+
+uint32_t NativeRegisterContextNetBSD_x86_64::SetHardwareWatchpoint(
@@ -248,7 +293,9 @@ $NetBSD$
+ if (wp_index >= NumSupportedHardwareWatchpoints())
+ return LLDB_INVALID_ADDRESS;
+ RegisterValue reg_value;
-+ if (ReadRegisterRaw(m_reg_info.first_dr + wp_index, reg_value).Fail())
++ const RegisterInfo *const reg_info_drN =
++ register_context_sp->GetRegisterInfoAtIndex(lldb_dr0_x86_64 + wp_index);
++ if (ReadRegisterRaw(reg_info_drN, reg_value).Fail())
+ return LLDB_INVALID_ADDRESS;
+ return reg_value.GetAsUInt64();
+}
Home |
Main Index |
Thread Index |
Old Index