LLDB mainline
SBInstruction.h
Go to the documentation of this file.
1//===-- SBInstruction.h -----------------------------------------*- C++ -*-===//
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
9#ifndef LLDB_API_SBINSTRUCTION_H
10#define LLDB_API_SBINSTRUCTION_H
11
12#include "lldb/API/SBData.h"
13#include "lldb/API/SBDefines.h"
14
15#include <cstdio>
16
17// There's a lot to be fixed here, but need to wait for underlying insn
18// implementation to be revised & settle down first.
19
20class InstructionImpl;
21
22namespace lldb {
23
25public:
27
28 SBInstruction(const SBInstruction &rhs);
29
30 const SBInstruction &operator=(const SBInstruction &rhs);
31
33
34 explicit operator bool() const;
35
36 bool IsValid();
37
38 SBAddress GetAddress();
39
40 const char *GetMnemonic(lldb::SBTarget target);
41
42 const char *GetOperands(lldb::SBTarget target);
43
44 const char *GetComment(lldb::SBTarget target);
45
46 lldb::InstructionControlFlowKind GetControlFlowKind(lldb::SBTarget target);
47
48 lldb::SBData GetData(lldb::SBTarget target);
49
50 size_t GetByteSize();
51
52 bool DoesBranch();
53
54 bool HasDelaySlot();
55
56 bool CanSetBreakpoint();
57
58#ifndef SWIG
59 void Print(FILE *out);
60#endif
61
62 void Print(SBFile out);
63
64 void Print(FileSP BORROWED);
65
66 bool GetDescription(lldb::SBStream &description);
67
68 bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options);
69
70 bool DumpEmulation(const char *triple); // triple is to specify the
71 // architecture, e.g. 'armv6' or
72 // 'armv7-apple-ios'
73
74 bool TestEmulation(lldb::SBStream &output_stream, const char *test_file);
75
76protected:
77 friend class SBInstructionList;
78
79 SBInstruction(const lldb::DisassemblerSP &disasm_sp,
80 const lldb::InstructionSP &inst_sp);
81
82 void SetOpaque(const lldb::DisassemblerSP &disasm_sp,
83 const lldb::InstructionSP &inst_sp);
84
85 lldb::InstructionSP GetOpaque();
86
87private:
88 std::shared_ptr<InstructionImpl> m_opaque_sp;
89};
90
91} // namespace lldb
92
93#endif // LLDB_API_SBINSTRUCTION_H
#define LLDB_API
Definition: SBDefines.h:28
std::shared_ptr< InstructionImpl > m_opaque_sp
Definition: SBInstruction.h:88
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::Instruction > InstructionSP
Definition: lldb-forward.h:358
std::shared_ptr< lldb_private::Disassembler > DisassemblerSP
Definition: lldb-forward.h:341
InstructionControlFlowKind
Architecture-agnostic categorization of instructions for traversing the control flow of a trace.
std::shared_ptr< lldb_private::File > FileSP
Definition: lldb-forward.h:353