LLDB mainline
RegisterContextHistory.cpp
Go to the documentation of this file.
1//===-- RegisterContextHistory.cpp ----------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "lldb/Core/Address.h"
11#include "lldb/Core/Module.h"
12#include "lldb/Core/Value.h"
17#include "lldb/Symbol/Symbol.h"
19#include "lldb/Target/ABI.h"
22#include "lldb/Target/Process.h"
24#include "lldb/Target/Target.h"
25#include "lldb/Target/Thread.h"
27#include "lldb/Utility/Log.h"
29#include "lldb/lldb-private.h"
30
32
33using namespace lldb;
34using namespace lldb_private;
35
37 uint32_t concrete_frame_idx,
38 uint32_t address_byte_size,
39 addr_t pc_value)
40 : RegisterContext(thread, concrete_frame_idx), m_pc_value(pc_value) {
41 m_reg_set0.name = "General Purpose Registers";
42 m_reg_set0.short_name = "GPR";
44 m_reg_set0.registers = new uint32_t(0);
45
46 m_pc_reg_info.name = "pc";
49 m_pc_reg_info.byte_size = address_byte_size;
53 m_pc_reg_info.value_regs = nullptr;
59}
60
62 delete m_reg_set0.registers;
65}
66
68
70
73 if (reg)
74 return nullptr;
75 return &m_pc_reg_info;
76}
77
79
82 if (reg_set)
83 return nullptr;
84 return &m_reg_set0;
85}
86
88 const lldb_private::RegisterInfo *reg_info,
90 if (!reg_info)
91 return false;
92 uint32_t reg_number = reg_info->kinds[eRegisterKindGeneric];
93 if (reg_number == LLDB_REGNUM_GENERIC_PC) {
94 value.SetUInt(m_pc_value, reg_info->byte_size);
95 return true;
96 }
97 return false;
98}
99
101 const lldb_private::RegisterInfo *reg_info,
102 const lldb_private::RegisterValue &value) {
103 return false;
104}
105
108 return false;
109}
110
112 const lldb::DataBufferSP &data_sp) {
113 return false;
114}
115
117 lldb::RegisterKind kind, uint32_t num) {
118 if (kind == eRegisterKindGeneric && num == LLDB_REGNUM_GENERIC_PC)
119 return 0;
120 return LLDB_INVALID_REGNUM;
121}
lldb_private::RegisterInfo m_pc_reg_info
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
RegisterContextHistory(Thread &thread, uint32_t concrete_frame_idx, uint32_t address_byte_size, lldb::addr_t pc_value)
bool ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override
bool WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value) override
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override
Convert from a given register numbering scheme to the lldb register numbering scheme.
const lldb_private::RegisterSet * GetRegisterSet(size_t reg_set) override
const lldb_private::RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
bool SetUInt(uint64_t uint, uint32_t byte_size)
#define LLDB_INVALID_REGNUM
Definition: lldb-defines.h:87
#define LLDB_REGNUM_GENERIC_PC
Definition: lldb-defines.h:56
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
@ eEncodingUint
unsigned integer
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:333
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:334
uint64_t addr_t
Definition: lldb-types.h:80
RegisterKind
Register numbering types.
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target
@ eRegisterKindLLDB
lldb's internal register numbers
@ eRegisterKindDWARF
the register numbers seen DWARF
@ eRegisterKindEHFrame
the register numbers seen in eh_frame
@ eRegisterKindProcessPlugin
num used by the process plugin - e.g.
Every register is described in detail including its name, alternate name (optional),...
lldb::Encoding encoding
Encoding of the register bits.
const char * alt_name
Alternate name of this register, can be NULL.
uint32_t * value_regs
List of registers (terminated with LLDB_INVALID_REGNUM).
uint32_t byte_offset
The byte offset in the register context data where this register's value is found.
uint32_t byte_size
Size in bytes of the register.
uint32_t kinds[lldb::kNumRegisterKinds]
Holds all of the various register numbers for all register kinds.
const char * name
Name of this register, can't be NULL.
lldb::Format format
Default display format.
uint32_t * invalidate_regs
List of registers (terminated with LLDB_INVALID_REGNUM).
Registers are grouped into register sets.
size_t num_registers
The number of registers in REGISTERS array below.
const uint32_t * registers
An array of register indices in this set.
const char * name
Name of this register set.
const char * short_name
A short name for this register set.