54 const lldb::InstructionSP &inst_sp)
72 const lldb::InstructionSP &inst_sp)
76 : m_opaque_sp(rhs.m_opaque_sp) {
92 return this->
operator bool();
94 SBInstruction::operator bool()
const {
97 return m_opaque_sp && m_opaque_sp->IsValid();
104 lldb::InstructionSP inst_sp(
GetOpaque());
105 if (inst_sp && inst_sp->GetAddress().IsValid())
113 lldb::InstructionSP inst_sp(
GetOpaque());
116 TargetSP target_sp(target.
GetSP());
117 std::unique_lock<std::recursive_mutex> lock;
119 lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
121 target_sp->CalculateExecutionContext(exe_ctx);
124 return inst_sp->GetMnemonic(&exe_ctx);
132 lldb::InstructionSP inst_sp(
GetOpaque());
135 TargetSP target_sp(target.
GetSP());
136 std::unique_lock<std::recursive_mutex> lock;
138 lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
140 target_sp->CalculateExecutionContext(exe_ctx);
143 return inst_sp->GetOperands(&exe_ctx);
151 lldb::InstructionSP inst_sp(
GetOpaque());
154 TargetSP target_sp(target.
GetSP());
155 std::unique_lock<std::recursive_mutex> lock;
157 lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
159 target_sp->CalculateExecutionContext(exe_ctx);
162 return inst_sp->GetComment(&exe_ctx);
170 lldb::InstructionSP inst_sp(
GetOpaque());
172 return inst_sp->GetOpcode().GetByteSize();
180 lldb::InstructionSP inst_sp(
GetOpaque());
183 if (inst_sp->GetData(*data_extractor_sp)) {
193 lldb::InstructionSP inst_sp(
GetOpaque());
195 return inst_sp->DoesBranch();
202 lldb::InstructionSP inst_sp(
GetOpaque());
204 return inst_sp->HasDelaySlot();
211 lldb::InstructionSP inst_sp(
GetOpaque());
213 return inst_sp->CanSetBreakpoint();
221 return lldb::InstructionSP();
225 const lldb::InstructionSP &inst_sp) {
226 m_opaque_sp = std::make_shared<InstructionImpl>(disasm_sp, inst_sp);
232 lldb::InstructionSP inst_sp(
GetOpaque());
235 const Address &addr = inst_sp->GetAddress();
238 module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything,
243 FormatEntity::Parse(
"${addr}: ", format);
244 inst_sp->Dump(&s.
ref(), 0,
true,
false,
false,
245 nullptr, &sc,
nullptr, &format, 0);
253 FileSP out = std::make_shared<NativeFile>(outp,
false);
265 if (!out_sp || !out_sp->IsValid())
268 lldb::InstructionSP inst_sp(
GetOpaque());
271 const Address &addr = inst_sp->GetAddress();
274 module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything,
278 FormatEntity::Parse(
"${addr}: ", format);
279 inst_sp->Dump(&out_stream, 0,
true,
false,
false,
280 nullptr, &sc,
nullptr, &format, 0);
288 lldb::InstructionSP inst_sp(
GetOpaque());
290 lldb::StackFrameSP frame_sp(frame.
GetFrameSP());
294 frame_sp->CalculateExecutionContext(exe_ctx);
298 return inst_sp->Emulate(
299 arch, evaluate_options, (
void *)frame_sp.get(),
312 lldb::InstructionSP inst_sp(
GetOpaque());
313 if (inst_sp && triple) {
314 return inst_sp->DumpEmulation(HostInfo::GetAugmentedArchSpec(triple));
320 const char *test_file) {
327 lldb::InstructionSP inst_sp(
GetOpaque());
329 return inst_sp->TestEmulation(output_stream.
get(), test_file);