<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/API/SBSection.cpp b/lldb/source/API/SBSection.cpp
index 0b98ddb..3547799 100644
--- a/lldb/source/API/SBSection.cpp
+++ b/lldb/source/API/SBSection.cpp
@@ -163,7 +163,7 @@
{
ObjectFile *objfile = module_sp->GetObjectFile();
if (objfile)
- return objfile->GetOffset() + section_sp->GetFileOffset();
+ return objfile->GetFileOffset() + section_sp->GetFileOffset();
}
}
return UINT64_MAX;
@@ -200,7 +200,7 @@
ObjectFile *objfile = module_sp->GetObjectFile();
if (objfile)
{
- const uint64_t sect_file_offset = objfile->GetOffset() + section_sp->GetFileOffset();
+ const uint64_t sect_file_offset = objfile->GetFileOffset() + section_sp->GetFileOffset();
const uint64_t file_offset = sect_file_offset + offset;
uint64_t file_size = size;
if (file_size == UINT64_MAX)