[Lldb-commits] [lldb] r201214 - Fix elf core file VMA-contiguous region collapsing.
Todd Fiala
tfiala at google.com
Tue Feb 11 23:29:44 PST 2014
Author: tfiala
Date: Wed Feb 12 01:29:44 2014
New Revision: 201214
URL: http://llvm.org/viewvc/llvm-project?rev=201214&view=rev
Log:
Fix elf core file VMA-contiguous region collapsing.
Elf core files were collapsing core segments when the virtual memory
addresses were contiguous without checking if the core-file-backed
memory region was the same size as the segment's VMA region. Without
this extra check, any time regions were collapsed but the core-backed
region was smaller (and thus had a zero-filled hole at the end), the
collapse operation would break VMA to core file lookups for subsequent
collapsed regions.
This change fixes the following bug:
http://llvm.org/bugs/show_bug.cgi?id=18769
Modified:
lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
Modified: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp?rev=201214&r1=201213&r2=201214&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Wed Feb 12 01:29:44 2014
@@ -131,7 +131,8 @@ ProcessElfCore::AddAddressRangeFromLoadS
VMRangeToFileOffset::Entry *last_entry = m_core_aranges.Back();
if (last_entry &&
last_entry->GetRangeEnd() == range_entry.GetRangeBase() &&
- last_entry->data.GetRangeEnd() == range_entry.data.GetRangeBase())
+ last_entry->data.GetRangeEnd() == range_entry.data.GetRangeBase() &&
+ last_entry->GetByteSize() == last_entry->data.GetByteSize())
{
last_entry->SetRangeEnd (range_entry.GetRangeEnd());
last_entry->data.SetRangeEnd (range_entry.data.GetRangeEnd());
@@ -294,9 +295,13 @@ ProcessElfCore::DoReadMemory (lldb::addr
size_t zero_fill_size = 0; // Padding
lldb::addr_t bytes_left = 0; // Number of bytes available in the core file from the given address
- if (file_end > offset)
- bytes_left = file_end - offset;
+ // Figure out how many on-disk bytes remain in this segment
+ // starting at the given offset
+ if (file_end > file_start + offset)
+ bytes_left = file_end - (file_start + offset);
+ // Figure out how many bytes we need to zero-fill if we are
+ // reading more bytes than available in the on-disk segment
if (bytes_to_read > bytes_left)
{
zero_fill_size = bytes_to_read - bytes_left;
More information about the lldb-commits
mailing list