[lld] r307726 - [PDB] Tweak bad type index error handling

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 16:04:27 PDT 2017


On Tue, Jul 11, 2017 at 3:42 PM, Rui Ueyama <ruiu at google.com> wrote:

> -static bool remapTypesInSymbolRecord(ObjectFile *File,
>> +static void remapTypesInSymbolRecord(ObjectFile *File,
>>                                       MutableArrayRef<uint8_t> Contents,
>>                                       ArrayRef<TypeIndex> TypeIndexMap,
>>                                       ArrayRef<TiReference> TypeRefs) {
>>    for (const TiReference &Ref : TypeRefs) {
>>      unsigned ByteSize = Ref.Count * sizeof(TypeIndex);
>> -    if (Contents.size() < Ref.Offset + ByteSize) {
>> -      log("ignoring short symbol record");
>> -      return false;
>> -    }
>> +    if (Contents.size() < Ref.Offset + ByteSize)
>> +      fatal("ignoring short symbol record");
>>
>
> If you use `fatal`, it doesn't ignore records but exits immediately.
>

This is intentional. A short record is more indicative of data corruption
than an invalid type index. An invalid type index probably means we just
can't find the PDB.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170711/f3716d4f/attachment.html>


More information about the llvm-commits mailing list