[DebugInfo] Fix reading DWARFv5 type units in DWP.
authorIgor Kudrin <ikudrin@accesssoftek.com>
Mon, 6 Apr 2020 14:29:22 +0000 (21:29 +0700)
committerIgor Kudrin <ikudrin@accesssoftek.com>
Wed, 8 Apr 2020 05:50:58 +0000 (12:50 +0700)
commitaf11c556dbcee06b4511a6c5761f4cbd543d0047
tree5bae5116d1e3ef1b1bd429c27490e842185e28a2
parent0bc2eab6f5cd522eb83b2b862ce8a2651c97ee59
[DebugInfo] Fix reading DWARFv5 type units in DWP.

In DWARFv5, type units are stored in .debug_info sections, along with
compilation units, and they are distinguished by the unit_type field
in the header, not by the name of the section. It is impossible to
associate the correct index section of a DWP file with the unit before
the unit's header is read. This patch fixes reading DWARFv5 type units
by parsing the header first and then applying the index entry according
to the actual unit type.

Differential Revision: https://reviews.llvm.org/D77552
llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
llvm/test/DebugInfo/X86/dwp-v5-tu.s [new file with mode: 0644]
llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp