summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBFunction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/API/SBFunction.cpp')
-rw-r--r--lldb/source/API/SBFunction.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/lldb/source/API/SBFunction.cpp b/lldb/source/API/SBFunction.cpp
index 38e349bd3f9..f1426e787cd 100644
--- a/lldb/source/API/SBFunction.cpp
+++ b/lldb/source/API/SBFunction.cpp
@@ -10,10 +10,15 @@
#include "lldb/API/SBFunction.h"
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBStream.h"
+#include "lldb/Core/Disassembler.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Target.h"
using namespace lldb;
-
+using namespace lldb_private;
SBFunction::SBFunction () :
m_opaque_ptr (NULL)
@@ -77,3 +82,28 @@ SBFunction::GetDescription (SBStream &description)
return true;
}
+
+SBInstructionList
+SBFunction::GetInstructions (SBTarget target)
+{
+ SBInstructionList sb_instructions;
+ if (m_opaque_ptr)
+ {
+ ExecutionContext exe_ctx;
+ if (target.IsValid())
+ {
+ target->CalculateExecutionContext (exe_ctx);
+ exe_ctx.process = target->GetProcessSP().get();
+ }
+ Module *module = m_opaque_ptr->GetAddressRange().GetBaseAddress().GetModule();
+ if (module)
+ {
+ sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module->GetArchitecture(),
+ exe_ctx,
+ m_opaque_ptr->GetAddressRange()));
+ }
+ }
+ return sb_instructions;
+}
+
+
OpenPOWER on IntegriCloud