Fix crash after looking up dwo_id=0 in CU index.
authorJorge Gorbe Moya <jgorbe@google.com>
Thu, 19 Nov 2020 18:59:08 +0000 (10:59 -0800)
committerJorge Gorbe Moya <jgorbe@google.com>
Thu, 19 Nov 2020 19:15:01 +0000 (11:15 -0800)
commit314a0d73a8444e3b0c1a0d0de7d615d9448af1c9
treee34933b5c7f55bd9e5a7800cdd2d81f904119d7f
parentad5a195ae510fbfaf7885549e4899c85f0593fa5
Fix crash after looking up dwo_id=0 in CU index.

In the current state, if getFromHash(0) is called and there's no CU with
dwo_id=0, the lookup will stop at an empty slot, then the check
`Rows[H].getSignature() != S` won't cause the lookup to fail and return
a nullptr (as it should), because the empty slot has a 0 in the
signature field, and a pointer to the empty slot will be incorrectly
returned.

This patch fixes this by using the index field in the hash entry to
check for empty slots: signature = 0 can match a valid hash but
according to the spec the index for an occupied slot will always be
non-zero.

Differential Revision: https://reviews.llvm.org/D91670
llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
llvm/test/tools/llvm-symbolizer/split-dwarf-zero-signature-not-found.s [new file with mode: 0644]