Added the ability to get the disassembly instructions from the function and
symbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115734 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBSymbol.cpp b/source/API/SBSymbol.cpp
index 017df43..eed84d5 100644
--- a/source/API/SBSymbol.cpp
+++ b/source/API/SBSymbol.cpp
@@ -9,10 +9,14 @@
#include "lldb/API/SBSymbol.h"
#include "lldb/API/SBStream.h"
+#include "lldb/Core/Disassembler.h"
+#include "lldb/Core/Module.h"
#include "lldb/Symbol/Symbol.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Target.h"
using namespace lldb;
-
+using namespace lldb_private;
SBSymbol::SBSymbol () :
m_opaque_ptr (NULL)
@@ -78,3 +82,30 @@
return true;
}
+
+
+
+SBInstructionList
+SBSymbol::GetInstructions (SBTarget target)
+{
+ SBInstructionList sb_instructions;
+ if (m_opaque_ptr)
+ {
+ ExecutionContext exe_ctx;
+ if (target.IsValid())
+ target->CalculateExecutionContext (exe_ctx);
+ const AddressRange *symbol_range = m_opaque_ptr->GetAddressRangePtr();
+ if (symbol_range)
+ {
+ Module *module = symbol_range->GetBaseAddress().GetModule();
+ if (module)
+ {
+ sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module->GetArchitecture (),
+ exe_ctx,
+ *symbol_range));
+ }
+ }
+ }
+ return sb_instructions;
+}
+