diff options
| author | Greg Clayton <gclayton@apple.com> | 2014-01-27 23:43:24 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2014-01-27 23:43:24 +0000 |
| commit | 44d937820b451296f80449ac3de296345e80f183 (patch) | |
| tree | 00d14538eded9f7e8bd075128d6ad5fd5ac1caed /lldb/source/Symbol | |
| parent | f1cb16e481a60dbac58affcf8c8e423dac3937cb (diff) | |
| download | bcm5719-llvm-44d937820b451296f80449ac3de296345e80f183.tar.gz bcm5719-llvm-44d937820b451296f80449ac3de296345e80f183.zip | |
Merging the iohandler branch back into main.
The many many benefits include:
1 - Input/Output/Error streams are now handled as real streams not a push style input
2 - auto completion in python embedded interpreter
3 - multi-line input for "script" and "expression" commands now allow you to edit previous/next lines using up and down arrow keys and this makes multi-line input actually a viable thing to use
4 - it is now possible to use curses to drive LLDB (please try the "gui" command)
We will need to deal with and fix any buildbot failures and tests and arise now that input/output and error are correctly hooked up in all cases.
llvm-svn: 200263
Diffstat (limited to 'lldb/source/Symbol')
| -rw-r--r-- | lldb/source/Symbol/ClangASTType.cpp | 1 | ||||
| -rw-r--r-- | lldb/source/Symbol/Function.cpp | 38 | ||||
| -rw-r--r-- | lldb/source/Symbol/Symbol.cpp | 37 |
3 files changed, 76 insertions, 0 deletions
diff --git a/lldb/source/Symbol/ClangASTType.cpp b/lldb/source/Symbol/ClangASTType.cpp index 47bc6829522..40f6462ee36 100644 --- a/lldb/source/Symbol/ClangASTType.cpp +++ b/lldb/source/Symbol/ClangASTType.cpp @@ -38,6 +38,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Scalar.h" #include "lldb/Core/Stream.h" +#include "lldb/Core/StreamFile.h" #include "lldb/Core/StreamString.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/ClangExternalASTSourceCommon.h" diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp index 31334a6df8d..e6d6c000bc9 100644 --- a/lldb/source/Symbol/Function.cpp +++ b/lldb/source/Symbol/Function.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Symbol/Function.h" +#include "lldb/Core/Disassembler.h" #include "lldb/Core/Module.h" #include "lldb/Core/Section.h" #include "lldb/Host/Host.h" @@ -404,6 +405,43 @@ Function::CalculateSymbolContextFunction () return this; } +lldb::DisassemblerSP +Function::GetInstructions (const ExecutionContext &exe_ctx, + const char *flavor, + bool prefer_file_cache) +{ + ModuleSP module_sp (GetAddressRange().GetBaseAddress().GetModule()); + if (module_sp) + { + const bool prefer_file_cache = false; + return Disassembler::DisassembleRange (module_sp->GetArchitecture(), + NULL, + flavor, + exe_ctx, + GetAddressRange(), + prefer_file_cache); + } + return lldb::DisassemblerSP(); +} + +bool +Function::GetDisassembly (const ExecutionContext &exe_ctx, + const char *flavor, + bool prefer_file_cache, + Stream &strm) +{ + lldb::DisassemblerSP disassembler_sp = GetInstructions (exe_ctx, flavor, prefer_file_cache); + if (disassembler_sp) + { + const bool show_address = true; + const bool show_bytes = false; + disassembler_sp->GetInstructionList().Dump (&strm, show_address, show_bytes, &exe_ctx); + return true; + } + return false; +} + + //Symbol * //Function::CalculateSymbolContextSymbol () //{ diff --git a/lldb/source/Symbol/Symbol.cpp b/lldb/source/Symbol/Symbol.cpp index a881b6f3101..6311a329739 100644 --- a/lldb/source/Symbol/Symbol.cpp +++ b/lldb/source/Symbol/Symbol.cpp @@ -580,3 +580,40 @@ Symbol::ResolveReExportedSymbol (Target &target) } return NULL; } + + +lldb::DisassemblerSP +Symbol::GetInstructions (const ExecutionContext &exe_ctx, + const char *flavor, + bool prefer_file_cache) +{ + ModuleSP module_sp (m_addr_range.GetBaseAddress().GetModule()); + if (module_sp) + { + const bool prefer_file_cache = false; + return Disassembler::DisassembleRange (module_sp->GetArchitecture(), + NULL, + flavor, + exe_ctx, + m_addr_range, + prefer_file_cache); + } + return lldb::DisassemblerSP(); +} + +bool +Symbol::GetDisassembly (const ExecutionContext &exe_ctx, + const char *flavor, + bool prefer_file_cache, + Stream &strm) +{ + lldb::DisassemblerSP disassembler_sp = GetInstructions (exe_ctx, flavor, prefer_file_cache); + if (disassembler_sp) + { + const bool show_address = true; + const bool show_bytes = false; + disassembler_sp->GetInstructionList().Dump (&strm, show_address, show_bytes, &exe_ctx); + return true; + } + return false; +} |

