summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Module.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-07-12 22:07:46 +0000
committerGreg Clayton <gclayton@apple.com>2013-07-12 22:07:46 +0000
commit2540a8a7bc063c4f5236578a5c93f1f5c46a138f (patch)
tree6e7cc6578129eb1cfbd8f820cd791a3416e68279 /lldb/source/Core/Module.cpp
parentc6036aa83127c50162735e8a343623f03a3211fb (diff)
downloadbcm5719-llvm-2540a8a7bc063c4f5236578a5c93f1f5c46a138f.tar.gz
bcm5719-llvm-2540a8a7bc063c4f5236578a5c93f1f5c46a138f.zip
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
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r--lldb/source/Core/Module.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index f8e2f8871cb..f8e5b4e410c 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1097,23 +1097,27 @@ Module::GetObjectFile()
Mutex::Locker locker (m_mutex);
if (m_did_load_objfile == false)
{
- m_did_load_objfile = true;
Timer scoped_timer(__PRETTY_FUNCTION__,
"Module::GetObjectFile () module = %s", GetFileSpec().GetFilename().AsCString(""));
DataBufferSP data_sp;
lldb::offset_t data_offset = 0;
- m_objfile_sp = ObjectFile::FindPlugin (shared_from_this(),
- &m_file,
- m_object_offset,
- m_file.GetByteSize(),
- data_sp,
- data_offset);
- if (m_objfile_sp)
+ const lldb::offset_t file_size = m_file.GetByteSize();
+ if (file_size > m_object_offset)
{
- // Once we get the object file, update our module with the object file's
- // architecture since it might differ in vendor/os if some parts were
- // unknown.
- m_objfile_sp->GetArchitecture (m_arch);
+ m_did_load_objfile = true;
+ m_objfile_sp = ObjectFile::FindPlugin (shared_from_this(),
+ &m_file,
+ m_object_offset,
+ file_size - m_object_offset,
+ data_sp,
+ data_offset);
+ if (m_objfile_sp)
+ {
+ // Once we get the object file, update our module with the object file's
+ // architecture since it might differ in vendor/os if some parts were
+ // unknown.
+ m_objfile_sp->GetArchitecture (m_arch);
+ }
}
}
return m_objfile_sp.get();
OpenPOWER on IntegriCloud