diff options
author | Greg Clayton <gclayton@apple.com> | 2010-06-30 23:03:03 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2010-06-30 23:03:03 +0000 |
commit | dda4f7b520827fb1cce38dbef9a00758067df99a (patch) | |
tree | 622c1e19dfdda4764cb606030d83e030c22a92e0 /lldb/source/Core/Section.cpp | |
parent | 56f2e34a6a0810f28fa4d7ab171a9e12415e29a3 (diff) | |
download | bcm5719-llvm-dda4f7b520827fb1cce38dbef9a00758067df99a.tar.gz bcm5719-llvm-dda4f7b520827fb1cce38dbef9a00758067df99a.zip |
Centralized all disassembly into static functions in source/Core/Disassembler.cpp.
Added the ability to read memory from the target's object files when we aren't
running, so disassembling works before you run!
Cleaned up the API to lldb_private::Target::ReadMemory().
Cleaned up the API to the Disassembler to use actual "lldb_private::Address"
objects instead of just an "addr_t". This is nice because the Address objects
when resolved carry along their section and module which can get us the
object file. This allows Target::ReadMemory to be used when we are not
running.
Added a new lldb_private::Address dump style: DumpStyleDetailedSymbolContext
This will show a full breakdown of what an address points to. To see some
sample output, execute a "image lookup --address <addr>".
Fixed SymbolContext::DumpStopContext(...) to not require a live process in
order to be able to print function and symbol offsets.
llvm-svn: 107350
Diffstat (limited to 'lldb/source/Core/Section.cpp')
-rw-r--r-- | lldb/source/Core/Section.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp index 6ed47730c6f..89549f002ab 100644 --- a/lldb/source/Core/Section.cpp +++ b/lldb/source/Core/Section.cpp @@ -323,6 +323,22 @@ Section::GetSectionDataFromImage (const DataExtractor& image_data, DataExtractor return false; } +size_t +Section::ReadSectionDataFromObjectFile (const ObjectFile* objfile, off_t section_offset, void *dst, size_t dst_len) const +{ + if (objfile && dst && dst_len) + { + const FileSpec& file = objfile->GetFileSpec(); + + if (file) + { + off_t section_file_offset = GetFileOffset() + objfile->GetOffset() + section_offset; + return file.ReadFileContents (section_file_offset, dst, dst_len); + } + } + return 0; +} + //---------------------------------------------------------------------- // Get the section data the file on disk //---------------------------------------------------------------------- @@ -340,11 +356,11 @@ Section::ReadSectionDataFromObjectFile(const ObjectFile* objfile, DataExtractor& if (section_file_size > 0) { off_t section_file_offset = GetFileOffset() + objfile->GetOffset(); - DataBufferSP sectionDataSP(file.ReadFileContents(section_file_offset, section_file_size)); + DataBufferSP section_data_sp(file.ReadFileContents(section_file_offset, section_file_size)); section_data.SetByteOrder(objfile->GetByteOrder()); section_data.SetAddressByteSize(objfile->GetAddressByteSize()); - return section_data.SetData (sectionDataSP); + return section_data.SetData (section_data_sp); } } return 0; @@ -364,10 +380,10 @@ Section::MemoryMapSectionDataFromObjectFile(const ObjectFile* objfile, DataExtra if (section_file_size > 0) { off_t section_file_offset = GetFileOffset() + objfile->GetOffset(); - DataBufferSP sectionDataSP(file.MemoryMapFileContents(section_file_offset, section_file_size)); + DataBufferSP section_data_sp(file.MemoryMapFileContents(section_file_offset, section_file_size)); section_data.SetByteOrder(objfile->GetByteOrder()); section_data.SetAddressByteSize(objfile->GetAddressByteSize()); - return section_data.SetData (sectionDataSP); + return section_data.SetData (section_data_sp); } } return 0; |