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
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
47
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
76 /// Get variable annotations for this instruction as structured data.
77 /// Returns an array of dictionaries, each containing:
78 /// - "variable_name": string name of the variable
79 /// - "location_description": string description of where variable is stored
80 /// ("RDI", "R15", "undef", etc.)
81 /// - "start_address": unsigned integer address where this annotation becomes
82 /// valid
83 /// - "end_address": unsigned integer address where this annotation becomes
84 /// invalid
85 /// - "register_kind": unsigned integer indicating the register numbering
86 /// scheme
87 /// - "decl_file": string path to the file where variable is declared
88 /// - "decl_line": unsigned integer line number where variable is declared
89 /// - "type_name": string type name of the variable
91
92protected:
93 friend class SBInstructionList;
94
95 SBInstruction(const lldb::DisassemblerSP &disasm_sp,
96 const lldb::InstructionSP &inst_sp);
97
98 void SetOpaque(const lldb::DisassemblerSP &disasm_sp,
99 const lldb::InstructionSP &inst_sp);
100
102
103private:
104 std::shared_ptr<InstructionImpl> m_opaque_sp;
105};
106
107} // namespace lldb
108
109#endif // LLDB_API_SBINSTRUCTION_H
#define LLDB_API
Definition SBDefines.h:28
void SetOpaque(const lldb::DisassemblerSP &disasm_sp, const lldb::InstructionSP &inst_sp)
std::shared_ptr< InstructionImpl > m_opaque_sp
const char * GetOperands(lldb::SBTarget target)
lldb::InstructionSP GetOpaque()
const char * GetComment(lldb::SBTarget target)
bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options)
bool DumpEmulation(const char *triple)
lldb::InstructionControlFlowKind GetControlFlowKind(lldb::SBTarget target)
const SBInstruction & operator=(const SBInstruction &rhs)
bool TestEmulation(lldb::SBStream &output_stream, const char *test_file)
void Print(FILE *out)
lldb::SBStructuredData GetVariableAnnotations()
Get variable annotations for this instruction as structured data.
lldb::SBData GetData(lldb::SBTarget target)
bool GetDescription(lldb::SBStream &description)
friend class SBInstructionList
const char * GetMnemonic(lldb::SBTarget target)
std::shared_ptr< lldb_private::Instruction > InstructionSP
std::shared_ptr< lldb_private::Disassembler > DisassemblerSP
InstructionControlFlowKind
Architecture-agnostic categorization of instructions for traversing the control flow of a trace.
std::shared_ptr< lldb_private::File > FileSP