Added "target variable" command that allows introspection of global
variables prior to running your binary. Zero filled sections now get
section data correctly filled with zeroes when Target::ReadMemory
reads from the object file section data.

Added new option groups and option values for file lists. I still need
to hook up all of the options to "target variable" to allow more complete
introspection by file and shlib.

Added the ability for ValueObjectVariable objects to be created with
only the target as the execution context. This allows them to be read
from the object files through Target::ReadMemory(...). 

Added a "virtual Module * GetModule()" function to the ValueObject
class. By default it will look to the parent variable object and
return its module. The module is needed when we have global variables
that have file addresses (virtual addresses that are specific to
module object files) and in turn allows global variables to be displayed
prior to running.

Removed all of the unused proxy object support that bit rotted in 
lldb_private::Value.

Replaced a lot of places that used "FileSpec::Compare (lhs, rhs) == 0" code
with the more efficient "FileSpec::Equal (lhs, rhs)".

Improved logging in GDB remote plug-in.

llvm-svn: 134579
diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp
index 0765c54..f32c72b 100644
--- a/lldb/source/Core/Section.cpp
+++ b/lldb/source/Core/Section.cpp
@@ -331,8 +331,25 @@
 
         if (file)
         {
-            off_t section_file_offset = GetFileOffset() + objfile->GetOffset() + section_offset;        
-            return file.ReadFileContents (section_file_offset, dst, dst_len);
+            size_t bytes_left = dst_len;
+            size_t bytes_read = 0;
+            const uint64_t file_size = GetFileSize();
+            if (section_offset < file_size)
+            {
+                off_t section_file_offset = objfile->GetOffset() + GetFileOffset() + section_offset;
+                bytes_read = file.ReadFileContents (section_file_offset, dst, dst_len);
+                if (bytes_read >= dst_len)
+                    return bytes_read;
+                bytes_left -= bytes_read;
+            }
+            
+            const uint64_t byte_size = GetByteSize();
+            if (section_offset + bytes_read < byte_size)
+            {
+                memset ((uint8_t*)dst + bytes_read, 0, bytes_left);
+                bytes_read += bytes_left;
+            }
+            return bytes_read;
         }
     }
     return 0;