1 //===-- RegisterContextDummy.cpp ---------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 #include "lldb/lldb-private.h"
12 #include "lldb/Core/Address.h"
13 #include "lldb/Core/AddressRange.h"
14 #include "lldb/Core/DataBufferHeap.h"
15 #include "lldb/Core/Log.h"
16 #include "lldb/Core/Module.h"
17 #include "lldb/Core/RegisterValue.h"
18 #include "lldb/Core/Value.h"
19 #include "lldb/Expression/DWARFExpression.h"
20 #include "lldb/Symbol/FuncUnwinders.h"
21 #include "lldb/Symbol/Function.h"
22 #include "lldb/Symbol/ObjectFile.h"
23 #include "lldb/Symbol/SymbolContext.h"
24 #include "lldb/Symbol/Symbol.h"
25 #include "lldb/Target/ABI.h"
26 #include "lldb/Target/ExecutionContext.h"
27 #include "lldb/Target/Process.h"
28 #include "lldb/Target/StackFrame.h"
29 #include "lldb/Target/Target.h"
30 #include "lldb/Target/Thread.h"
31 #include "lldb/Target/DynamicLoader.h"
33 #include "RegisterContextDummy.h"
36 using namespace lldb_private;
38 RegisterContextDummy::RegisterContextDummy (Thread &thread, uint32_t concrete_frame_idx, uint32_t address_byte_size) :
39 RegisterContext (thread, concrete_frame_idx)
41 m_reg_set0.name = "General Purpose Registers";
42 m_reg_set0.short_name = "GPR";
43 m_reg_set0.num_registers = 1;
44 m_reg_set0.registers = new uint32_t(0);
46 m_pc_reg_info.name = "pc";
47 m_pc_reg_info.alt_name = "pc";
48 m_pc_reg_info.byte_offset = 0;
49 m_pc_reg_info.byte_size = address_byte_size;
50 m_pc_reg_info.encoding = eEncodingUint;
51 m_pc_reg_info.format = eFormatPointer;
52 m_pc_reg_info.invalidate_regs = NULL;
53 m_pc_reg_info.value_regs = NULL;
54 m_pc_reg_info.kinds[eRegisterKindGCC] = LLDB_INVALID_REGNUM;
55 m_pc_reg_info.kinds[eRegisterKindDWARF] = LLDB_INVALID_REGNUM;
56 m_pc_reg_info.kinds[eRegisterKindGeneric] = LLDB_REGNUM_GENERIC_PC;
57 m_pc_reg_info.kinds[eRegisterKindGDB] = LLDB_INVALID_REGNUM;
58 m_pc_reg_info.kinds[eRegisterKindLLDB] = LLDB_INVALID_REGNUM;
61 RegisterContextDummy::~RegisterContextDummy ()
63 delete m_reg_set0.registers;
64 delete m_pc_reg_info.invalidate_regs;
65 delete m_pc_reg_info.value_regs;
69 RegisterContextDummy::InvalidateAllRegisters () {}
72 RegisterContextDummy::GetRegisterCount ()
77 const lldb_private::RegisterInfo *
78 RegisterContextDummy::GetRegisterInfoAtIndex (size_t reg)
82 return &m_pc_reg_info;
86 RegisterContextDummy::GetRegisterSetCount ()
91 const lldb_private::RegisterSet *
92 RegisterContextDummy::GetRegisterSet (size_t reg_set)
100 RegisterContextDummy::ReadRegister (const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value)
104 uint32_t reg_number = reg_info->kinds[eRegisterKindGeneric];
105 if (reg_number == LLDB_REGNUM_GENERIC_PC)
107 value.SetUInt(LLDB_INVALID_ADDRESS, reg_info->byte_size);
114 RegisterContextDummy::WriteRegister (const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value)
120 RegisterContextDummy::ReadAllRegisterValues (lldb::DataBufferSP &data_sp)
126 RegisterContextDummy::WriteAllRegisterValues (const lldb::DataBufferSP &data_sp)
132 RegisterContextDummy::ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num)
134 if (kind == eRegisterKindGeneric && num == LLDB_REGNUM_GENERIC_PC)
136 return LLDB_INVALID_REGNUM;