From 866dcdacfe59f5f448e008fe2c4cb9dfcf72b2ec Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Tue, 18 Feb 2014 16:23:10 +0000 Subject: Import lldb as of SVN r201577 (git 2bdc2f6) (A number of files not required for the FreeBSD build have been removed.) Sponsored by: DARPA, AFRL --- source/Symbol/Symbol.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'source/Symbol/Symbol.cpp') diff --git a/source/Symbol/Symbol.cpp b/source/Symbol/Symbol.cpp index a881b6f310123..6311a329739e3 100644 --- a/source/Symbol/Symbol.cpp +++ b/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; +} -- cgit v1.3