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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 16:10:48 PDT 2017


On Tue, Jul 11, 2017 at 4:04 PM, Reid Kleckner <rnk at google.com> wrote:

> 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.
>

The error message is a bit confusing, isn't it? It says "ignoring" but what
it does is to abort immediately.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170711/98e642fa/attachment.html>


More information about the llvm-commits mailing list