Go to the documentation of this file.
63 const RegisterInfo *reg_info =
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;
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];
114 return reg_set->name;
129 "NativeRegisterContext::%s using reg index %" PRIu32
130 " (default %" PRIu64
")",
131 __FUNCTION__, reg, fail_value);
135 LLDB_LOGF(log,
"NativeRegisterContext::%s " PRIu32
" retval %" PRIu64,
136 __FUNCTION__, retval);
143 return GetPC(fail_value);
204 if (
error.Success()) {
206 "NativeRegisterContext::%s ReadRegister() succeeded, value "
212 "NativeRegisterContext::%s ReadRegister() failed, error %s",
213 __FUNCTION__,
error.AsCString());
216 LLDB_LOGF(log,
"NativeRegisterContext::%s ReadRegister() null reg_info",
225 return Status(
"NativeRegisterContext::%s (): reg is invalid", __FUNCTION__);
234 return Status(
"reg_info is nullptr");
237 if (!value.
SetUInt(uval, reg_info->byte_size))
238 return Status(
"RegisterValue::SetUInt () failed");
255 return Status(
"not implemented");
265 return Status(
"not implemented");
281 return Status(
"not implemented");
285 return Status(
"not implemented");
290 return Status(
"not implemented");
296 return Status(
"not implemented");
302 return Status(
"not implemented");
316 const RegisterInfo *reg_info,
lldb::addr_t src_addr,
size_t src_len,
319 if (reg_info ==
nullptr) {
320 error.SetErrorString(
"invalid register info argument.");
341 error.SetErrorString(
"register too small to receive memory data");
345 const size_t dst_len = reg_info->byte_size;
347 if (src_len > dst_len) {
348 error.SetErrorStringWithFormat(
349 "%" PRIu64
" bytes is too big to store in register %s (%" PRIu64
351 static_cast<uint64_t
>(src_len), reg_info->name,
352 static_cast<uint64_t
>(dst_len));
366 if (bytes_read != src_len) {
368 error.SetErrorStringWithFormat(
"read %" PRIu64
" of %" PRIu64
" bytes",
369 static_cast<uint64_t
>(bytes_read),
370 static_cast<uint64_t
>(src_len));
386 const RegisterInfo *reg_info,
lldb::addr_t dst_addr,
size_t dst_len,
401 if (
error.Success()) {
402 if (bytes_copied == 0) {
403 error.SetErrorString(
"byte copy failed.");
405 size_t bytes_written;
410 if (bytes_written != bytes_copied) {
412 error.SetErrorStringWithFormat(
"only wrote %" PRIu64
" of %" PRIu64
414 static_cast<uint64_t
>(bytes_written),
415 static_cast<uint64_t
>(bytes_copied));
429 for (
uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
432 if (reg_info->kinds[kind] == num)
439 std::vector<uint32_t>
443 static const uint32_t k_expedited_registers[] = {
447 std::vector<uint32_t> expedited_reg_nums;
448 for (
uint32_t gen_reg : k_expedited_registers) {
454 expedited_reg_nums.push_back(reg_num);
457 return expedited_reg_nums;
465 return std::vector<uint32_t>();
virtual uint32_t GetRegisterCount() const =0
virtual bool ClearHardwareWatchpoint(uint32_t hw_index)
virtual bool HardwareSingleStep(bool enable)
virtual Status GetWatchpointHitIndex(uint32_t &wp_index, lldb::addr_t trap_addr)
#define LLDB_INVALID_REGNUM
virtual Status ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value)=0
Status WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval)
virtual Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant)
virtual uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size)
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target
const RegisterInfo * GetRegisterInfoByName(llvm::StringRef reg_name, uint32_t start_idx=0)
#define LLDB_LOGF(log,...)
NativeProcessProtocol & GetProcess()
static uint32_t StringToGenericRegister(llvm::StringRef s)
virtual Status ClearAllHardwareBreakpoints()
virtual Status ClearWatchpointHit(uint32_t hw_index)
Status SetPC(lldb::addr_t pc)
const char * GetRegisterName(uint32_t reg)
uint64_t GetAsUInt64(uint64_t fail_value=UINT64_MAX, bool *success_ptr=nullptr) const
lldb::addr_t ReadRegisterAsUnsigned(uint32_t reg, lldb::addr_t fail_value)
const RegisterInfo * GetRegisterInfo(uint32_t reg_kind, uint32_t reg_num)
#define LLDB_REGNUM_GENERIC_FLAGS
static llvm::raw_ostream & error(Stream &strm)
uint32_t ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num) const
@ eRegisterKindLLDB
lldb's internal register numbers
virtual lldb::addr_t GetWatchpointHitAddress(uint32_t wp_index)
virtual Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written)=0
lldb::addr_t GetSP(lldb::addr_t fail_value=LLDB_INVALID_ADDRESS)
virtual const RegisterInfo * GetRegisterInfoAtIndex(uint32_t reg) const =0
Status SetFP(lldb::addr_t fp)
const char * GetRegisterSetNameForRegisterAtIndex(uint32_t reg_index) const
virtual Status ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, size_t src_len, RegisterValue ®_value)
virtual std::vector< uint32_t > GetExpeditedRegisters(ExpeditedRegs expType) const
Status SetSP(lldb::addr_t sp)
virtual uint32_t NumSupportedHardwareBreakpoints()
virtual const RegisterSet * GetRegisterSet(uint32_t set_index) const =0
virtual ~NativeRegisterContext()
uint32_t SetFromMemoryData(const RegisterInfo *reg_info, const void *src, uint32_t src_len, lldb::ByteOrder src_byte_order, Status &error)
virtual bool ClearHardwareBreakpoint(uint32_t hw_idx)
virtual Status WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, size_t dst_len, const RegisterValue ®_value)
bool SetUInt(uint64_t uint, uint32_t byte_size)
lldb::addr_t GetFP(lldb::addr_t fail_value=LLDB_INVALID_ADDRESS)
virtual uint32_t GetRegisterSetCount() const =0
#define LLDB_REGNUM_GENERIC_SP
uint32_t GetAsMemoryData(const RegisterInfo *reg_info, void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
lldb::tid_t GetID() const
virtual Status GetHardwareBreakHitIndex(uint32_t &bp_index, lldb::addr_t trap_addr)
#define LLDB_INVALID_ADDRESS
lldb::addr_t GetPC(lldb::addr_t fail_value=LLDB_INVALID_ADDRESS)
virtual Status ClearAllHardwareWatchpoints()
virtual uint32_t NumSupportedHardwareWatchpoints()
lldb::ByteOrder GetByteOrder() const
NativeThreadProtocol & m_thread
virtual lldb::addr_t GetPCfromBreakpointLocation(lldb::addr_t fail_value=LLDB_INVALID_ADDRESS)
A class that represents a running process on the host machine.
#define LLDB_REGNUM_GENERIC_FP
#define LLDB_REGNUM_GENERIC_PC
#define LLDB_INVALID_INDEX32
virtual Status WriteRegister(const RegisterInfo *reg_info, const RegisterValue ®_value)=0
virtual lldb::tid_t GetThreadID() const
lldb::addr_t GetFlags(lldb::addr_t fail_value=0)
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
virtual uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags)
virtual Status IsWatchpointHit(uint32_t wp_index, bool &is_hit)
virtual Status ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)=0
virtual lldb::addr_t GetWatchpointAddress(uint32_t wp_index)
lldb::addr_t GetReturnAddress(lldb::addr_t fail_value=LLDB_INVALID_ADDRESS)
#define LLDB_REGNUM_GENERIC_RA