[llvm-dwp] Skip type unit debug info sections
authorKim-Anh Tran <kimanh@chromium.org>
Wed, 2 Jun 2021 18:48:02 +0000 (11:48 -0700)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 2 Jun 2021 18:48:10 +0000 (11:48 -0700)
commit595b1683b79be089c3f72e7b3dcee4d1a9f6327b
tree00371a9dc3246fd9f51906a79e01e2371bb5b1f6
parent70804f2a2f7b87227a873cd6d8852ad295068e79
[llvm-dwp] Skip type unit debug info sections

This patch makes llvm-dwp skip debug info sections that may not be encoding a compile unit.
In DWARF5, debug info sections are also used for type units. As in preparation to support type units,
make llvm-dwp aware of other uses of debug info sections but skip them for now.

The patch first records all .debug_info sections, then goes through them one by one and records
the cu debug info section for writing the index unit, and copies that section to the final dwp output
info section. If it's not a compile unit, skip.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D102312
llvm/test/tools/llvm-dwp/X86/cu_and_tu_info_section_v5.s [new file with mode: 0644]
llvm/test/tools/llvm-dwp/X86/invalid_cu_header_length.s
llvm/test/tools/llvm-dwp/X86/invalid_tu_header_length.s [new file with mode: 0644]
llvm/test/tools/llvm-dwp/X86/multiple_debug_info_sections_in_dwp.s [new file with mode: 0644]
llvm/test/tools/llvm-dwp/X86/no_cu_found.s [moved from llvm/test/tools/llvm-dwp/X86/wrong-unit-type-info-v5.s with 89% similarity]
llvm/test/tools/llvm-dwp/X86/wrong-unit-type-info-v4.s [new file with mode: 0644]
llvm/tools/llvm-dwp/llvm-dwp.cpp