1 //===-- RegisterContextHistory.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 "RegisterContextHistory.h"
36 using namespace lldb_private;
38 RegisterContextHistory::RegisterContextHistory (Thread &thread, uint32_t concrete_frame_idx, uint32_t address_byte_size, addr_t pc_value) :
39 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[eRegisterKindGCC] = 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[eRegisterKindGDB] = LLDB_INVALID_REGNUM;
59 m_pc_reg_info.kinds[eRegisterKindLLDB] = LLDB_INVALID_REGNUM;
62 RegisterContextHistory::~RegisterContextHistory ()
64 delete m_reg_set0.registers;
65 delete m_pc_reg_info.invalidate_regs;
66 delete m_pc_reg_info.value_regs;
70 RegisterContextHistory::InvalidateAllRegisters () {}
73 RegisterContextHistory::GetRegisterCount ()
78 const lldb_private::RegisterInfo *
79 RegisterContextHistory::GetRegisterInfoAtIndex (size_t reg)
83 return &m_pc_reg_info;
87 RegisterContextHistory::GetRegisterSetCount ()
92 const lldb_private::RegisterSet *
93 RegisterContextHistory::GetRegisterSet (size_t reg_set)
101 RegisterContextHistory::ReadRegister (const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value)
105 uint32_t reg_number = reg_info->kinds[eRegisterKindGeneric];
106 if (reg_number == LLDB_REGNUM_GENERIC_PC)
108 value.SetUInt(m_pc_value, reg_info->byte_size);
115 RegisterContextHistory::WriteRegister (const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value)
121 RegisterContextHistory::ReadAllRegisterValues (lldb::DataBufferSP &data_sp)
127 RegisterContextHistory::WriteAllRegisterValues (const lldb::DataBufferSP &data_sp)
133 RegisterContextHistory::ConvertRegisterKindToRegisterNumber (uint32_t kind, uint32_t num)
135 if (kind == eRegisterKindGeneric && num == LLDB_REGNUM_GENERIC_PC)
137 return LLDB_INVALID_REGNUM;