aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Target/RegisterContext.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-07-26 19:36:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-07-26 19:36:28 +0000
commitcfca06d7963fa0909f90483b42a6d7d194d01e08 (patch)
tree209fb2a2d68f8f277793fc8df46c753d31bc853b /lldb/source/Target/RegisterContext.cpp
parent706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff)
Notes
Diffstat (limited to 'lldb/source/Target/RegisterContext.cpp')
-rw-r--r--lldb/source/Target/RegisterContext.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/lldb/source/Target/RegisterContext.cpp b/lldb/source/Target/RegisterContext.cpp
index f29cf435d028..cdc7653cea6d 100644
--- a/lldb/source/Target/RegisterContext.cpp
+++ b/lldb/source/Target/RegisterContext.cpp
@@ -1,4 +1,4 @@
-//===-- RegisterContext.cpp -------------------------------------*- C++ -*-===//
+//===-- RegisterContext.cpp -----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -274,6 +274,24 @@ uint32_t RegisterContext::SetHardwareBreakpoint(lldb::addr_t addr,
return LLDB_INVALID_INDEX32;
}
+// Used when parsing DWARF and EH frame information and any other object file
+// sections that contain register numbers in them.
+uint32_t
+RegisterContext::ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind,
+ uint32_t num) {
+ const uint32_t num_regs = GetRegisterCount();
+
+ assert(kind < kNumRegisterKinds);
+ for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
+ const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg_idx);
+
+ if (reg_info->kinds[kind] == num)
+ return reg_idx;
+ }
+
+ return LLDB_INVALID_REGNUM;
+}
+
bool RegisterContext::ClearHardwareBreakpoint(uint32_t hw_idx) { return false; }
uint32_t RegisterContext::NumSupportedHardwareWatchpoints() { return 0; }
@@ -397,6 +415,17 @@ Status RegisterContext::WriteRegisterValueToMemory(
return error;
}
+lldb::ByteOrder RegisterContext::GetByteOrder() {
+ // Get the target process whose privileged thread was used for the register
+ // read.
+ lldb::ByteOrder byte_order = lldb::eByteOrderInvalid;
+ lldb_private::Process *process = CalculateProcess().get();
+
+ if (process)
+ byte_order = process->GetByteOrder();
+ return byte_order;
+}
+
bool RegisterContext::ReadAllRegisterValues(
lldb_private::RegisterCheckpoint &reg_checkpoint) {
return ReadAllRegisterValues(reg_checkpoint.GetData());