DWARFVerifier: fix remaining tests and compact/rephrase the output

This commit is contained in:
David Blaikie 2021-12-29 14:47:43 -08:00
parent 6edc38935a
commit 09f43c107f
16 changed files with 21 additions and 7 deletions

View File

@ -322,10 +322,12 @@ unsigned DWARFVerifier::verifyUnits(const DWARFUnitVector &Units) {
unsigned NumDebugInfoErrors = 0;
ReferenceMap CrossUnitReferences;
unsigned int Index = 0;
unsigned int Index = 1;
for (const auto &Unit : Units) {
OS << "Verifying unit: " << Index << " / " << Units.getNumUnits() << '\n';
OS << "Unit Name: " << Unit->getUnitDIE(true).getShortName() << '\n';
OS << "Verifying unit: " << Index << " / " << Units.getNumUnits();
if (const char* Name = Unit->getUnitDIE(true).getShortName())
OS << ", \"" << Name << '\"';
OS << '\n';
OS.flush();
ReferenceMap UnitLocalReferences;
NumDebugInfoErrors +=

View File

@ -5,10 +5,8 @@
# CHECK-NEXT: Verifying .debug_info Unit Header Chain...
# CHECK-NEXT: Verifying .debug_types Unit Header Chain...
# CHECK-NEXT: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 0 / 2
# CHECK-NEXT: Unit Name: test.cpp
# CHECK-NEXT: Verifying unit: 1 / 2
# CHECK-NEXT: Unit Name:
# CHECK-NEXT: Verifying unit: 1 / 2, "test.cpp"
# CHECK-NEXT: Verifying unit: 2 / 2
# CHECK-NEXT: warning: DW_TAG_skeleton_unit has DW_CHILDREN_yes but DIE has no children
# CHECK-NEXT: DW_TAG_skeleton_unit
# CHECK-NEXT: error: Skeleton compilation unit has children.

View File

@ -2,6 +2,7 @@
# RUN: not llvm-dwarfdump -verify %t.o | FileCheck %s
# CHECK: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 1 / 1, "/tmp/main.c"
# CHECK-NEXT: error: DIE address ranges are not contained in its parent's ranges:
--- !ELF

View File

@ -46,6 +46,7 @@
# CHECK-NEXT: DW_AT_decl_file [DW_FORM_data1] (0x01)
# CHECK-NEXT: DW_AT_decl_line [DW_FORM_data1] (2)
# CHECK-NEXT: DW_AT_use_location [DW_FORM_ref4] (cu + 0x0053 => {0x00000053}){{[[:space:]]}}
# CHECK-NEXT: Verifying unit: 2 / 2
# CHECK-NEXT: error: Compilation unit root DIE is not a unit DIE: DW_TAG_null.
# CHECK-NEXT: error: Compilation unit type (DW_UT_compile) and root DIE (DW_TAG_null) do not match.

View File

@ -2,6 +2,7 @@
# RUN: not llvm-dwarfdump -verify %t.o | FileCheck %s
# CHECK: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 1 / 1
# CHECK-NEXT: error: Invalid address range [0x0000000000000007, 0x0000000000000006)
--- !ELF

View File

@ -2,6 +2,7 @@
# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
# CHECK: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 1 / 1, "/tmp/main.c"
# CHECK-NEXT: error: DW_FORM_ref4 CU offset 0x00001234 is invalid (must be less than CU size of 0x0000001a):
--- !ELF

View File

@ -2,6 +2,7 @@
# RUN: not llvm-dwarfdump -verify %t.o | FileCheck %s
# CHECK: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 1 / 1, "/tmp/main.c"
# CHECK-NEXT: error: Invalid address range
--- !ELF

View File

@ -2,6 +2,7 @@
# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
# CHECK: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 1 / 1, "/tmp/main.c"
# CHECK-NEXT: error: DW_AT_ranges offset is beyond .debug_ranges bounds: 0x00001000
--- !ELF

View File

@ -2,6 +2,7 @@
# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
# CHECK: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 1 / 1, "/tmp/main.c"
# CHECK-NEXT: error: DW_FORM_ref_addr offset beyond .debug_info bounds:
--- !ELF

View File

@ -2,6 +2,7 @@
# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
# CHECK: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 1 / 1, "/tmp/main.c"
# CHECK-NEXT: error: invalid DIE reference 0x00000011. Offset is in between DIEs:
--- !ELF

View File

@ -2,6 +2,7 @@
# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
# CHECK: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 1 / 1, "/tmp/main.c"
# CHECK-NEXT: error: DW_AT_ranges offset is beyond .debug_rnglists bounds: 0x00001000
--- !ELF

View File

@ -2,6 +2,7 @@
# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
# CHECK: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 1 / 1, "/tmp/main.c"
# CHECK-NEXT: error: DW_AT_stmt_list offset is beyond .debug_line bounds: 0x00001000
--- !ELF

View File

@ -2,6 +2,7 @@
# RUN: not llvm-dwarfdump -debug-info -verify %t.o | FileCheck %s
# CHECK: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 1 / 1
# CHECK-NEXT: error: DW_FORM_strp offset 4660 is beyond .debug_str bounds:
--- !ELF

View File

@ -2,6 +2,7 @@
# RUN: not llvm-dwarfdump -verify %t.o | FileCheck %s
# CHECK: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 1 / 1, "/tmp/main.c"
# CHECK-NEXT: error: DIE address ranges are not contained in its parent's ranges:
--- !ELF

View File

@ -2,6 +2,7 @@
# RUN: not llvm-dwarfdump -verify %t.o | FileCheck %s
# CHECK: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 1 / 1, "/tmp/main.c"
# CHECK-NEXT: error: DIEs have overlapping address ranges
--- !ELF

View File

@ -2,6 +2,7 @@
# RUN: not llvm-dwarfdump -verify %t.o | FileCheck %s
# CHECK: Verifying non-dwo Units...
# CHECK-NEXT: Verifying unit: 1 / 1, "/tmp/main.c"
# CHECK-NEXT: error: DIEs have overlapping address ranges
--- !ELF