LLDB mainline
EmulateInstruction.cpp
Go to the documentation of this file.
1//===-- EmulateInstruction.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
10
11#include "lldb/Core/Address.h"
16#include "lldb/Target/Process.h"
22#include "lldb/Utility/Status.h"
23#include "lldb/Utility/Stream.h"
25#include "lldb/lldb-forward.h"
27
28#include "llvm/ADT/StringRef.h"
29#include "llvm/Support/ErrorExtras.h"
30
31#include <cstring>
32#include <memory>
33#include <optional>
34
35#include <cinttypes>
36#include <cstdio>
37
38namespace lldb_private {
39class Target;
40}
41
42using namespace lldb;
43using namespace lldb_private;
44
47 InstructionType supported_inst_type,
48 const char *plugin_name) {
49 EmulateInstructionCreateInstance create_callback = nullptr;
50 if (plugin_name) {
51 create_callback =
53 plugin_name);
54 if (create_callback) {
55 EmulateInstruction *emulate_insn_ptr =
56 create_callback(arch, supported_inst_type);
57 if (emulate_insn_ptr)
58 return emulate_insn_ptr;
59 }
60 } else {
61 for (auto create_callback :
63 EmulateInstruction *emulate_insn_ptr =
64 create_callback(arch, supported_inst_type);
65 if (emulate_insn_ptr)
66 return emulate_insn_ptr;
67 }
68 }
69 return nullptr;
70}
71
73
74std::optional<RegisterValue>
76 if (m_read_reg_callback == nullptr)
77 return {};
78
79 RegisterValue reg_value;
80 bool success = m_read_reg_callback(this, m_baton, &reg_info, reg_value);
81 if (success)
82 return reg_value;
83 return {};
84}
85
87 uint32_t reg_num,
88 RegisterValue &reg_value) {
89 std::optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
90 if (!reg_info)
91 return false;
92
93 std::optional<RegisterValue> value = ReadRegister(*reg_info);
94 if (value)
95 reg_value = *value;
96 return value.has_value();
97}
98
100 uint32_t reg_num,
101 uint64_t fail_value,
102 bool *success_ptr) {
103 RegisterValue reg_value;
104 if (ReadRegister(reg_kind, reg_num, reg_value))
105 return reg_value.GetAsUInt64(fail_value, success_ptr);
106 if (success_ptr)
107 *success_ptr = false;
108 return fail_value;
109}
110
112 uint64_t fail_value,
113 bool *success_ptr) {
114 std::optional<RegisterValue> reg_value = ReadRegister(reg_info);
115 if (!reg_value) {
116 if (success_ptr)
117 *success_ptr = false;
118 return fail_value;
119 }
120
121 return reg_value->GetAsUInt64(fail_value, success_ptr);
122}
123
125 const RegisterInfo &reg_info,
126 const RegisterValue &reg_value) {
127 if (m_write_reg_callback != nullptr)
128 return m_write_reg_callback(this, m_baton, context, &reg_info, reg_value);
129 return false;
130}
131
133 lldb::RegisterKind reg_kind,
134 uint32_t reg_num,
135 const RegisterValue &reg_value) {
136 std::optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
137 if (reg_info)
138 return WriteRegister(context, *reg_info, reg_value);
139 return false;
140}
141
143 lldb::RegisterKind reg_kind,
144 uint32_t reg_num,
145 uint64_t uint_value) {
146 std::optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
147 if (reg_info) {
148 RegisterValue reg_value;
149 if (reg_value.SetUInt(uint_value, reg_info->byte_size))
150 return WriteRegister(context, *reg_info, reg_value);
151 }
152 return false;
153}
154
156 const RegisterInfo &reg_info,
157 uint64_t uint_value) {
158 RegisterValue reg_value;
159 if (reg_value.SetUInt(uint_value, reg_info.byte_size))
160 return WriteRegister(context, reg_info, reg_value);
161 return false;
162}
163
165 void *dst, size_t dst_len) {
166 if (m_read_mem_callback != nullptr)
167 return m_read_mem_callback(this, m_baton, context, addr, dst, dst_len) ==
168 dst_len;
169 return false;
170}
171
173 lldb::addr_t addr,
174 size_t byte_size,
175 uint64_t fail_value,
176 bool *success_ptr) {
177 uint64_t uval64 = 0;
178 bool success = false;
179 if (byte_size <= 8) {
180 uint8_t buf[sizeof(uint64_t)];
181 size_t bytes_read =
182 m_read_mem_callback(this, m_baton, context, addr, buf, byte_size);
183 if (bytes_read == byte_size) {
184 lldb::offset_t offset = 0;
185 DataExtractor data(buf, byte_size, GetByteOrder(), GetAddressByteSize());
186 uval64 = data.GetMaxU64(&offset, byte_size);
187 success = true;
188 }
189 }
190
191 if (success_ptr)
192 *success_ptr = success;
193
194 if (!success)
195 uval64 = fail_value;
196 return uval64;
197}
198
200 lldb::addr_t addr, uint64_t uval,
201 size_t uval_byte_size) {
203 strm.PutMaxHex64(uval, uval_byte_size);
204
205 size_t bytes_written = m_write_mem_callback(
206 this, m_baton, context, addr, strm.GetString().data(), uval_byte_size);
207 return (bytes_written == uval_byte_size);
208}
209
211 const void *src, size_t src_len) {
212 if (m_write_mem_callback != nullptr)
213 return m_write_mem_callback(this, m_baton, context, addr, src, src_len) ==
214 src_len;
215 return false;
216}
217
218void EmulateInstruction::SetBaton(void *baton) { m_baton = baton; }
219
221 ReadMemoryCallback read_mem_callback,
222 WriteMemoryCallback write_mem_callback,
223 ReadRegisterCallback read_reg_callback,
224 WriteRegisterCallback write_reg_callback) {
225 m_read_mem_callback = read_mem_callback;
226 m_write_mem_callback = write_mem_callback;
227 m_read_reg_callback = read_reg_callback;
228 m_write_reg_callback = write_reg_callback;
229}
230
232 ReadMemoryCallback read_mem_callback) {
233 m_read_mem_callback = read_mem_callback;
234}
235
237 WriteMemoryCallback write_mem_callback) {
238 m_write_mem_callback = write_mem_callback;
239}
240
242 ReadRegisterCallback read_reg_callback) {
243 m_read_reg_callback = read_reg_callback;
244}
245
247 WriteRegisterCallback write_reg_callback) {
248 m_write_reg_callback = write_reg_callback;
249}
250
251//
252// Read & Write Memory and Registers callback functions.
253//
254
256 void *baton, const Context &context,
257 lldb::addr_t addr, void *dst,
258 size_t dst_len) {
259 if (baton == nullptr || dst == nullptr || dst_len == 0)
260 return 0;
261
262 StackFrame *frame = (StackFrame *)baton;
263
264 ProcessSP process_sp(frame->CalculateProcess());
265 if (process_sp) {
267 return process_sp->ReadMemory(addr, dst, dst_len, error);
268 }
269 return 0;
270}
271
273 void *baton, const Context &context,
274 lldb::addr_t addr, const void *src,
275 size_t src_len) {
276 if (baton == nullptr || src == nullptr || src_len == 0)
277 return 0;
278
279 StackFrame *frame = (StackFrame *)baton;
280
281 ProcessSP process_sp(frame->CalculateProcess());
282 if (process_sp) {
284 return process_sp->WriteMemory(addr, src, src_len, error);
285 }
286
287 return 0;
288}
289
291 void *baton,
292 const RegisterInfo *reg_info,
293 RegisterValue &reg_value) {
294 if (baton == nullptr)
295 return false;
296
297 StackFrame *frame = (StackFrame *)baton;
298 return frame->GetRegisterContext()->ReadRegister(reg_info, reg_value);
299}
300
302 void *baton, const Context &context,
303 const RegisterInfo *reg_info,
304 const RegisterValue &reg_value) {
305 if (baton == nullptr)
306 return false;
307
308 StackFrame *frame = (StackFrame *)baton;
309 return frame->GetRegisterContext()->WriteRegister(reg_info, reg_value);
310}
311
313 void *baton,
314 const Context &context,
315 lldb::addr_t addr, void *dst,
316 size_t length) {
317 StreamFile strm(stdout, false);
318 strm.Printf(" Read from Memory (address = 0x%" PRIx64 ", length = %" PRIu64
319 ", context = ",
320 addr, (uint64_t)length);
321 context.Dump(strm, instruction);
322 strm.EOL();
323 *((uint64_t *)dst) = 0xdeadbeef;
324 return length;
325}
326
328 void *baton,
329 const Context &context,
330 lldb::addr_t addr,
331 const void *dst, size_t length) {
332 StreamFile strm(stdout, false);
333 strm.Printf(" Write to Memory (address = 0x%" PRIx64 ", length = %" PRIu64
334 ", context = ",
335 addr, (uint64_t)length);
336 context.Dump(strm, instruction);
337 strm.EOL();
338 return length;
339}
340
342 void *baton,
343 const RegisterInfo *reg_info,
344 RegisterValue &reg_value) {
345 StreamFile strm(stdout, false);
346 strm.Printf(" Read Register (%s)\n", reg_info->name);
347 lldb::RegisterKind reg_kind;
348 uint32_t reg_num;
349 if (GetBestRegisterKindAndNumber(reg_info, reg_kind, reg_num))
350 reg_value.SetUInt64((uint64_t)reg_kind << 24 | reg_num);
351 else
352 reg_value.SetUInt64(0);
353
354 return true;
355}
356
358 void *baton,
359 const Context &context,
360 const RegisterInfo *reg_info,
361 const RegisterValue &reg_value) {
362 StreamFile strm(stdout, false);
363 strm.Printf(" Write to Register (name = %s, value = ", reg_info->name);
364 DumpRegisterValue(reg_value, strm, *reg_info, false, false, eFormatDefault);
365 strm.PutCString(", context = ");
366 context.Dump(strm, instruction);
367 strm.EOL();
368 return true;
369}
370
372 EmulateInstruction *instruction) const {
373 switch (type) {
375 strm.PutCString("reading opcode");
376 break;
377
379 strm.PutCString("immediate");
380 break;
381
383 strm.PutCString("push register");
384 break;
385
387 strm.PutCString("pop register");
388 break;
389
391 strm.PutCString("adjust sp");
392 break;
393
395 strm.PutCString("set frame pointer");
396 break;
397
399 strm.PutCString("adjusting (writing value back to) a base register");
400 break;
401
403 strm.PutCString("register + offset");
404 break;
405
407 strm.PutCString("store register");
408 break;
409
411 strm.PutCString("load register");
412 break;
413
415 strm.PutCString("relative branch immediate");
416 break;
417
419 strm.PutCString("absolute branch register");
420 break;
421
423 strm.PutCString("supervisor call");
424 break;
425
427 strm.PutCString("table branch read memory");
428 break;
429
431 strm.PutCString("write random bits to a register");
432 break;
433
435 strm.PutCString("write random bits to a memory address");
436 break;
437
439 strm.PutCString("arithmetic");
440 break;
441
443 strm.PutCString("return from exception");
444 break;
445
446 default:
447 strm.PutCString("unrecognized context.");
448 break;
449 }
450
451 switch (GetInfoType()) {
453 strm.Printf(" (reg_plus_offset = %s%+" PRId64 ")",
454 info.RegisterPlusOffset.reg.name,
455 info.RegisterPlusOffset.signed_offset);
456 break;
457
459 strm.Printf(" (reg_plus_reg = %s + %s)",
460 info.RegisterPlusIndirectOffset.base_reg.name,
461 info.RegisterPlusIndirectOffset.offset_reg.name);
462 break;
463
465 strm.Printf(" (base_and_imm_offset = %s%+" PRId64 ", data_reg = %s)",
466 info.RegisterToRegisterPlusOffset.base_reg.name,
467 info.RegisterToRegisterPlusOffset.offset,
468 info.RegisterToRegisterPlusOffset.data_reg.name);
469 break;
470
472 strm.Printf(" (base_and_reg_offset = %s + %s, data_reg = %s)",
473 info.RegisterToRegisterPlusIndirectOffset.base_reg.name,
474 info.RegisterToRegisterPlusIndirectOffset.offset_reg.name,
475 info.RegisterToRegisterPlusIndirectOffset.data_reg.name);
476 break;
477
479 strm.Printf(" (register to register binary op: %s and %s)",
480 info.RegisterRegisterOperands.operand1.name,
481 info.RegisterRegisterOperands.operand2.name);
482 break;
483
484 case eInfoTypeOffset:
485 strm.Printf(" (signed_offset = %+" PRId64 ")", info.signed_offset);
486 break;
487
489 strm.Printf(" (reg = %s)", info.reg.name);
490 break;
491
493 strm.Printf(" (unsigned_immediate = %" PRIu64 " (0x%16.16" PRIx64 "))",
494 info.unsigned_immediate, info.unsigned_immediate);
495 break;
496
498 strm.Printf(" (signed_immediate = %+" PRId64 " (0x%16.16" PRIx64 "))",
499 info.signed_immediate, info.signed_immediate);
500 break;
501
502 case eInfoTypeAddress:
503 strm.Printf(" (address = 0x%" PRIx64 ")", info.address);
504 break;
505
507 strm.Printf(" (isa = %u, unsigned_immediate = %u (0x%8.8x))",
508 info.ISAAndImmediate.isa, info.ISAAndImmediate.unsigned_data32,
509 info.ISAAndImmediate.unsigned_data32);
510 break;
511
513 strm.Printf(" (isa = %u, signed_immediate = %i (0x%8.8x))",
514 info.ISAAndImmediateSigned.isa,
515 info.ISAAndImmediateSigned.signed_data32,
516 info.ISAAndImmediateSigned.signed_data32);
517 break;
518
519 case eInfoTypeISA:
520 strm.Printf(" (isa = %u)", info.isa);
521 break;
522
523 case eInfoTypeNoArgs:
524 break;
525 }
526}
527
529 const Address &inst_addr,
530 Target *target) {
531 m_opcode = opcode;
533 if (inst_addr.IsValid()) {
534 if (target != nullptr)
535 m_addr = inst_addr.GetLoadAddress(target);
537 m_addr = inst_addr.GetFileAddress();
538 }
539 return true;
540}
541
543 const RegisterInfo *reg_info, lldb::RegisterKind &reg_kind,
544 uint32_t &reg_num) {
545 // Generic and DWARF should be the two most popular register kinds when
546 // emulating instructions since they are the most platform agnostic...
547 reg_num = reg_info->kinds[eRegisterKindGeneric];
548 if (reg_num != LLDB_INVALID_REGNUM) {
549 reg_kind = eRegisterKindGeneric;
550 return true;
551 }
552
553 reg_num = reg_info->kinds[eRegisterKindDWARF];
554 if (reg_num != LLDB_INVALID_REGNUM) {
555 reg_kind = eRegisterKindDWARF;
556 return true;
557 }
558
559 reg_num = reg_info->kinds[eRegisterKindLLDB];
560 if (reg_num != LLDB_INVALID_REGNUM) {
561 reg_kind = eRegisterKindLLDB;
562 return true;
563 }
564
565 reg_num = reg_info->kinds[eRegisterKindEHFrame];
566 if (reg_num != LLDB_INVALID_REGNUM) {
567 reg_kind = eRegisterKindEHFrame;
568 return true;
569 }
570
571 reg_num = reg_info->kinds[eRegisterKindProcessPlugin];
572 if (reg_num != LLDB_INVALID_REGNUM) {
574 return true;
575 }
576 return false;
577}
578
579uint32_t
581 const RegisterInfo &reg_info) {
582 lldb::RegisterKind reg_kind;
583 uint32_t reg_num;
584 if (reg_ctx && GetBestRegisterKindAndNumber(&reg_info, reg_kind, reg_num))
585 return reg_ctx->ConvertRegisterKindToRegisterNumber(reg_kind, reg_num);
586 return LLDB_INVALID_REGNUM;
587}
588
589std::unique_ptr<SingleStepBreakpointLocationsPredictor>
591 std::unique_ptr<EmulateInstruction> emulator_up) {
592 auto creator =
593 emulator_up->GetSingleStepBreakpointLocationsPredictorCreator();
594 return creator(std::move(emulator_up));
595}
596
597std::optional<lldb::addr_t> EmulateInstruction::ReadPC() {
598 bool success = false;
600 LLDB_INVALID_ADDRESS, &success);
601 return success ? std::optional<addr_t>(addr) : std::nullopt;
602}
603
611
613 unwind_plan.Clear();
614 return false;
615}
616
617llvm::Expected<BreakpointLocations>
619 if (!m_emulator_up->ReadInstruction()) {
620 // try to get at least the size of next instruction to set breakpoint.
621 llvm::Expected<addr_t> next_pc = GetNextInstructionAddress();
622 if (next_pc)
623 return BreakpointLocations{*next_pc};
624 return next_pc.takeError();
625 }
626
627 std::optional<addr_t> entry_pc = m_emulator_up->ReadPC();
628 if (!entry_pc)
629 return llvm::createStringError("Can't read PC");
630
631 m_emulation_result = m_emulator_up->EvaluateInstruction(
632 eEmulateInstructionOptionAutoAdvancePC);
633
634 llvm::Expected<addr_t> next_pc = GetBreakpointLocationAddress(*entry_pc);
635 if (next_pc)
636 return BreakpointLocations{*next_pc};
637 return next_pc.takeError();
638}
639
640llvm::Expected<addr_t>
642 std::optional<uint32_t> instr_size = m_emulator_up->GetLastInstrSize();
643 if (!instr_size)
644 return llvm::createStringError("Read instruction failed!");
645
646 std::optional<addr_t> pc = m_emulator_up->ReadPC();
647 if (!pc)
648 return llvm::createStringError("Can't read PC");
649
650 lldb::addr_t next_pc = *pc + *instr_size;
651 return next_pc;
652}
653
654llvm::Expected<addr_t>
656 lldb::addr_t entry_pc) {
657 std::optional<addr_t> addr = m_emulator_up->ReadPC();
658 if (!addr)
659 return llvm::createStringError("Can't read PC");
660 lldb::addr_t pc = *addr;
661
662 if (m_emulation_result) {
663 assert(entry_pc != pc && "Emulation was successfull but PC wasn't updated");
664 return pc;
665 }
666
667 if (entry_pc == pc) {
668 // Emulate instruction failed and it hasn't changed PC. Advance PC with
669 // the size of the current opcode because the emulation of all
670 // PC modifying instruction should be successful. The failure most
671 // likely caused by an unsupported instruction which does not modify PC.
672 return pc + m_emulator_up->GetOpcode().GetByteSize();
673 }
674
675 // The instruction emulation failed after it modified the PC. It is an
676 // unknown error where we can't continue because the next instruction is
677 // modifying the PC but we don't know how.
678 return llvm::createStringError("Instruction emulation failed unexpectedly.");
679}
static llvm::raw_ostream & error(Stream &strm)
A section + offset based address class.
Definition Address.h:62
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
Definition Address.cpp:301
lldb::addr_t GetFileAddress() const
Get the file address.
Definition Address.cpp:281
bool IsValid() const
Check if the object state is valid.
Definition Address.h:355
An architecture specification class.
Definition ArchSpec.h:32
An data extractor class.
uint64_t GetMaxU64(lldb::offset_t *offset_ptr, size_t byte_size) const
Extract an unsigned integer of size byte_size from *offset_ptr.
"lldb/Core/EmulateInstruction.h" A class that allows emulation of CPU opcodes.
static bool GetBestRegisterKindAndNumber(const RegisterInfo *reg_info, lldb::RegisterKind &reg_kind, uint32_t &reg_num)
static bool WriteRegisterDefault(EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue &reg_value)
static size_t WriteMemoryFrame(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length)
lldb::ByteOrder GetByteOrder() const
void SetWriteRegCallback(WriteRegisterCallback write_reg_callback)
bool(* WriteRegisterCallback)(EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue &reg_value)
void SetCallbacks(ReadMemoryCallback read_mem_callback, WriteMemoryCallback write_mem_callback, ReadRegisterCallback read_reg_callback, WriteRegisterCallback write_reg_callback)
static bool ReadRegisterDefault(EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue &reg_value)
std::optional< lldb::addr_t > ReadPC()
virtual bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan)
bool ReadMemory(const Context &context, lldb::addr_t addr, void *dst, size_t dst_len)
bool WriteMemoryUnsigned(const Context &context, lldb::addr_t addr, uint64_t uval, size_t uval_byte_size)
static uint32_t GetInternalRegisterNumber(RegisterContext *reg_ctx, const RegisterInfo &reg_info)
void SetReadRegCallback(ReadRegisterCallback read_reg_callback)
std::optional< RegisterValue > ReadRegister(const RegisterInfo &reg_info)
size_t(* WriteMemoryCallback)(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length)
static size_t ReadMemoryFrame(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length)
bool WriteRegister(const Context &context, const RegisterInfo &ref_info, const RegisterValue &reg_value)
bool WriteRegisterUnsigned(const Context &context, const RegisterInfo &reg_info, uint64_t reg_value)
bool WriteMemory(const Context &context, lldb::addr_t addr, const void *src, size_t src_len)
uint64_t ReadMemoryUnsigned(const Context &context, lldb::addr_t addr, size_t byte_size, uint64_t fail_value, bool *success_ptr)
WriteRegisterCallback m_write_reg_callback
static std::unique_ptr< SingleStepBreakpointLocationsPredictor > CreateBreakpointLocationPredictor(std::unique_ptr< EmulateInstruction > emulator_up)
static size_t WriteMemoryDefault(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length)
size_t(* ReadMemoryCallback)(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length)
void SetReadMemCallback(ReadMemoryCallback read_mem_callback)
static bool WriteRegisterFrame(EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue &reg_value)
static bool ReadRegisterFrame(EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue &reg_value)
bool(* ReadRegisterCallback)(EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue &reg_value)
virtual std::optional< RegisterInfo > GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num)=0
static size_t ReadMemoryDefault(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length)
virtual bool SetInstruction(const Opcode &insn_opcode, const Address &inst_addr, Target *target)
static EmulateInstruction * FindPlugin(const ArchSpec &arch, InstructionType supported_inst_type, const char *plugin_name)
uint64_t ReadRegisterUnsigned(const RegisterInfo &reg_info, uint64_t fail_value, bool *success_ptr)
void SetWriteMemCallback(WriteMemoryCallback write_mem_callback)
static EmulateInstructionCreateInstance GetEmulateInstructionCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< EmulateInstructionCreateInstance > GetEmulateInstructionCreateCallbacks()
virtual uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num)
Convert from a given register numbering scheme to the lldb register numbering scheme.
void SetUInt64(uint64_t uint, Type t=eTypeUInt64)
bool SetUInt(uint64_t uint, uint32_t byte_size)
uint64_t GetAsUInt64(uint64_t fail_value=UINT64_MAX, bool *success_ptr=nullptr) const
llvm::Expected< lldb::addr_t > GetBreakpointLocationAddress(lldb::addr_t entry_pc)
std::unique_ptr< EmulateInstruction > m_emulator_up
virtual llvm::Expected< BreakpointLocations > GetBreakpointLocations()
This base class provides an interface to stack frames.
Definition StackFrame.h:44
virtual lldb::RegisterContextSP GetRegisterContext()
Get the RegisterContext for this frame, if possible.
lldb::ProcessSP CalculateProcess() override
An error handling class.
Definition Status.h:118
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition Stream.cpp:63
@ eBinary
Get and put data as binary instead of as the default string mode.
Definition Stream.h:32
size_t EOL()
Output and End of Line character to the stream.
Definition Stream.cpp:155
size_t PutMaxHex64(uint64_t uvalue, size_t byte_size, lldb::ByteOrder byte_order=lldb::eByteOrderInvalid)
Definition Stream.cpp:323
#define LLDB_INVALID_ADDRESS
#define LLDB_INVALID_REGNUM
#define LLDB_REGNUM_GENERIC_PC
A class that represents a running process on the host machine.
EmulateInstruction *(* EmulateInstructionCreateInstance)(const ArchSpec &arch, InstructionType inst_type)
InstructionType
Instruction types.
std::vector< lldb::addr_t > BreakpointLocations
void DumpRegisterValue(const RegisterValue &reg_val, Stream &s, const RegisterInfo &reg_info, bool prefix_with_name, bool prefix_with_alt_name, lldb::Format format, uint32_t reg_name_right_align_at=0, ExecutionContextScope *exe_scope=nullptr, bool print_flags=false, lldb::TargetSP target_sp=nullptr)
uint64_t offset_t
Definition lldb-types.h:85
std::shared_ptr< lldb_private::Process > ProcessSP
uint64_t addr_t
Definition lldb-types.h:80
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.
void Dump(Stream &s, EmulateInstruction *instruction) const
union lldb_private::EmulateInstruction::Context::ContextInfo info
Every register is described in detail including its name, alternate name (optional),...
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.