summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2013-01-04 23:20:01 +0000
committerSean Callanan <scallanan@apple.com>2013-01-04 23:20:01 +0000
commitecda2b2df76b618037a9767e850a8d88dd86867a (patch)
tree55a7ff0a32c5118b54d3455ababd0dd0ae0e1a5d
parentef7f968e09018e15d5012181e92f687d48e0d1a5 (diff)
downloadbcm5719-llvm-ecda2b2df76b618037a9767e850a8d88dd86867a.tar.gz
bcm5719-llvm-ecda2b2df76b618037a9767e850a8d88dd86867a.zip
Read bytes from zero-filled sections correctly
instead of failing to read. <rdar://problem/12958589> llvm-svn: 171552
-rw-r--r--lldb/source/Symbol/ObjectFile.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index 6e4ee9b58bf..2388c6df400 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -378,6 +378,19 @@ ObjectFile::ReadSectionData (const Section *section, off_t section_offset, void
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;
}
OpenPOWER on IntegriCloud