<rdar://problem/13159777>
lldb was mmap'ing archive files once per .o file it loads, now it correctly shares the archive between modules.
LLDB was also always mapping entire contents of universal mach-o files, now it maps just the slice that is required.
Added a new logging channel for "lldb" called "mmap" to help track future regressions.
Modified the ObjectFile and ObjectContainer plugin interfaces to take a data offset along with the file offset and size so we can implement the correct caching and efficient reading of parts of files without mmap'ing the entire file like we used to.
The current implementation still keeps entire .a files mmaped (once) and entire slices from universal files mmaped to ensure that if a client builds their binaries during a debug session we don't lose our data and get corrupt object file info and debug info.
llvm-svn: 174524
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index e701287..9490d2e 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1004,12 +1004,14 @@
m_did_load_objfile = true;
Timer scoped_timer(__PRETTY_FUNCTION__,
"Module::GetObjectFile () module = %s", GetFileSpec().GetFilename().AsCString(""));
- DataBufferSP file_data_sp;
- m_objfile_sp = ObjectFile::FindPlugin (shared_from_this(),
+ 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(),
- file_data_sp);
+ data_sp,
+ data_offset);
if (m_objfile_sp)
{
// Once we get the object file, update our module with the object file's