summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBFunction.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-10-06 03:09:58 +0000
committerGreg Clayton <gclayton@apple.com>2010-10-06 03:09:58 +0000
commit1d273166064c5163a1ca2be9a8e65cb628fc3524 (patch)
tree1471372d3bfb657f1e6820d0bc5aa13e33d13684 /lldb/source/API/SBFunction.cpp
parent32c4085ba2d259ff9a4365b1962362248de2c655 (diff)
downloadbcm5719-llvm-1d273166064c5163a1ca2be9a8e65cb628fc3524.tar.gz
bcm5719-llvm-1d273166064c5163a1ca2be9a8e65cb628fc3524.zip
Added the ability to get the disassembly instructions from the function and
symbol. llvm-svn: 115734
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