From 2540a8a7bc063c4f5236578a5c93f1f5c46a138f Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Fri, 12 Jul 2013 22:07:46 +0000 Subject: Fixed GetModuleSpecifications() to work better overall: - MachO files now correctly extract the UUID all the time - More file size and offset verification done for universal mach-o files to watch for truncated files - ObjectContainerBSDArchive now supports enumerating all objects in BSD archives (.a files) - lldb_private::Module() can not be properly constructed using a ModuleSpec for a .o file in a .a file - The BSD archive plug-in shares its cache for GetModuleSpecifications() and the create callback - Improved printing for ModuleSpec objects llvm-svn: 186211 --- .../Universal-Mach-O/ObjectContainerUniversalMachO.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp') diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp index f28aa3bed05..976d7bf47ed 100644 --- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp +++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp @@ -278,13 +278,13 @@ ObjectContainerUniversalMachO::GetModuleSpecifications (const lldb_private::File lldb::DataBufferSP& data_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, - lldb::offset_t length, + lldb::offset_t file_size, lldb_private::ModuleSpecList &specs) { const size_t initial_count = specs.GetSize(); DataExtractor data; - data.SetData (data_sp, data_offset, length); + data.SetData (data_sp, data_offset, data_sp->GetByteSize()); if (ObjectContainerUniversalMachO::MagicBytesMatch(data)) { @@ -294,9 +294,14 @@ ObjectContainerUniversalMachO::GetModuleSpecifications (const lldb_private::File { for (const llvm::MachO::fat_arch &fat_arch : fat_archs) { - ObjectFile::GetModuleSpecifications (file, - fat_arch.offset + file_offset, - specs); + const lldb::offset_t slice_file_offset = fat_arch.offset + file_offset; + if (fat_arch.offset < file_size && file_size > slice_file_offset) + { + ObjectFile::GetModuleSpecifications (file, + slice_file_offset, + file_size - slice_file_offset, + specs); + } } } } -- cgit v1.2.3