diff options
author | Greg Clayton <gclayton@apple.com> | 2013-01-25 18:06:21 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-01-25 18:06:21 +0000 |
commit | c7bece56faa5eef1c3d141d0c0b0b68b28a9aed2 (patch) | |
tree | 9a0132fc3b0bb4f38d06a0f352ee75ac57994771 /lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | |
parent | d0ed6c249dbd6bd488b6491b536a387548c00f7e (diff) | |
download | bcm5719-llvm-c7bece56faa5eef1c3d141d0c0b0b68b28a9aed2.tar.gz bcm5719-llvm-c7bece56faa5eef1c3d141d0c0b0b68b28a9aed2.zip |
<rdar://problem/13069948>
Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary.
So I defined a new "lldb::offset_t" which should be used for all file offsets.
After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed.
Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections.
llvm-svn: 173463
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 8447a88d1dc..6bfe69503e9 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -169,7 +169,7 @@ bool ObjectFilePECOFF::MagicBytesMatch (DataBufferSP& dataSP) { DataExtractor data(dataSP, eByteOrderLittle, 4); - uint32_t offset = 0; + lldb::offset_t offset = 0; uint16_t magic = data.GetU16 (&offset); return magic == IMAGE_DOS_SIGNATURE; } @@ -206,7 +206,7 @@ ObjectFilePECOFF::ParseHeader () lldb_private::Mutex::Locker locker(module_sp->GetMutex()); m_sect_headers.clear(); m_data.SetByteOrder (eByteOrderLittle); - uint32_t offset = 0; + lldb::offset_t offset = 0; if (ParseDOSHeader()) { @@ -239,7 +239,7 @@ ObjectFilePECOFF::IsExecutable() const return (m_coff_header.flags & IMAGE_FILE_DLL) == 0; } -size_t +uint32_t ObjectFilePECOFF::GetAddressByteSize () const { if (m_coff_header_opt.magic == OPT_HEADER_MAGIC_PE32_PLUS) @@ -271,7 +271,7 @@ bool ObjectFilePECOFF::ParseDOSHeader () { bool success = false; - uint32_t offset = 0; + lldb::offset_t offset = 0; success = m_data.ValidOffsetForDataOfSize(0, sizeof(m_dos_header)); if (success) @@ -326,7 +326,7 @@ ObjectFilePECOFF::ParseDOSHeader () // ParserCOFFHeader //---------------------------------------------------------------------- bool -ObjectFilePECOFF::ParseCOFFHeader(uint32_t* offset_ptr) +ObjectFilePECOFF::ParseCOFFHeader(lldb::offset_t *offset_ptr) { bool success = m_data.ValidOffsetForDataOfSize (*offset_ptr, sizeof(m_coff_header)); if (success) @@ -345,10 +345,10 @@ ObjectFilePECOFF::ParseCOFFHeader(uint32_t* offset_ptr) } bool -ObjectFilePECOFF::ParseCOFFOptionalHeader(uint32_t* offset_ptr) +ObjectFilePECOFF::ParseCOFFOptionalHeader(lldb::offset_t *offset_ptr) { bool success = false; - const uint32_t end_offset = *offset_ptr + m_coff_header.hdrsize; + const lldb::offset_t end_offset = *offset_ptr + m_coff_header.hdrsize; if (*offset_ptr < end_offset) { success = true; @@ -429,7 +429,7 @@ ObjectFilePECOFF::ParseSectionHeaders (uint32_t section_header_data_offset) DataBufferSP section_header_data_sp(m_file.ReadFileContents (section_header_data_offset, section_header_byte_size)); DataExtractor section_header_data (section_header_data_sp, GetByteOrder(), addr_byte_size); - uint32_t offset = 0; + lldb::offset_t offset = 0; if (section_header_data.ValidOffsetForDataOfSize (offset, section_header_byte_size)) { m_sect_headers.resize(nsects); @@ -462,8 +462,8 @@ ObjectFilePECOFF::GetSectionName(std::string& sect_name, const section_header_t& { if (sect.name[0] == '/') { - uint32_t stroff = strtoul(§.name[1], NULL, 10); - uint32_t string_file_offset = m_coff_header.symoff + (m_coff_header.nsyms * 18) + stroff; + lldb::offset_t stroff = strtoul(§.name[1], NULL, 10); + lldb::offset_t string_file_offset = m_coff_header.symoff + (m_coff_header.nsyms * 18) + stroff; const char *name = m_data.GetCStr (&string_file_offset); if (name) { @@ -503,7 +503,7 @@ ObjectFilePECOFF::GetSymtab() // Include the 4 bytes string table size at the end of the symbols DataBufferSP symtab_data_sp(m_file.ReadFileContents (m_coff_header.symoff, symbol_data_size + 4)); DataExtractor symtab_data (symtab_data_sp, GetByteOrder(), addr_byte_size); - uint32_t offset = symbol_data_size; + lldb::offset_t offset = symbol_data_size; const uint32_t strtab_size = symtab_data.GetU32 (&offset); DataBufferSP strtab_data_sp(m_file.ReadFileContents (m_coff_header.symoff + symbol_data_size + 4, strtab_size)); DataExtractor strtab_data (strtab_data_sp, GetByteOrder(), addr_byte_size); |