[llvm] 8927429 - DWARFVerifier: Verbosely dump DIEs in verifier reports
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 13 19:01:38 PST 2021
Author: David Blaikie
Date: 2021-12-13T19:00:38-08:00
New Revision: 892742907f0e18464aaf27fd29c2e16aadcf97fa
URL: https://github.com/llvm/llvm-project/commit/892742907f0e18464aaf27fd29c2e16aadcf97fa
DIFF: https://github.com/llvm/llvm-project/commit/892742907f0e18464aaf27fd29c2e16aadcf97fa.diff
LOG: DWARFVerifier: Verbosely dump DIEs in verifier reports
Seems helpful when you're dealing with invalid/problematic DWARF. Some
diagnostic messages are probably redundant with the verbose dumping and
could be simplified with this.
Added:
Modified:
llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes.yaml
llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes_no_files.yaml
llvm/test/tools/llvm-dwarfdump/X86/verify_broken_exprloc.s
llvm/test/tools/llvm-dwarfdump/X86/verify_file_encoding.yaml
llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_cu_ranges.yaml
llvm/test/tools/llvm-dwarfdump/X86/verify_parent_zero_length.yaml
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes.yaml
index 3e1e1ee2e00d..b86623dd011d 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes.yaml
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes.yaml
@@ -2,18 +2,18 @@
# CHECK: error: DIE has DW_AT_decl_file with an invalid file index 2 (valid values are [1-1]){{[[:space:]]}}
# CHECK-NEXT: 0x0000001e: DW_TAG_subprogram
-# CHECK-NEXT: DW_AT_name ("main")
-# CHECK-NEXT: DW_AT_low_pc (0x0000000000001000)
-# CHECK-NEXT: DW_AT_high_pc (0x0000000000002000)
-# CHECK-NEXT: DW_AT_decl_file (0x02)
-# CHECK-NEXT: DW_AT_call_line (5){{[[:space:]]}}
+# CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000000d] = "main")
+# CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001000)
+# CHECK-NEXT: DW_AT_high_pc [DW_FORM_addr] (0x0000000000002000)
+# CHECK-NEXT: DW_AT_decl_file [DW_FORM_data1] (0x02)
+# CHECK-NEXT: DW_AT_call_line [DW_FORM_data1] (5){{[[:space:]]}}
# CHECK-NEXT: error: DIE has DW_AT_call_file with an invalid file index 3 (valid values are [1-1]){{[[:space:]]}}
# CHECK-NEXT: 0x00000035: DW_TAG_inlined_subroutine
-# CHECK-NEXT: DW_AT_name ("inline1")
-# CHECK-NEXT: DW_AT_low_pc (0x0000000000001100)
-# CHECK-NEXT: DW_AT_high_pc (0x0000000000001200)
-# CHECK-NEXT: DW_AT_call_file (0x03)
-# CHECK-NEXT: DW_AT_call_line (10){{[[:space:]]}}
+# CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000012] = "inline1")
+# CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001100)
+# CHECK-NEXT: DW_AT_high_pc [DW_FORM_data4] (0x00000100)
+# CHECK-NEXT: DW_AT_call_file [DW_FORM_data1] (0x03)
+# CHECK-NEXT: DW_AT_call_line [DW_FORM_data1] (10){{[[:space:]]}}
# CHECK: Errors detected.
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes_no_files.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes_no_files.yaml
index bdf2fc649e20..3b56dca1bb09 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes_no_files.yaml
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes_no_files.yaml
@@ -2,18 +2,18 @@
# CHECK: error: DIE has DW_AT_decl_file with an invalid file index 2 (the file table in the prologue is empty){{[[:space:]]}}
# CHECK-NEXT: 0x0000001e: DW_TAG_subprogram
-# CHECK-NEXT: DW_AT_name ("main")
-# CHECK-NEXT: DW_AT_low_pc (0x0000000000001000)
-# CHECK-NEXT: DW_AT_high_pc (0x0000000000002000)
-# CHECK-NEXT: DW_AT_decl_file (0x02)
-# CHECK-NEXT: DW_AT_call_line (5){{[[:space:]]}}
+# CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000000d] = "main")
+# CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001000)
+# CHECK-NEXT: DW_AT_high_pc [DW_FORM_addr] (0x0000000000002000)
+# CHECK-NEXT: DW_AT_decl_file [DW_FORM_data1] (0x02)
+# CHECK-NEXT: DW_AT_call_line [DW_FORM_data1] (5){{[[:space:]]}}
# CHECK-NEXT: error: DIE has DW_AT_call_file with an invalid file index 3 (the file table in the prologue is empty){{[[:space:]]}}
# CHECK-NEXT: 0x00000035: DW_TAG_inlined_subroutine
-# CHECK-NEXT: DW_AT_name ("inline1")
-# CHECK-NEXT: DW_AT_low_pc (0x0000000000001100)
-# CHECK-NEXT: DW_AT_high_pc (0x0000000000001200)
-# CHECK-NEXT: DW_AT_call_file (0x03)
-# CHECK-NEXT: DW_AT_call_line (10){{[[:space:]]}}
+# CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000012] = "inline1")
+# CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001100)
+# CHECK-NEXT: DW_AT_high_pc [DW_FORM_data4] (0x00000100)
+# CHECK-NEXT: DW_AT_call_file [DW_FORM_data1] (0x03)
+# CHECK-NEXT: DW_AT_call_line [DW_FORM_data1] (10){{[[:space:]]}}
# CHECK: Errors detected.
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_broken_exprloc.s b/llvm/test/tools/llvm-dwarfdump/X86/verify_broken_exprloc.s
index 21a2ec530d7c..e79840109a10 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/verify_broken_exprloc.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_broken_exprloc.s
@@ -9,7 +9,7 @@
# RUN: not llvm-dwarfdump -verify %t 2>&1 | FileCheck %s --check-prefix=VERIFY
# VERIFY: DIE contains invalid DWARF expression:
# VERIFY: DW_TAG_GNU_call_site_parameter
-# VERIFY-NEXT: DW_AT_location (<decoding error> ff)
+# VERIFY-NEXT: DW_AT_location [DW_FORM_exprloc] (<decoding error> ff)
.section .debug_info,"", at progbits
.long 0x12
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_file_encoding.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_file_encoding.yaml
index 3436608160ef..f9029952cf58 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/verify_file_encoding.yaml
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_file_encoding.yaml
@@ -2,18 +2,18 @@
# CHECK: error: DIE has DW_AT_decl_file with invalid encoding{{[[:space:]]}}
# CHECK-NEXT: 0x0000001a: DW_TAG_subprogram
-# CHECK-NEXT: DW_AT_name ("main")
-# CHECK-NEXT: DW_AT_low_pc (0x0000000000001000)
-# CHECK-NEXT: DW_AT_high_pc (0x0000000000002000)
-# CHECK-NEXT: DW_AT_decl_file ("")
-# CHECK-NEXT: DW_AT_call_line (5){{[[:space:]]}}
+# CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000000d] = "main")
+# CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001000)
+# CHECK-NEXT: DW_AT_high_pc [DW_FORM_addr] (0x0000000000002000)
+# CHECK-NEXT: DW_AT_decl_file [DW_FORM_strp] ( .debug_str[0x00000012] = "")
+# CHECK-NEXT: DW_AT_call_line [DW_FORM_data1] (5){{[[:space:]]}}
# CHECK-NEXT: error: DIE has DW_AT_call_file with invalid encoding{{[[:space:]]}}
# CHECK-NEXT: 0x00000034: DW_TAG_inlined_subroutine
-# CHECK-NEXT: DW_AT_name ("inline1")
-# CHECK-NEXT: DW_AT_low_pc (0x0000000000001100)
-# CHECK-NEXT: DW_AT_high_pc (0x0000000000001200)
-# CHECK-NEXT: DW_AT_call_file ("")
-# CHECK-NEXT: DW_AT_call_line (10){{[[:space:]]}}
+# CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000013] = "inline1")
+# CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001100)
+# CHECK-NEXT: DW_AT_high_pc [DW_FORM_data4] (0x00000100)
+# CHECK-NEXT: DW_AT_call_file [DW_FORM_strp] ( .debug_str[0x00000012] = "")
+# CHECK-NEXT: DW_AT_call_line [DW_FORM_data1] (10){{[[:space:]]}}
--- !ELF
FileHeader:
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_cu_ranges.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_cu_ranges.yaml
index 200c328b4103..a40959f4d0de 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_cu_ranges.yaml
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_cu_ranges.yaml
@@ -44,10 +44,10 @@
# CHECK: error: DIE has overlapping ranges in DW_AT_ranges attribute: [0x0000000000000000, 0x0000000000000020) and [0x0000000000000000, 0x0000000000000030)
# CHECK: 0x0000000b: DW_TAG_compile_unit
-# CHECK-NEXT: DW_AT_name ("/tmp/main.c")
-# CHECK-NEXT: DW_AT_language (DW_LANG_C)
-# CHECK-NEXT: DW_AT_low_pc (0x0000000000000000)
-# CHECK-NEXT: DW_AT_ranges (0x00000000
+# CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000001] = "/tmp/main.c")
+# CHECK-NEXT: DW_AT_language [DW_FORM_data2] (DW_LANG_C)
+# CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
+# CHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
# CHECK-NEXT: [0x0000000000002000, 0x0000000000003000)
# CHECK-NEXT: [0x0000000000000000, 0x0000000000000020)
# CHECK-NEXT: [0x0000000000000000, 0x0000000000000030)
@@ -55,14 +55,14 @@
# CHECK: error: DIEs have overlapping address ranges:
# CHECK: 0x0000002f: DW_TAG_subprogram
-# CHECK-NEXT: DW_AT_name ("stripped2")
-# CHECK-NEXT: DW_AT_low_pc (0x0000000000000000)
-# CHECK-NEXT: DW_AT_high_pc (0x0000000000000030)
+# CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000017] = "stripped2")
+# CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
+# CHECK-NEXT: DW_AT_high_pc [DW_FORM_addr] (0x0000000000000030)
# CHECK: 0x0000001e: DW_TAG_subprogram
-# CHECK-NEXT: DW_AT_name ("stripped1")
-# CHECK-NEXT: DW_AT_low_pc (0x0000000000000000)
-# CHECK-NEXT: DW_AT_high_pc (0x0000000000000020)
+# CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000000d] = "stripped1")
+# CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
+# CHECK-NEXT: DW_AT_high_pc [DW_FORM_data4] (0x00000020)
--- !mach-o
FileHeader:
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_parent_zero_length.yaml b/llvm/test/tools/llvm-dwarfdump/X86/verify_parent_zero_length.yaml
index d958d0d9073f..5188ac5a6d40 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/verify_parent_zero_length.yaml
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_parent_zero_length.yaml
@@ -7,7 +7,7 @@
#
# The DWARF looks like:
# 0x0000000b: DW_TAG_compile_unit
-# DW_AT_name ("/tmp/main.c")
+# DW_AT_name [DW_FORM_strp] ("/tmp/main.c")
# DW_AT_language (DW_LANG_C)
# DW_AT_low_pc (0x0000000000000000)
# DW_AT_ranges (0x00000000
@@ -37,32 +37,32 @@
# CHECK: Verifying .debug_info Unit Header Chain...
# CHECK: error: DIE address ranges are not contained in its parent's ranges:
# CHECK: 0x0000001e: DW_TAG_subprogram
-# CHECK: DW_AT_name ("main")
-# CHECK: DW_AT_low_pc (0x0000000000000000)
-# CHECK: DW_AT_high_pc (0x0000000000000000)
+# CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000000d] = "main")
+# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
+# CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000000000)
# CHECK: 0x00000033: DW_TAG_lexical_block
-# CHECK: DW_AT_low_pc (0x0000000000001000)
-# CHECK: DW_AT_high_pc (0x0000000000002000)
+# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001000)
+# CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000002000)
# CHECK: error: DIEs have overlapping address ranges:
# CHECK: 0x00000044: DW_TAG_lexical_block
-# CHECK: DW_AT_low_pc (0x0000000000001000)
-# CHECK: DW_AT_high_pc (0x0000000000002000)
+# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001000)
+# CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000002000)
# CHECK: 0x00000033: DW_TAG_lexical_block
-# CHECK: DW_AT_low_pc (0x0000000000001000)
-# CHECK: DW_AT_high_pc (0x0000000000002000)
+# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001000)
+# CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000002000)
# CHECK: error: DIE address ranges are not contained in its parent's ranges:
# CHECK: 0x0000001e: DW_TAG_subprogram
-# CHECK: DW_AT_name ("main")
-# CHECK: DW_AT_low_pc (0x0000000000000000)
-# CHECK: DW_AT_high_pc (0x0000000000000000)
+# CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000000d] = "main")
+# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
+# CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000000000)
# CHECK: 0x00000044: DW_TAG_lexical_block
-# CHECK: DW_AT_low_pc (0x0000000000001000)
-# CHECK: DW_AT_high_pc (0x0000000000002000)
+# CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000000001000)
+# CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000000002000)
--- !mach-o
diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index 9eeaddf14928..957755a0a4a0 100644
--- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -289,8 +289,10 @@ static DIDumpOptions getDumpOpts(DWARFContext &C) {
DumpOpts.Verbose = Verbose;
DumpOpts.RecoverableErrorHandler = C.getRecoverableErrorHandler();
// In -verify mode, print DIEs without children in error messages.
- if (Verify)
+ if (Verify) {
+ DumpOpts.Verbose = true;
return DumpOpts.noImplicitRecursion();
+ }
return DumpOpts;
}
More information about the llvm-commits
mailing list