I have added a function to SBTarget that allows
clients to disassemble a series of raw bytes as
demonstrated by a new testcase.
In the future, this API will also allow clients
to provide a callback that adds comments for
addresses in the disassembly.
I also modified the SWIG harness to ensure that
Python ByteArrays work as well as strings as
sources of raw data.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146611 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index 179cb93..b922d2a 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -1285,6 +1285,33 @@
return source_manager;
}
+lldb::SBInstructionList
+SBTarget::GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size)
+{
+ SBInstructionList sb_instructions;
+
+ if (m_opaque_sp)
+ {
+ Address addr;
+
+ if (base_addr.get())
+ addr = *base_addr.get();
+
+ sb_instructions.SetDisassembler (Disassembler::DisassembleBytes (m_opaque_sp->GetArchitecture(),
+ NULL,
+ addr,
+ buf,
+ size));
+ }
+
+ return sb_instructions;
+}
+
+lldb::SBInstructionList
+SBTarget::GetInstructions (lldb::addr_t base_addr, const void *buf, size_t size)
+{
+ return GetInstructions (ResolveLoadAddress(base_addr), buf, size);
+}
SBError
SBTarget::SetSectionLoadAddress (lldb::SBSection section,