[DWARFLibrary] Add support to re-construct cu-index
authorAlexander Yermolovich <ayermolo@fb.com>
Tue, 10 Jan 2023 23:14:47 +0000 (15:14 -0800)
committerAlexander Yermolovich <ayermolo@fb.com>
Tue, 10 Jan 2023 23:15:48 +0000 (15:15 -0800)
commit73712c8790a93c29e513f5e201f92ac5b2370cf9
treeb74c1ec762dc7f30f3ec2afa8f2b7ba0cf1def65
parent3531c41168e01bf1750b436036c9b9db7e8ee5d5
[DWARFLibrary] Add support to re-construct cu-index

According to DWARF5 specification and gnu specification for DWARF4 the offset
entry in the CU/TU Index is 32 bits. This presents a problem when
.debug_info.dwo in DWP file grows beyond 4GB. The CU Index becomes partially
corrupted.

This diff adds manual parsing of .debug_info.dwo/.debug_abbrev.dwo to
reconstruct CU index in general, and TU index for DWARF5. This is a work around
until DWARF6 spec is finalized.

Next patch will change internal CU/TU struct to 64 bit, and change uses as
necessary. The plan is to land all the patches in one go after all are approved.

This patch originates from the discussion in: https://discourse.llvm.org/t/dwarf-dwp-4gb-limit/63902

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D137882
llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
llvm/test/tools/llvm-dwp/X86/cu_tu_units_manual_v5.s [new file with mode: 0644]
llvm/test/tools/llvm-dwp/X86/debug_macro_v5.s
llvm/test/tools/llvm-dwp/X86/type_dedup.test
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp