mirror of
https://github.com/intel/llvm.git
synced 2026-01-17 06:40:01 +08:00
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
This commit is contained in:
@@ -331,8 +331,25 @@ Section::ReadSectionDataFromObjectFile (const ObjectFile* objfile, off_t section
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user