|
11 | 11 | #include "lldb/API/SBAddress.h"
|
12 | 12 | #include "lldb/API/SBInstruction.h"
|
13 | 13 | #include "lldb/API/SBStream.h"
|
| 14 | +#include "lldb/API/SBFile.h" |
14 | 15 | #include "lldb/Core/Disassembler.h"
|
15 | 16 | #include "lldb/Core/Module.h"
|
| 17 | +#include "lldb/Core/StreamFile.h" |
16 | 18 | #include "lldb/Symbol/SymbolContext.h"
|
17 | 19 | #include "lldb/Utility/Stream.h"
|
18 | 20 |
|
@@ -118,21 +120,41 @@ void SBInstructionList::SetDisassembler(const lldb::DisassemblerSP &opaque_sp) {
|
118 | 120 |
|
119 | 121 | void SBInstructionList::Print(FILE *out) {
|
120 | 122 | LLDB_RECORD_METHOD(void, SBInstructionList, Print, (FILE *), out);
|
121 |
| - |
122 | 123 | if (out == nullptr)
|
123 | 124 | return;
|
| 125 | + StreamFile stream(out, false); |
| 126 | + GetDescription(stream); |
124 | 127 | }
|
125 | 128 |
|
126 |
| -bool SBInstructionList::GetDescription(lldb::SBStream &description) { |
| 129 | +void SBInstructionList::Print(SBFile out) { |
| 130 | + LLDB_RECORD_METHOD(void, SBInstructionList, Print, (SBFile), out); |
| 131 | + if (!out.IsValid()) |
| 132 | + return; |
| 133 | + StreamFile stream(out.GetFile()); |
| 134 | + GetDescription(stream); |
| 135 | +} |
| 136 | + |
| 137 | +void SBInstructionList::Print(FileSP out_sp) { |
| 138 | + LLDB_RECORD_METHOD(void, SBInstructionList, Print, (FileSP), out_sp); |
| 139 | + if (!out_sp || !out_sp->IsValid()) |
| 140 | + return; |
| 141 | + StreamFile stream(out_sp); |
| 142 | + GetDescription(stream); |
| 143 | +} |
| 144 | + |
| 145 | +bool SBInstructionList::GetDescription(lldb::SBStream &stream) { |
127 | 146 | LLDB_RECORD_METHOD(bool, SBInstructionList, GetDescription,
|
128 |
| - (lldb::SBStream &), description); |
| 147 | + (lldb::SBStream &), stream); |
| 148 | + return GetDescription(stream.ref()); |
| 149 | +} |
| 150 | + |
| 151 | +bool SBInstructionList::GetDescription(Stream &sref) { |
129 | 152 |
|
130 | 153 | if (m_opaque_sp) {
|
131 | 154 | size_t num_instructions = GetSize();
|
132 | 155 | if (num_instructions) {
|
133 | 156 | // Call the ref() to make sure a stream is created if one deesn't exist
|
134 | 157 | // already inside description...
|
135 |
| - Stream &sref = description.ref(); |
136 | 158 | const uint32_t max_opcode_byte_size =
|
137 | 159 | m_opaque_sp->GetInstructionList().GetMaxOpcocdeByteSize();
|
138 | 160 | FormatEntity::Entry format;
|
@@ -200,6 +222,8 @@ void RegisterMethods<SBInstructionList>(Registry &R) {
|
200 | 222 | LLDB_REGISTER_METHOD(void, SBInstructionList, AppendInstruction,
|
201 | 223 | (lldb::SBInstruction));
|
202 | 224 | LLDB_REGISTER_METHOD(void, SBInstructionList, Print, (FILE *));
|
| 225 | + LLDB_REGISTER_METHOD(void, SBInstructionList, Print, (SBFile)); |
| 226 | + LLDB_REGISTER_METHOD(void, SBInstructionList, Print, (FileSP)); |
203 | 227 | LLDB_REGISTER_METHOD(bool, SBInstructionList, GetDescription,
|
204 | 228 | (lldb::SBStream &));
|
205 | 229 | LLDB_REGISTER_METHOD(bool, SBInstructionList,
|
|
0 commit comments