diff options
author | Greg Clayton <gclayton@apple.com> | 2015-02-23 23:47:09 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2015-02-23 23:47:09 +0000 |
commit | 736888c84b51c7cf1f8eccea6738ad54503c2d0a (patch) | |
tree | e3d33c87985a4395053a078f387abea669744315 /lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | |
parent | 18c243b933740506b3262e56ef6f9a3a6e4afc08 (diff) | |
download | bcm5719-llvm-736888c84b51c7cf1f8eccea6738ad54503c2d0a.tar.gz bcm5719-llvm-736888c84b51c7cf1f8eccea6738ad54503c2d0a.zip |
Avoid crashing by not mmap'ing files on network mounted file systems.
This is implemented by making a new FileSystem function:
bool
FileSystem::IsLocal(const FileSpec &spec)
Then using this in a new function:
DataBufferSP
FileSpec::MemoryMapFileContentsIfLocal(off_t file_offset, size_t file_size) const;
This function only mmaps data if the file is a local file since that means we can reliably page in data. We were experiencing crashes where people would use debug info files on network mounted file systems and that mount would go away and cause the next access to a page that wasn't paged in to crash LLDB.
We now avoid this by just copying the data into a heap buffer and keeping a permanent copy to avoid the crash. Updated all previous users of FileSpec::MemoryMapFileContentsIfLocal() in ObjectFile subclasses over to use the new FileSpec::MemoryMapFileContentsIfLocal() function.
<rdar://problem/19470249>
llvm-svn: 230283
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 6defd643a43..5f7935e1275 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -76,7 +76,7 @@ ObjectFilePECOFF::CreateInstance (const lldb::ModuleSP &module_sp, { if (!data_sp) { - data_sp = file->MemoryMapFileContents(file_offset, length); + data_sp = file->MemoryMapFileContentsIfLocal(file_offset, length); data_offset = 0; } @@ -84,7 +84,7 @@ ObjectFilePECOFF::CreateInstance (const lldb::ModuleSP &module_sp, { // Update the data to contain the entire file if it doesn't already if (data_sp->GetByteSize() < length) - data_sp = file->MemoryMapFileContents(file_offset, length); + data_sp = file->MemoryMapFileContentsIfLocal(file_offset, length); std::unique_ptr<ObjectFile> objfile_ap(new ObjectFilePECOFF (module_sp, data_sp, data_offset, file, file_offset, length)); if (objfile_ap.get() && objfile_ap->ParseHeader()) return objfile_ap.release(); |