diff options
author | Greg Clayton <gclayton@apple.com> | 2010-10-06 03:09:58 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-10-06 03:09:58 +0000 |
commit | 1d273166064c5163a1ca2be9a8e65cb628fc3524 (patch) | |
tree | 1471372d3bfb657f1e6820d0bc5aa13e33d13684 /lldb/source/API/SBSymbol.cpp | |
parent | 32c4085ba2d259ff9a4365b1962362248de2c655 (diff) | |
download | bcm5719-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/SBSymbol.cpp')
-rw-r--r-- | lldb/source/API/SBSymbol.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/lldb/source/API/SBSymbol.cpp b/lldb/source/API/SBSymbol.cpp index 017df4394ca..eed84d5c608 100644 --- a/lldb/source/API/SBSymbol.cpp +++ b/lldb/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 @@ SBSymbol::GetDescription (SBStream &description) 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; +} + |