70 for (uint32_t reg = start_idx; reg < num_registers; ++reg) {
73 if (reg_name.equals_insensitive(reg_info->
name) ||
74 reg_name.equals_insensitive(reg_info->
alt_name))
92 return reg_info->
name;
97 uint32_t reg_index)
const {
107 for (uint32_t reg_num_index = 0; reg_num_index < reg_set->
num_registers;
109 const uint32_t reg_num = reg_set->
registers[reg_num_index];
111 if (reg_info->
kinds[RegisterKind::eRegisterKindLLDB] == reg_num) {
114 return reg_set->
name;
128 LLDB_LOGF(log,
"Using reg index %" PRIu32
" (default %" PRIu64
")", reg,
133 LLDB_LOGF(log, PRIu32
" retval %" PRIu64, retval);
140 return GetPC(fail_value);
201 if (
error.Success()) {
203 "Read register succeeded: value "
208 LLDB_LOGF(log,
"Read register failed: error %s",
error.AsCString());
211 LLDB_LOGF(log,
"Read register failed: null reg_info");
219 return Status(
"Write register failed: reg is invalid");
228 return Status(
"reg_info is nullptr");
232 return Status(
"RegisterValue::SetUInt () failed");
249 return Status(
"not implemented");
259 return Status(
"not implemented");
266 uint32_t watch_flags) {
275 return Status(
"not implemented");
279 return Status(
"not implemented");
284 return Status(
"not implemented");
290 return Status(
"not implemented");
296 return Status(
"not implemented");
313 if (reg_info ==
nullptr) {
314 error.SetErrorString(
"invalid register info argument.");
334 const size_t dst_len = reg_info->
byte_size;
336 if (src_len > dst_len) {
337 error.SetErrorStringWithFormat(
338 "%" PRIu64
" bytes is too big to store in register %s (%" PRIu64
340 static_cast<uint64_t
>(src_len), reg_info->
name,
341 static_cast<uint64_t
>(dst_len));
355 if (bytes_read != src_len) {
357 error.SetErrorStringWithFormat(
"read %" PRIu64
" of %" PRIu64
" bytes",
358 static_cast<uint64_t
>(bytes_read),
359 static_cast<uint64_t
>(src_len));
378 if (reg_info ==
nullptr) {
379 error.SetErrorString(
"Invalid register info argument.");
392 if (
error.Success()) {
393 if (bytes_copied == 0) {
394 error.SetErrorString(
"byte copy failed.");
396 size_t bytes_written;
402 if (bytes_written != bytes_copied) {
404 error.SetErrorStringWithFormat(
"only wrote %" PRIu64
" of %" PRIu64
406 static_cast<uint64_t
>(bytes_written),
407 static_cast<uint64_t
>(bytes_copied));
417 uint32_t num)
const {
421 for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
424 if (reg_info->
kinds[kind] == num)
435 static const uint32_t k_expedited_registers[] = {
439 std::vector<uint32_t> expedited_reg_nums;
440 for (uint32_t gen_reg : k_expedited_registers) {
446 expedited_reg_nums.push_back(reg_num);
449 return expedited_reg_nums;
457 return std::vector<uint32_t>();
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
static uint32_t StringToGenericRegister(llvm::StringRef s)
lldb::ByteOrder GetByteOrder() const
virtual Status ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)=0
virtual Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written)=0
virtual const RegisterSet * GetRegisterSet(uint32_t set_index) const =0
virtual bool ClearHardwareBreakpoint(uint32_t hw_idx)
virtual bool ClearHardwareWatchpoint(uint32_t hw_index)
uint32_t ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num) const
Status SetSP(lldb::addr_t sp)
lldb::addr_t GetSP(lldb::addr_t fail_value=LLDB_INVALID_ADDRESS)
virtual Status ClearWatchpointHit(uint32_t hw_index)
lldb::addr_t GetFlags(lldb::addr_t fail_value=0)
virtual Status IsWatchpointHit(uint32_t wp_index, bool &is_hit)
lldb::addr_t GetFP(lldb::addr_t fail_value=LLDB_INVALID_ADDRESS)
lldb::addr_t ReadRegisterAsUnsigned(uint32_t reg, lldb::addr_t fail_value)
const RegisterInfo * GetRegisterInfo(uint32_t reg_kind, uint32_t reg_num)
virtual Status GetWatchpointHitIndex(uint32_t &wp_index, lldb::addr_t trap_addr)
const char * GetRegisterName(uint32_t reg)
Status WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval)
virtual const RegisterInfo * GetRegisterInfoAtIndex(uint32_t reg) const =0
const char * GetRegisterSetNameForRegisterAtIndex(uint32_t reg_index) const
const RegisterInfo * GetRegisterInfoByName(llvm::StringRef reg_name, uint32_t start_idx=0)
virtual uint32_t GetRegisterCount() const =0
virtual uint32_t NumSupportedHardwareWatchpoints()
virtual Status ClearAllHardwareBreakpoints()
virtual bool HardwareSingleStep(bool enable)
virtual Status ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, size_t src_len, RegisterValue ®_value)
virtual Status ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value)=0
virtual lldb::addr_t GetWatchpointAddress(uint32_t wp_index)
lldb::addr_t GetPC(lldb::addr_t fail_value=LLDB_INVALID_ADDRESS)
virtual lldb::addr_t GetWatchpointHitAddress(uint32_t wp_index)
NativeRegisterContext(NativeThreadProtocol &thread)
virtual Status ClearAllHardwareWatchpoints()
virtual std::vector< uint32_t > GetExpeditedRegisters(ExpeditedRegs expType) const
Status SetPC(lldb::addr_t pc)
virtual Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant)
virtual ~NativeRegisterContext()
virtual lldb::addr_t GetPCfromBreakpointLocation(lldb::addr_t fail_value=LLDB_INVALID_ADDRESS)
virtual uint32_t NumSupportedHardwareBreakpoints()
NativeThreadProtocol & m_thread
virtual uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags)
Status SetFP(lldb::addr_t fp)
virtual Status WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, size_t dst_len, const RegisterValue ®_value)
lldb::addr_t GetReturnAddress(lldb::addr_t fail_value=LLDB_INVALID_ADDRESS)
virtual uint32_t GetRegisterSetCount() const =0
virtual Status GetHardwareBreakHitIndex(uint32_t &bp_index, lldb::addr_t trap_addr)
virtual lldb::tid_t GetThreadID() const
virtual uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size)
virtual Status WriteRegister(const RegisterInfo *reg_info, const RegisterValue ®_value)=0
NativeProcessProtocol & GetProcess()
lldb::tid_t GetID() const
uint32_t SetFromMemoryData(const RegisterInfo ®_info, const void *src, uint32_t src_len, lldb::ByteOrder src_byte_order, Status &error)
bool SetUInt(uint64_t uint, uint32_t byte_size)
uint32_t GetAsMemoryData(const RegisterInfo ®_info, void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
uint64_t GetAsUInt64(uint64_t fail_value=UINT64_MAX, bool *success_ptr=nullptr) const
llvm::SmallVector< uint8_t, kTypicalRegisterByteSize > BytesContainer
#define LLDB_REGNUM_GENERIC_RA
#define LLDB_INVALID_INDEX32
#define LLDB_REGNUM_GENERIC_SP
#define LLDB_REGNUM_GENERIC_FLAGS
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_REGNUM
#define LLDB_REGNUM_GENERIC_PC
#define LLDB_REGNUM_GENERIC_FP
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target
Every register is described in detail including its name, alternate name (optional),...
const char * alt_name
Alternate name of this register, can be NULL.
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.
llvm::ArrayRef< uint8_t > data(const uint8_t *context_base) const
const char * name
Name of this register, can't be NULL.
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.