Add verification for DW_AT_decl_file and DW_AT_call_file.
authorGreg Clayton <gclayton@fb.com>
Wed, 29 Jul 2020 01:26:24 +0000 (18:26 -0700)
committerGreg Clayton <gclayton@fb.com>
Wed, 5 Aug 2020 22:30:13 +0000 (15:30 -0700)
commite1de85f9f4dae68b2c83d8821515c1f5db765baa
tree849df7d290f906ed48f049dc1f5c13b37d8b6257
parent31137b87efc12b1d8cdd8307bcddb986e5c23c61
Add verification for DW_AT_decl_file and DW_AT_call_file.

LTO builds have been creating invalid DWARF and one of the errors was a file index that was out of bounds. "llvm-dwarfdump --verify" will check all file indexes for line tables already, but there are no checks for the validity of file indexes in attributes.

The verification will verify if there is a DW_AT_decl_file/DW_AT_call_file that:
- there is a line table for the compile unit
- the file index is valid
- the encoding is appropriate

Tests are added that test all of the above conditions.

Differential Revision: https://reviews.llvm.org/D84817
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes.yaml [new file with mode: 0644]
llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes_no_files.yaml [new file with mode: 0644]
llvm/test/tools/llvm-dwarfdump/X86/verify_debug_info.s
llvm/test/tools/llvm-dwarfdump/X86/verify_file_encoding.yaml [new file with mode: 0644]