<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
This commit is contained in:
Greg Clayton
2013-01-25 18:06:21 +00:00
parent d0ed6c249d
commit c7bece56fa
248 changed files with 1676 additions and 1817 deletions

View File

@@ -195,105 +195,6 @@ DNBDataRef::GetPointer(offset_t *offset_ptr) const
assert(m_ptrSize != 0);
return GetMax64(offset_ptr, m_ptrSize);
}
//----------------------------------------------------------------------
// GetDwarfEHPtr
//
// Used for calls when the value type is specified by a DWARF EH Frame
// pointer encoding.
//----------------------------------------------------------------------
/*
uint64_t
DNBDataRef::GetDwarfEHPtr(offset_t *offset_ptr, uint32_t encoding) const
{
if (encoding == DW_EH_PE_omit)
return ULLONG_MAX; // Value isn't in the buffer...
uint64_t baseAddress = 0;
uint64_t addressValue = 0;
BOOL signExtendValue = NO;
// Decode the base part or adjust our offset
switch (encoding & 0x70)
{
case DW_EH_PE_pcrel:
// SetEHPtrBaseAddresses should be called prior to extracting these
// so the base addresses are cached.
assert(m_addrPCRelative != INVALID_NUB_ADDRESS);
signExtendValue = YES;
baseAddress = *offset_ptr + m_addrPCRelative;
break;
case DW_EH_PE_textrel:
// SetEHPtrBaseAddresses should be called prior to extracting these
// so the base addresses are cached.
assert(m_addrTEXT != INVALID_NUB_ADDRESS);
signExtendValue = YES;
baseAddress = m_addrTEXT;
break;
case DW_EH_PE_datarel:
// SetEHPtrBaseAddresses should be called prior to extracting these
// so the base addresses are cached.
assert(m_addrDATA != INVALID_NUB_ADDRESS);
signExtendValue = YES;
baseAddress = m_addrDATA;
break;
case DW_EH_PE_funcrel:
signExtendValue = YES;
break;
case DW_EH_PE_aligned:
// SetPointerSize should be called prior to extracting these so the
// pointer size is cached
assert(m_ptrSize != 0);
if (m_ptrSize)
{
// Align to a address size boundary first
uint32_t alignOffset = *offset_ptr % m_ptrSize;
if (alignOffset)
offset_ptr += m_ptrSize - alignOffset;
}
break;
default:
break;
}
// Decode the value part
switch (encoding & DW_EH_PE_MASK_ENCODING)
{
case DW_EH_PE_absptr : addressValue = GetPointer(offset_ptr); break;
case DW_EH_PE_uleb128 : addressValue = Get_ULEB128(offset_ptr); break;
case DW_EH_PE_udata2 : addressValue = Get16(offset_ptr); break;
case DW_EH_PE_udata4 : addressValue = Get32(offset_ptr); break;
case DW_EH_PE_udata8 : addressValue = Get64(offset_ptr); break;
case DW_EH_PE_sleb128 : addressValue = Get_SLEB128(offset_ptr); break;
case DW_EH_PE_sdata2 : addressValue = (int16_t)Get16(offset_ptr); break;
case DW_EH_PE_sdata4 : addressValue = (int32_t)Get32(offset_ptr); break;
case DW_EH_PE_sdata8 : addressValue = (int64_t)Get64(offset_ptr); break;
default:
// Unhandled encoding type
assert(encoding);
break;
}
// Since we promote everything to 64 bit, we may need to sign extend
if (signExtendValue && m_ptrSize < sizeof(baseAddress))
{
uint64_t sign_bit = 1ull << ((m_ptrSize * 8ull) - 1ull);
if (sign_bit & addressValue)
{
uint64_t mask = ~sign_bit + 1;
addressValue |= mask;
}
}
return baseAddress + addressValue;
}
*/
//----------------------------------------------------------------------
// GetCStr
//----------------------------------------------------------------------