27 : m_thread(thread), m_concrete_frame_idx(concrete_frame_idx),
28 m_stop_id(thread.GetProcess()->GetStopID()) {}
34 bool invalidate = force;
38 process_stop_id = process_sp->GetStopID();
43 invalidate = process_stop_id !=
GetStopID();
69 for (uint32_t reg = start_idx; reg < num_registers; ++reg) {
72 if (reg_name.equals_insensitive(reg_info->
name) ||
73 reg_name.equals_insensitive(reg_info->
alt_name))
91 return reg_info->
name;
100 if (
pc != fail_value) {
103 Target *target = target_sp.get();
126 frame_sp->ChangePC(
pc);
138 if (!target_sp.get())
149 Target *target = target_sp.get();
155 return SetPC(callAddr);
195 uint64_t fail_value) {
202 uint64_t fail_value) {
228 uint32_t num_register_sets = context->GetRegisterSetCount();
239 for (uint32_t set_idx = 0; set_idx < num_register_sets; ++set_idx) {
243 for (uint32_t reg_idx = 0; reg_idx < num_registers; ++reg_idx) {
244 const uint32_t reg = reg_set->
registers[reg_idx];
252 if (context->ReadRegister(reg_info, reg_value)) {
254 }
else if (frame_zero_context->ReadRegister(reg_info, reg_value)) {
279 for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx) {
282 if (reg_info->
kinds[kind] == num)
294 bool read,
bool write) {
327 const uint32_t dst_len = reg_info->
byte_size;
329 if (src_len > dst_len) {
331 "%u bytes is too big to store in register %s (%u bytes)", src_len,
332 reg_info->
name, dst_len);
341 const uint32_t bytes_read =
342 process_sp->ReadMemory(src_addr, src.data(), src_len,
error);
345 if (bytes_read != src_len) {
346 if (
error.Success()) {
349 bytes_read, src_len);
360 process_sp->GetByteOrder(),
error);
378 if (reg_info ==
nullptr) {
388 *reg_info, dst.
data(), dst_len, process_sp->GetByteOrder(),
error);
390 if (
error.Success()) {
391 if (bytes_copied == 0) {
394 const uint32_t bytes_written =
395 process_sp->WriteMemory(dst_addr, dst.data(), bytes_copied,
error);
396 if (bytes_written != bytes_copied) {
397 if (
error.Success()) {
400 bytes_written, bytes_copied);
454 uint32_t source_regnum,
456 uint32_t &target_regnum) {
458 for (uint32_t reg = 0; reg < num_registers; ++reg) {
461 if (reg_info->
kinds[source_rk] == source_regnum) {
462 target_regnum = reg_info->
kinds[target_rk];
static llvm::raw_ostream & error(Stream &strm)
A section + offset based address class.
lldb::addr_t GetCallableLoadAddress(Target *target, bool is_indirect=false) const
Get the load address as a callable code load address.
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
static uint32_t StringToGenericRegister(llvm::StringRef s)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A plug-in interface definition class for debugging a process.
lldb::ByteOrder GetByteOrder() const
lldb::WritableDataBufferSP & GetData()
virtual uint32_t NumSupportedHardwareBreakpoints()
bool ConvertBetweenRegisterKinds(lldb::RegisterKind source_rk, uint32_t source_regnum, lldb::RegisterKind target_rk, uint32_t &target_regnum)
virtual void InvalidateAllRegisters()=0
virtual bool HardwareSingleStep(bool enable)
virtual bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp)
virtual uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size)
uint32_t m_concrete_frame_idx
virtual const RegisterSet * GetRegisterSet(size_t reg_set)=0
virtual bool ClearHardwareBreakpoint(uint32_t hw_idx)
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
virtual uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read, bool write)
virtual bool ClearHardwareWatchpoint(uint32_t hw_index)
bool CopyFromRegisterContext(lldb::RegisterContextSP context)
void InvalidateIfNeeded(bool force)
virtual lldb::tid_t GetThreadID() const
virtual bool BehavesLikeZerothFrame() const
Indicates that this frame is currently executing code, that the PC value is not a return-pc but an ac...
virtual Status ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, uint32_t src_len, RegisterValue ®_value)
virtual uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num)
Convert from a given register numbering scheme to the lldb register numbering scheme.
bool GetPCForSymbolication(Address &address)
Get an address suitable for symbolication.
lldb::StackFrameSP CalculateStackFrame() override
uint64_t GetPC(uint64_t fail_value=LLDB_INVALID_ADDRESS)
uint64_t GetThreadPointer(uint64_t fail_value=LLDB_INVALID_ADDRESS)
uint64_t GetReturnAddress(uint64_t fail_value=LLDB_INVALID_ADDRESS)
uint64_t ReadRegisterAsUnsigned(uint32_t reg, uint64_t fail_value)
virtual const RegisterInfo * GetRegisterInfoAtIndex(size_t reg)=0
uint64_t GetSP(uint64_t fail_value=LLDB_INVALID_ADDRESS)
const char * GetRegisterName(uint32_t reg)
virtual bool WriteRegister(const RegisterInfo *reg_info, const RegisterValue ®_value)=0
uint64_t GetFlags(uint64_t fail_value=0)
RegisterContext(Thread &thread, uint32_t concrete_frame_idx)
void SetStopID(uint32_t stop_id)
lldb::TargetSP CalculateTarget() override
const RegisterInfo * GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num)
virtual size_t GetRegisterCount()=0
lldb::ProcessSP CalculateProcess() override
virtual uint32_t NumSupportedHardwareWatchpoints()
virtual size_t GetRegisterSetCount()=0
virtual Status WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, uint32_t dst_len, const RegisterValue ®_value)
virtual bool ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp)
bool WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval)
lldb::ThreadSP CalculateThread() override
uint64_t GetFP(uint64_t fail_value=LLDB_INVALID_ADDRESS)
const RegisterInfo * GetRegisterInfoByName(llvm::StringRef reg_name, uint32_t start_idx=0)
virtual lldb::ByteOrder GetByteOrder()
virtual bool ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value)=0
~RegisterContext() override
uint32_t GetStopID() 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
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
lldb::addr_t GetOpcodeLoadAddress(lldb::addr_t load_addr, AddressClass addr_class=AddressClass::eInvalid) const
Get load_addr as an opcode for this target.
virtual lldb::RegisterContextSP GetRegisterContext()=0
void CalculateExecutionContext(ExecutionContext &exe_ctx) override
Reconstruct the object's execution context into sc.
lldb::ProcessSP CalculateProcess() override
virtual void ClearStackFrames()
lldb::TargetSP CalculateTarget() override
lldb::ProcessSP GetProcess() const
virtual lldb::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx)
#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_TP
#define LLDB_REGNUM_GENERIC_PC
#define LLDB_REGNUM_GENERIC_FP
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::Process > ProcessSP
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
RegisterKind
Register numbering types.
@ 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 * value_regs
List of registers (terminated with LLDB_INVALID_REGNUM).
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.
lldb::user_id_t GetID() const
Get accessor for the user ID.