15#include <unordered_map>
23 NativeProcessProtocol &m_process;
24 NativeRegisterContext &m_reg_context;
27 std::unordered_map<uint32_t, RegisterValue> m_register_values;
29 EmulatorBaton(NativeProcessProtocol &process,
30 NativeRegisterContext ®_context)
31 : m_process(process), m_reg_context(reg_context) {}
39 EmulatorBaton *emulator_baton =
static_cast<EmulatorBaton *
>(baton);
42 emulator_baton->m_process.
ReadMemory(addr, dst, length, bytes_read);
49 EmulatorBaton *emulator_baton =
static_cast<EmulatorBaton *
>(baton);
51 auto it = emulator_baton->m_register_values.find(
53 if (it != emulator_baton->m_register_values.end()) {
54 reg_value = it->second;
66 emulator_baton->m_reg_context.
ReadRegister(full_reg_info, reg_value);
77 EmulatorBaton *emulator_baton =
static_cast<EmulatorBaton *
>(baton);
97 if (
error.GetError() == EIO ||
error.GetError() == EFAULT)
112 std::unique_ptr<EmulateInstruction> emulator_up(
115 if (emulator_up ==
nullptr)
118 EmulatorBaton baton(process, register_context);
119 emulator_up->SetBaton(&baton);
125 auto bp_locaions_predictor =
127 std::move(emulator_up));
129 auto bp_locations = bp_locaions_predictor->GetBreakpointLocations(
error);
133 for (
auto &&bp_addr : bp_locations) {
134 auto bp_size = bp_locaions_predictor->GetBreakpointSize(bp_addr);
135 if (
auto err = bp_size.takeError())
static llvm::raw_ostream & error(Stream &strm)
static bool ReadRegisterCallback(EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue ®_value)
static size_t WriteMemoryCallback(EmulateInstruction *instruction, void *baton, const EmulateInstruction::Context &context, lldb::addr_t addr, const void *dst, size_t length)
static size_t ReadMemoryCallback(EmulateInstruction *instruction, void *baton, const EmulateInstruction::Context &context, lldb::addr_t addr, void *dst, size_t length)
static Status SetSoftwareBreakpoint(lldb::addr_t bp_addr, unsigned bp_size, NativeProcessProtocol &process)
static bool WriteRegisterCallback(EmulateInstruction *instruction, void *baton, const EmulateInstruction::Context &context, const RegisterInfo *reg_info, const RegisterValue ®_value)
An architecture specification class.
"lldb/Core/EmulateInstruction.h" A class that allows emulation of CPU opcodes.
static std::unique_ptr< SingleStepBreakpointLocationsPredictor > CreateBreakpointLocationPredictor(std::unique_ptr< EmulateInstruction > emulator_up)
static EmulateInstruction * FindPlugin(const ArchSpec &arch, InstructionType supported_inst_type, const char *plugin_name)
virtual Status SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware)=0
virtual const ArchSpec & GetArchitecture() const =0
virtual Status ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read)=0
std::map< lldb::tid_t, std::vector< lldb::addr_t > > m_threads_stepping_with_breakpoint
Status SetupSoftwareSingleStepping(NativeThreadProtocol &thread)
const RegisterInfo * GetRegisterInfo(uint32_t reg_kind, uint32_t reg_num)
virtual Status ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value)=0
static Status FromErrorString(const char *str)
A class that represents a running process on the host machine.
@ eInstructionTypePCModifying
const char * toString(AppleArm64ExceptionClass EC)
@ eRegisterKindDWARF
the register numbers seen DWARF
Every register is described in detail including its name, alternate name (optional),...
uint32_t kinds[lldb::kNumRegisterKinds]
Holds all of the various register numbers for all register kinds.