[Lldb-commits] [lldb] r179909 - Fixed being able to mmap an entire file by letting the default args "do the right thing".

Greg Clayton gclayton at apple.com
Fri Apr 19 17:23:26 PDT 2013


Author: gclayton
Date: Fri Apr 19 19:23:26 2013
New Revision: 179909

URL: http://llvm.org/viewvc/llvm-project?rev=179909&view=rev
Log:
Fixed being able to mmap an entire file by letting the default args "do the right thing".


Modified:
    lldb/trunk/source/Host/common/FileSpec.cpp

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=179909&r1=179908&r2=179909&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Fri Apr 19 19:23:26 2013
@@ -747,7 +747,8 @@ FileSpec::MemoryMapFileContents(off_t fi
     std::unique_ptr<DataBufferMemoryMap> mmap_data(new DataBufferMemoryMap());
     if (mmap_data.get())
     {
-        if (mmap_data->MemoryMapFromFileSpec (this, file_offset, file_size) >= file_size)
+        const size_t mapped_length = mmap_data->MemoryMapFromFileSpec (this, file_offset, file_size);
+        if (((file_size == SIZE_MAX) && (mapped_length > 0)) || (mapped_length >= file_size))
             data_sp.reset(mmap_data.release());
     }
     return data_sp;





More information about the lldb-commits mailing list