[Lldb-commits] [lldb] r171552 -	/lldb/trunk/source/Symbol/ObjectFile.cpp
    Sean Callanan 
    scallanan at apple.com
       
    Fri Jan  4 15:20:01 PST 2013
    
    
  
Author: spyffe
Date: Fri Jan  4 17:20:01 2013
New Revision: 171552
URL: http://llvm.org/viewvc/llvm-project?rev=171552&view=rev
Log:
Read bytes from zero-filled sections correctly
instead of failing to read.
<rdar://problem/12958589>
Modified:
    lldb/trunk/source/Symbol/ObjectFile.cpp
Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=171552&r1=171551&r2=171552&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Fri Jan  4 17:20:01 2013
@@ -378,6 +378,19 @@
                 section_dst_len = section_bytes_left;
             return CopyData (section->GetFileOffset() + section_offset, section_dst_len, dst);
         }
+        else
+        {
+            if (section->GetType() == eSectionTypeZeroFill)
+            {
+                const uint64_t section_size = section->GetByteSize();
+                const uint64_t section_bytes_left = section_size - section_offset;
+                uint64_t section_dst_len = dst_len;
+                if (section_dst_len > section_bytes_left)
+                    section_dst_len = section_bytes_left;
+                bzero(dst, section_dst_len);
+                return section_dst_len;
+            }
+        }
     }
     return 0;
 }
    
    
More information about the lldb-commits
mailing list