1 //===-- RegisterContextDummy.cpp ---------------------------------*- C++
4 // The LLVM Compiler Infrastructure
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #include "lldb/Core/Address.h"
12 #include "lldb/Core/AddressRange.h"
13 #include "lldb/Core/Module.h"
14 #include "lldb/Core/RegisterValue.h"
15 #include "lldb/Core/Value.h"
16 #include "lldb/Expression/DWARFExpression.h"
17 #include "lldb/Symbol/FuncUnwinders.h"
18 #include "lldb/Symbol/Function.h"
19 #include "lldb/Symbol/ObjectFile.h"
20 #include "lldb/Symbol/Symbol.h"
21 #include "lldb/Symbol/SymbolContext.h"
22 #include "lldb/Target/ABI.h"
23 #include "lldb/Target/DynamicLoader.h"
24 #include "lldb/Target/ExecutionContext.h"
25 #include "lldb/Target/Process.h"
26 #include "lldb/Target/StackFrame.h"
27 #include "lldb/Target/Target.h"
28 #include "lldb/Target/Thread.h"
29 #include "lldb/Utility/DataBufferHeap.h"
30 #include "lldb/Utility/Log.h"
31 #include "lldb/lldb-private.h"
33 #include "RegisterContextDummy.h"
36 using namespace lldb_private;
38 RegisterContextDummy::RegisterContextDummy(Thread &thread,
39 uint32_t concrete_frame_idx,
40 uint32_t address_byte_size)
41 : RegisterContext(thread, concrete_frame_idx) {
42 m_reg_set0.name = "General Purpose Registers";
43 m_reg_set0.short_name = "GPR";
44 m_reg_set0.num_registers = 1;
45 m_reg_set0.registers = new uint32_t(0);
47 m_pc_reg_info.name = "pc";
48 m_pc_reg_info.alt_name = "pc";
49 m_pc_reg_info.byte_offset = 0;
50 m_pc_reg_info.byte_size = address_byte_size;
51 m_pc_reg_info.encoding = eEncodingUint;
52 m_pc_reg_info.format = eFormatPointer;
53 m_pc_reg_info.invalidate_regs = NULL;
54 m_pc_reg_info.value_regs = NULL;
55 m_pc_reg_info.kinds[eRegisterKindEHFrame] = LLDB_INVALID_REGNUM;
56 m_pc_reg_info.kinds[eRegisterKindDWARF] = LLDB_INVALID_REGNUM;
57 m_pc_reg_info.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_PC;
58 m_pc_reg_info.kinds[eRegisterKindProcessPlugin] = LLDB_INVALID_REGNUM;
59 m_pc_reg_info.kinds[eRegisterKindLLDB] = LLDB_INVALID_REGNUM;
62 RegisterContextDummy::~RegisterContextDummy() {
63 delete m_reg_set0.registers;
64 delete m_pc_reg_info.invalidate_regs;
65 delete m_pc_reg_info.value_regs;
68 void RegisterContextDummy::InvalidateAllRegisters() {}
70 size_t RegisterContextDummy::GetRegisterCount() { return 1; }
72 const lldb_private::RegisterInfo *
73 RegisterContextDummy::GetRegisterInfoAtIndex(size_t reg) {
76 return &m_pc_reg_info;
79 size_t RegisterContextDummy::GetRegisterSetCount() { return 1; }
81 const lldb_private::RegisterSet *
82 RegisterContextDummy::GetRegisterSet(size_t reg_set) {
88 bool RegisterContextDummy::ReadRegister(
89 const lldb_private::RegisterInfo *reg_info,
90 lldb_private::RegisterValue &value) {
93 uint32_t reg_number = reg_info->kinds[eRegisterKindGeneric];
94 if (reg_number == LLDB_REGNUM_GENERIC_PC) {
95 value.SetUInt(LLDB_INVALID_ADDRESS, reg_info->byte_size);
101 bool RegisterContextDummy::WriteRegister(
102 const lldb_private::RegisterInfo *reg_info,
103 const lldb_private::RegisterValue &value) {
107 bool RegisterContextDummy::ReadAllRegisterValues(lldb::DataBufferSP &data_sp) {
111 bool RegisterContextDummy::WriteAllRegisterValues(
112 const lldb::DataBufferSP &data_sp) {
116 uint32_t RegisterContextDummy::ConvertRegisterKindToRegisterNumber(
117 lldb::RegisterKind kind, uint32_t num) {
118 if (kind == eRegisterKindGeneric && num == LLDB_REGNUM_GENERIC_PC)
120 return LLDB_INVALID_REGNUM;