LLDB mainline
RegisterContextDummy.cpp
Go to the documentation of this file.
1//===-- RegisterContextDummy.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 : RegisterContext(thread, concrete_frame_idx) {
40 m_reg_set0.name = "General Purpose Registers";
41 m_reg_set0.short_name = "GPR";
43 m_reg_set0.registers = new uint32_t(0);
44
45 m_pc_reg_info.name = "pc";
48 m_pc_reg_info.byte_size = address_byte_size;
52 m_pc_reg_info.value_regs = nullptr;
58}
59
61 delete m_reg_set0.registers;
64}
65
67
69
72 if (reg)
73 return nullptr;
74 return &m_pc_reg_info;
75}
76
78
81 if (reg_set)
82 return nullptr;
83 return &m_reg_set0;
84}
85
87 const lldb_private::RegisterInfo *reg_info,
89 if (!reg_info)
90 return false;
91 uint32_t reg_number = reg_info->kinds[eRegisterKindGeneric];
92 if (reg_number == LLDB_REGNUM_GENERIC_PC) {
93 value.SetUInt(LLDB_INVALID_ADDRESS, reg_info->byte_size);
94 return true;
95 }
96 return false;
97}
98
100 const lldb_private::RegisterInfo *reg_info,
101 const lldb_private::RegisterValue &value) {
102 return false;
103}
104
107 return false;
108}
109
111 const lldb::DataBufferSP &data_sp) {
112 return false;
113}
114
116 lldb::RegisterKind kind, uint32_t num) {
117 if (kind == eRegisterKindGeneric && num == LLDB_REGNUM_GENERIC_PC)
118 return 0;
119 return LLDB_INVALID_REGNUM;
120}
bool ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override
uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override
Convert from a given register numbering scheme to the lldb register numbering scheme.
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
bool WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value) override
const lldb_private::RegisterSet * GetRegisterSet(size_t reg_set) override
lldb_private::RegisterSet m_reg_set0
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value) override
lldb_private::RegisterInfo m_pc_reg_info
RegisterContextDummy(Thread &thread, uint32_t concrete_frame_idx, uint32_t address_byte_size)
const lldb_private::RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
bool SetUInt(uint64_t uint, uint32_t byte_size)
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:82
#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
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.