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
30#include <cstring>
31#include <memory>
32#include <optional>
33
34#include <cinttypes>
35#include <cstdio>
36
37namespace lldb_private {
38class Target;
39}
40
41using namespace lldb;
42using namespace lldb_private;
43
46 InstructionType supported_inst_type,
47 const char *plugin_name) {
48 EmulateInstructionCreateInstance create_callback = nullptr;
49 if (plugin_name) {
50 create_callback =
52 plugin_name);
53 if (create_callback) {
54 EmulateInstruction *emulate_insn_ptr =
55 create_callback(arch, supported_inst_type);
56 if (emulate_insn_ptr)
57 return emulate_insn_ptr;
58 }
59 } else {
60 for (auto create_callback :
62 EmulateInstruction *emulate_insn_ptr =
63 create_callback(arch, supported_inst_type);
64 if (emulate_insn_ptr)
65 return emulate_insn_ptr;
66 }
67 }
68 return nullptr;
69}
70
72
73std::optional<RegisterValue>
75 if (m_read_reg_callback == nullptr)
76 return {};
77
78 RegisterValue reg_value;
79 bool success = m_read_reg_callback(this, m_baton, &reg_info, reg_value);
80 if (success)
81 return reg_value;
82 return {};
83}
84
86 uint32_t reg_num,
87 RegisterValue &reg_value) {
88 std::optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
89 if (!reg_info)
90 return false;
91
92 std::optional<RegisterValue> value = ReadRegister(*reg_info);
93 if (value)
94 reg_value = *value;
95 return value.has_value();
96}
97
99 uint32_t reg_num,
100 uint64_t fail_value,
101 bool *success_ptr) {
102 RegisterValue reg_value;
103 if (ReadRegister(reg_kind, reg_num, reg_value))
104 return reg_value.GetAsUInt64(fail_value, success_ptr);
105 if (success_ptr)
106 *success_ptr = false;
107 return fail_value;
108}
109
111 uint64_t fail_value,
112 bool *success_ptr) {
113 std::optional<RegisterValue> reg_value = ReadRegister(reg_info);
114 if (!reg_value) {
115 if (success_ptr)
116 *success_ptr = false;
117 return fail_value;
118 }
119
120 return reg_value->GetAsUInt64(fail_value, success_ptr);
121}
122
124 const RegisterInfo &reg_info,
125 const RegisterValue &reg_value) {
126 if (m_write_reg_callback != nullptr)
127 return m_write_reg_callback(this, m_baton, context, &reg_info, reg_value);
128 return false;
129}
130
132 lldb::RegisterKind reg_kind,
133 uint32_t reg_num,
134 const RegisterValue &reg_value) {
135 std::optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
136 if (reg_info)
137 return WriteRegister(context, *reg_info, reg_value);
138 return false;
139}
140
142 lldb::RegisterKind reg_kind,
143 uint32_t reg_num,
144 uint64_t uint_value) {
145 std::optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
146 if (reg_info) {
147 RegisterValue reg_value;
148 if (reg_value.SetUInt(uint_value, reg_info->byte_size))
149 return WriteRegister(context, *reg_info, reg_value);
150 }
151 return false;
152}
153
155 const RegisterInfo &reg_info,
156 uint64_t uint_value) {
157 RegisterValue reg_value;
158 if (reg_value.SetUInt(uint_value, reg_info.byte_size))
159 return WriteRegister(context, reg_info, reg_value);
160 return false;
161}
162
164 void *dst, size_t dst_len) {
165 if (m_read_mem_callback != nullptr)
166 return m_read_mem_callback(this, m_baton, context, addr, dst, dst_len) ==
167 dst_len;
168 return false;
169}
170
172 lldb::addr_t addr,
173 size_t byte_size,
174 uint64_t fail_value,
175 bool *success_ptr) {
176 uint64_t uval64 = 0;
177 bool success = false;
178 if (byte_size <= 8) {
179 uint8_t buf[sizeof(uint64_t)];
180 size_t bytes_read =
181 m_read_mem_callback(this, m_baton, context, addr, buf, byte_size);
182 if (bytes_read == byte_size) {
183 lldb::offset_t offset = 0;
184 DataExtractor data(buf, byte_size, GetByteOrder(), GetAddressByteSize());
185 uval64 = data.GetMaxU64(&offset, byte_size);
186 success = true;
187 }
188 }
189
190 if (success_ptr)
191 *success_ptr = success;
192
193 if (!success)
194 uval64 = fail_value;
195 return uval64;
196}
197
199 lldb::addr_t addr, uint64_t uval,
200 size_t uval_byte_size) {
202 strm.PutMaxHex64(uval, uval_byte_size);
203
204 size_t bytes_written = m_write_mem_callback(
205 this, m_baton, context, addr, strm.GetString().data(), uval_byte_size);
206 return (bytes_written == uval_byte_size);
207}
208
210 const void *src, size_t src_len) {
211 if (m_write_mem_callback != nullptr)
212 return m_write_mem_callback(this, m_baton, context, addr, src, src_len) ==
213 src_len;
214 return false;
215}
216
217void EmulateInstruction::SetBaton(void *baton) { m_baton = baton; }
218
220 ReadMemoryCallback read_mem_callback,
221 WriteMemoryCallback write_mem_callback,
222 ReadRegisterCallback read_reg_callback,
223 WriteRegisterCallback write_reg_callback) {
224 m_read_mem_callback = read_mem_callback;
225 m_write_mem_callback = write_mem_callback;
226 m_read_reg_callback = read_reg_callback;
227 m_write_reg_callback = write_reg_callback;
228}
229
231 ReadMemoryCallback read_mem_callback) {
232 m_read_mem_callback = read_mem_callback;
233}
234
236 WriteMemoryCallback write_mem_callback) {
237 m_write_mem_callback = write_mem_callback;
238}
239
241 ReadRegisterCallback read_reg_callback) {
242 m_read_reg_callback = read_reg_callback;
243}
244
246 WriteRegisterCallback write_reg_callback) {
247 m_write_reg_callback = write_reg_callback;
248}
249
250//
251// Read & Write Memory and Registers callback functions.
252//
253
255 void *baton, const Context &context,
256 lldb::addr_t addr, void *dst,
257 size_t dst_len) {
258 if (baton == nullptr || dst == nullptr || dst_len == 0)
259 return 0;
260
261 StackFrame *frame = (StackFrame *)baton;
262
263 ProcessSP process_sp(frame->CalculateProcess());
264 if (process_sp) {
266 return process_sp->ReadMemory(addr, dst, dst_len, error);
267 }
268 return 0;
269}
270
272 void *baton, const Context &context,
273 lldb::addr_t addr, const void *src,
274 size_t src_len) {
275 if (baton == nullptr || src == nullptr || src_len == 0)
276 return 0;
277
278 StackFrame *frame = (StackFrame *)baton;
279
280 ProcessSP process_sp(frame->CalculateProcess());
281 if (process_sp) {
283 return process_sp->WriteMemory(addr, src, src_len, error);
284 }
285
286 return 0;
287}
288
290 void *baton,
291 const RegisterInfo *reg_info,
292 RegisterValue &reg_value) {
293 if (baton == nullptr)
294 return false;
295
296 StackFrame *frame = (StackFrame *)baton;
297 return frame->GetRegisterContext()->ReadRegister(reg_info, reg_value);
298}
299
301 void *baton, const Context &context,
302 const RegisterInfo *reg_info,
303 const RegisterValue &reg_value) {
304 if (baton == nullptr)
305 return false;
306
307 StackFrame *frame = (StackFrame *)baton;
308 return frame->GetRegisterContext()->WriteRegister(reg_info, reg_value);
309}
310
312 void *baton,
313 const Context &context,
314 lldb::addr_t addr, void *dst,
315 size_t length) {
316 StreamFile strm(stdout, false);
317 strm.Printf(" Read from Memory (address = 0x%" PRIx64 ", length = %" PRIu64
318 ", context = ",
319 addr, (uint64_t)length);
320 context.Dump(strm, instruction);
321 strm.EOL();
322 *((uint64_t *)dst) = 0xdeadbeef;
323 return length;
324}
325
327 void *baton,
328 const Context &context,
329 lldb::addr_t addr,
330 const void *dst, size_t length) {
331 StreamFile strm(stdout, false);
332 strm.Printf(" Write to Memory (address = 0x%" PRIx64 ", length = %" PRIu64
333 ", context = ",
334 addr, (uint64_t)length);
335 context.Dump(strm, instruction);
336 strm.EOL();
337 return length;
338}
339
341 void *baton,
342 const RegisterInfo *reg_info,
343 RegisterValue &reg_value) {
344 StreamFile strm(stdout, false);
345 strm.Printf(" Read Register (%s)\n", reg_info->name);
346 lldb::RegisterKind reg_kind;
347 uint32_t reg_num;
348 if (GetBestRegisterKindAndNumber(reg_info, reg_kind, reg_num))
349 reg_value.SetUInt64((uint64_t)reg_kind << 24 | reg_num);
350 else
351 reg_value.SetUInt64(0);
352
353 return true;
354}
355
357 void *baton,
358 const Context &context,
359 const RegisterInfo *reg_info,
360 const RegisterValue &reg_value) {
361 StreamFile strm(stdout, false);
362 strm.Printf(" Write to Register (name = %s, value = ", reg_info->name);
363 DumpRegisterValue(reg_value, strm, *reg_info, false, false, eFormatDefault);
364 strm.PutCString(", context = ");
365 context.Dump(strm, instruction);
366 strm.EOL();
367 return true;
368}
369
371 EmulateInstruction *instruction) const {
372 switch (type) {
374 strm.PutCString("reading opcode");
375 break;
376
378 strm.PutCString("immediate");
379 break;
380
382 strm.PutCString("push register");
383 break;
384
386 strm.PutCString("pop register");
387 break;
388
390 strm.PutCString("adjust sp");
391 break;
392
394 strm.PutCString("set frame pointer");
395 break;
396
398 strm.PutCString("adjusting (writing value back to) a base register");
399 break;
400
402 strm.PutCString("register + offset");
403 break;
404
406 strm.PutCString("store register");
407 break;
408
410 strm.PutCString("load register");
411 break;
412
414 strm.PutCString("relative branch immediate");
415 break;
416
418 strm.PutCString("absolute branch register");
419 break;
420
422 strm.PutCString("supervisor call");
423 break;
424
426 strm.PutCString("table branch read memory");
427 break;
428
430 strm.PutCString("write random bits to a register");
431 break;
432
434 strm.PutCString("write random bits to a memory address");
435 break;
436
438 strm.PutCString("arithmetic");
439 break;
440
442 strm.PutCString("return from exception");
443 break;
444
445 default:
446 strm.PutCString("unrecognized context.");
447 break;
448 }
449
450 switch (GetInfoType()) {
452 strm.Printf(" (reg_plus_offset = %s%+" PRId64 ")",
453 info.RegisterPlusOffset.reg.name,
454 info.RegisterPlusOffset.signed_offset);
455 break;
456
458 strm.Printf(" (reg_plus_reg = %s + %s)",
459 info.RegisterPlusIndirectOffset.base_reg.name,
460 info.RegisterPlusIndirectOffset.offset_reg.name);
461 break;
462
464 strm.Printf(" (base_and_imm_offset = %s%+" PRId64 ", data_reg = %s)",
465 info.RegisterToRegisterPlusOffset.base_reg.name,
466 info.RegisterToRegisterPlusOffset.offset,
467 info.RegisterToRegisterPlusOffset.data_reg.name);
468 break;
469
471 strm.Printf(" (base_and_reg_offset = %s + %s, data_reg = %s)",
472 info.RegisterToRegisterPlusIndirectOffset.base_reg.name,
473 info.RegisterToRegisterPlusIndirectOffset.offset_reg.name,
474 info.RegisterToRegisterPlusIndirectOffset.data_reg.name);
475 break;
476
478 strm.Printf(" (register to register binary op: %s and %s)",
479 info.RegisterRegisterOperands.operand1.name,
480 info.RegisterRegisterOperands.operand2.name);
481 break;
482
483 case eInfoTypeOffset:
484 strm.Printf(" (signed_offset = %+" PRId64 ")", info.signed_offset);
485 break;
486
488 strm.Printf(" (reg = %s)", info.reg.name);
489 break;
490
492 strm.Printf(" (unsigned_immediate = %" PRIu64 " (0x%16.16" PRIx64 "))",
493 info.unsigned_immediate, info.unsigned_immediate);
494 break;
495
497 strm.Printf(" (signed_immediate = %+" PRId64 " (0x%16.16" PRIx64 "))",
498 info.signed_immediate, info.signed_immediate);
499 break;
500
501 case eInfoTypeAddress:
502 strm.Printf(" (address = 0x%" PRIx64 ")", info.address);
503 break;
504
506 strm.Printf(" (isa = %u, unsigned_immediate = %u (0x%8.8x))",
507 info.ISAAndImmediate.isa, info.ISAAndImmediate.unsigned_data32,
508 info.ISAAndImmediate.unsigned_data32);
509 break;
510
512 strm.Printf(" (isa = %u, signed_immediate = %i (0x%8.8x))",
513 info.ISAAndImmediateSigned.isa,
514 info.ISAAndImmediateSigned.signed_data32,
515 info.ISAAndImmediateSigned.signed_data32);
516 break;
517
518 case eInfoTypeISA:
519 strm.Printf(" (isa = %u)", info.isa);
520 break;
521
522 case eInfoTypeNoArgs:
523 break;
524 }
525}
526
528 const Address &inst_addr,
529 Target *target) {
530 m_opcode = opcode;
532 if (inst_addr.IsValid()) {
533 if (target != nullptr)
534 m_addr = inst_addr.GetLoadAddress(target);
536 m_addr = inst_addr.GetFileAddress();
537 }
538 return true;
539}
540
542 const RegisterInfo *reg_info, lldb::RegisterKind &reg_kind,
543 uint32_t &reg_num) {
544 // Generic and DWARF should be the two most popular register kinds when
545 // emulating instructions since they are the most platform agnostic...
546 reg_num = reg_info->kinds[eRegisterKindGeneric];
547 if (reg_num != LLDB_INVALID_REGNUM) {
548 reg_kind = eRegisterKindGeneric;
549 return true;
550 }
551
552 reg_num = reg_info->kinds[eRegisterKindDWARF];
553 if (reg_num != LLDB_INVALID_REGNUM) {
554 reg_kind = eRegisterKindDWARF;
555 return true;
556 }
557
558 reg_num = reg_info->kinds[eRegisterKindLLDB];
559 if (reg_num != LLDB_INVALID_REGNUM) {
560 reg_kind = eRegisterKindLLDB;
561 return true;
562 }
563
564 reg_num = reg_info->kinds[eRegisterKindEHFrame];
565 if (reg_num != LLDB_INVALID_REGNUM) {
566 reg_kind = eRegisterKindEHFrame;
567 return true;
568 }
569
570 reg_num = reg_info->kinds[eRegisterKindProcessPlugin];
571 if (reg_num != LLDB_INVALID_REGNUM) {
573 return true;
574 }
575 return false;
576}
577
578uint32_t
580 const RegisterInfo &reg_info) {
581 lldb::RegisterKind reg_kind;
582 uint32_t reg_num;
583 if (reg_ctx && GetBestRegisterKindAndNumber(&reg_info, reg_kind, reg_num))
584 return reg_ctx->ConvertRegisterKindToRegisterNumber(reg_kind, reg_num);
585 return LLDB_INVALID_REGNUM;
586}
587
588std::unique_ptr<SingleStepBreakpointLocationsPredictor>
590 std::unique_ptr<EmulateInstruction> emulator_up) {
591 auto creator =
592 emulator_up->GetSingleStepBreakpointLocationsPredictorCreator();
593 return creator(std::move(emulator_up));
594}
595
596std::optional<lldb::addr_t> EmulateInstruction::ReadPC() {
597 bool success = false;
599 LLDB_INVALID_ADDRESS, &success);
600 return success ? std::optional<addr_t>(addr) : std::nullopt;
601}
602
610
612 unwind_plan.Clear();
613 return false;
614}
615
618 if (!m_emulator_up->ReadInstruction()) {
619 // try to get at least the size of next instruction to set breakpoint.
620 lldb::addr_t next_pc = GetNextInstructionAddress(status);
621 return BreakpointLocations{next_pc};
622 }
623
624 auto entry_pc = m_emulator_up->ReadPC();
625 if (!entry_pc) {
626 status = Status("Can't read PC");
627 return {};
628 }
629
630 m_emulation_result = m_emulator_up->EvaluateInstruction(
631 eEmulateInstructionOptionAutoAdvancePC);
632
633 lldb::addr_t next_pc = GetBreakpointLocationAddress(*entry_pc, status);
634 return BreakpointLocations{next_pc};
635}
636
638 Status &error) {
639 auto instr_size = m_emulator_up->GetLastInstrSize();
640 if (!instr_size) {
641 error = Status("Read instruction failed!");
643 }
644
645 auto pc = m_emulator_up->ReadPC();
646 if (!pc) {
647 error = Status("Can't read PC");
649 }
650
651 lldb::addr_t next_pc = *pc + *instr_size;
652 return next_pc;
653}
654
657 lldb::addr_t entry_pc, Status &error) {
658 auto addr = m_emulator_up->ReadPC();
659 if (!addr) {
660 error = Status("Can't read PC");
662 }
663 lldb::addr_t pc = *addr;
664
665 if (m_emulation_result) {
666 assert(entry_pc != pc && "Emulation was successfull but PC wasn't updated");
667 return pc;
668 }
669
670 if (entry_pc == pc) {
671 // Emulate instruction failed and it hasn't changed PC. Advance PC with
672 // the size of the current opcode because the emulation of all
673 // PC modifying instruction should be successful. The failure most
674 // likely caused by an unsupported instruction which does not modify PC.
675 return pc + m_emulator_up->GetOpcode().GetByteSize();
676 }
677
678 // The instruction emulation failed after it modified the PC. It is an
679 // unknown error where we can't continue because the next instruction is
680 // modifying the PC but we don't know how.
681 error = Status("Instruction emulation failed unexpectedly.");
683}
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 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)
size_t ReadMemory(const Context &context, lldb::addr_t addr, void *dst, size_t dst_len)
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
std::unique_ptr< EmulateInstruction > m_emulator_up
virtual BreakpointLocations GetBreakpointLocations(Status &status)
lldb::addr_t GetBreakpointLocationAddress(lldb::addr_t entry_pc, Status &error)
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:65
@ 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.