aboutsummaryrefslogtreecommitdiffstats
path: root/source/API/SBInstruction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/API/SBInstruction.cpp')
-rw-r--r--source/API/SBInstruction.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/source/API/SBInstruction.cpp b/source/API/SBInstruction.cpp
index fcf66fd25824..a9ef9fb59d24 100644
--- a/source/API/SBInstruction.cpp
+++ b/source/API/SBInstruction.cpp
@@ -11,6 +11,7 @@
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBFrame.h"
+#include "lldb/API/SBFile.h"
#include "lldb/API/SBInstruction.h"
#include "lldb/API/SBStream.h"
@@ -255,10 +256,21 @@ bool SBInstruction::GetDescription(lldb::SBStream &s) {
return false;
}
-void SBInstruction::Print(FILE *out) {
- LLDB_RECORD_METHOD(void, SBInstruction, Print, (FILE *), out);
+void SBInstruction::Print(FILE *outp) {
+ LLDB_RECORD_METHOD(void, SBInstruction, Print, (FILE *), outp);
+ FileSP out = std::make_shared<NativeFile>(outp, /*take_ownership=*/false);
+ Print(out);
+}
+
+void SBInstruction::Print(SBFile out) {
+ LLDB_RECORD_METHOD(void, SBInstruction, Print, (SBFile), out);
+ Print(out.m_opaque_sp);
+}
+
+void SBInstruction::Print(FileSP out_sp) {
+ LLDB_RECORD_METHOD(void, SBInstruction, Print, (FileSP), out_sp);
- if (out == nullptr)
+ if (!out_sp || !out_sp->IsValid())
return;
lldb::InstructionSP inst_sp(GetOpaque());
@@ -269,7 +281,7 @@ void SBInstruction::Print(FILE *out) {
if (module_sp)
module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything,
sc);
- StreamFile out_stream(out, false);
+ StreamFile out_stream(out_sp);
FormatEntity::Entry format;
FormatEntity::Parse("${addr}: ", format);
inst_sp->Dump(&out_stream, 0, true, false, nullptr, &sc, nullptr, &format,
@@ -358,6 +370,8 @@ void RegisterMethods<SBInstruction>(Registry &R) {
LLDB_REGISTER_METHOD(bool, SBInstruction, GetDescription,
(lldb::SBStream &));
LLDB_REGISTER_METHOD(void, SBInstruction, Print, (FILE *));
+ LLDB_REGISTER_METHOD(void, SBInstruction, Print, (SBFile));
+ LLDB_REGISTER_METHOD(void, SBInstruction, Print, (FileSP));
LLDB_REGISTER_METHOD(bool, SBInstruction, EmulateWithFrame,
(lldb::SBFrame &, uint32_t));
LLDB_REGISTER_METHOD(bool, SBInstruction, DumpEmulation, (const char *));