[llvm] 3ac709b - llvm-dwarfdump --verify: Exit non-zero on simplified template name rebuilding failures
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 26 15:58:34 PDT 2021
Author: David Blaikie
Date: 2021-10-26T15:57:16-07:00
New Revision: 3ac709b6cedb82e876a62c28fde90810014fca55
URL: https://github.com/llvm/llvm-project/commit/3ac709b6cedb82e876a62c28fde90810014fca55
DIFF: https://github.com/llvm/llvm-project/commit/3ac709b6cedb82e876a62c28fde90810014fca55.diff
LOG: llvm-dwarfdump --verify: Exit non-zero on simplified template name rebuilding failures
Added:
llvm/test/tools/llvm-dwarfdump/X86/simplified-template-names-fail.s
Modified:
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
Removed:
################################################################################
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index 9da2236a273d9..0e7bce85345dc 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -171,15 +171,16 @@ bool DWARFVerifier::verifyName(const DWARFDie &Die) {
std::string OriginalFullName;
Die.getFullName(OS, &OriginalFullName);
OS.flush();
- if (!OriginalFullName.empty() && OriginalFullName != ReconstructedName) {
- error() << "Simplified template DW_AT_name could not be reconstituted:\n"
- << formatv(" original: {0}\n"
- " reconstituted: {1}\n",
- OriginalFullName, ReconstructedName);
- dump(Die) << '\n';
- dump(Die.getDwarfUnit()->getUnitDIE()) << '\n';
- }
- return 0;
+ if (OriginalFullName.empty() || OriginalFullName == ReconstructedName)
+ return 0;
+
+ error() << "Simplified template DW_AT_name could not be reconstituted:\n"
+ << formatv(" original: {0}\n"
+ " reconstituted: {1}\n",
+ OriginalFullName, ReconstructedName);
+ dump(Die) << '\n';
+ dump(Die.getDwarfUnit()->getUnitDIE()) << '\n';
+ return 1;
}
unsigned DWARFVerifier::verifyUnitContents(DWARFUnit &Unit,
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/simplified-template-names-fail.s b/llvm/test/tools/llvm-dwarfdump/X86/simplified-template-names-fail.s
new file mode 100644
index 0000000000000..0af8cf0ed6c9a
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/simplified-template-names-fail.s
@@ -0,0 +1,143 @@
+# RUN: llvm-mc < %s -filetype obj -triple x86_64 -o %t
+# RUN: not llvm-dwarfdump --verify %t | FileCheck %s
+
+# CHECK: error: Simplified template DW_AT_name could not be reconstituted:
+# CHECK: original: t1<it>
+# CHECK reconstituted: t1<int>
+ .text
+ .file "verify.cpp"
+ .file 1 "/usr/local/google/home/blaikie/dev/scratch" "verify.cpp"
+ .type v1, at object # @v1
+ .bss
+ .globl v1
+v1:
+ .zero 1
+ .size v1, 1
+
+ .section .debug_abbrev,"", at progbits
+ .byte 1 # Abbreviation Code
+ .byte 17 # DW_TAG_compile_unit
+ .byte 1 # DW_CHILDREN_yes
+ .byte 37 # DW_AT_producer
+ .byte 14 # DW_FORM_strp
+ .byte 19 # DW_AT_language
+ .byte 5 # DW_FORM_data2
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 16 # DW_AT_stmt_list
+ .byte 23 # DW_FORM_sec_offset
+ .byte 27 # DW_AT_comp_dir
+ .byte 14 # DW_FORM_strp
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 2 # Abbreviation Code
+ .byte 52 # DW_TAG_variable
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 63 # DW_AT_external
+ .byte 25 # DW_FORM_flag_present
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 2 # DW_AT_location
+ .byte 24 # DW_FORM_exprloc
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 3 # Abbreviation Code
+ .byte 19 # DW_TAG_structure_type
+ .byte 1 # DW_CHILDREN_yes
+ .byte 54 # DW_AT_calling_convention
+ .byte 11 # DW_FORM_data1
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 4 # Abbreviation Code
+ .byte 47 # DW_TAG_template_type_parameter
+ .byte 0 # DW_CHILDREN_no
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 5 # Abbreviation Code
+ .byte 36 # DW_TAG_base_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 62 # DW_AT_encoding
+ .byte 11 # DW_FORM_data1
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 0 # EOM(3)
+ .section .debug_info,"", at progbits
+.Lcu_begin0:
+ .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+ .short 4 # DWARF version number
+ .long .debug_abbrev # Offset Into Abbrev. Section
+ .byte 8 # Address Size (in bytes)
+ .byte 1 # Abbrev [1] 0xb:0x43 DW_TAG_compile_unit
+ .long .Linfo_string0 # DW_AT_producer
+ .short 33 # DW_AT_language
+ .long .Linfo_string1 # DW_AT_name
+ .long .Lline_table_start0 # DW_AT_stmt_list
+ .long .Linfo_string2 # DW_AT_comp_dir
+ .byte 2 # Abbrev [2] 0x1e:0x15 DW_TAG_variable
+ .long .Linfo_string3 # DW_AT_name
+ .long 51 # DW_AT_type
+ # DW_AT_external
+ .byte 1 # DW_AT_decl_file
+ .byte 2 # DW_AT_decl_line
+ .byte 9 # DW_AT_location
+ .byte 3
+ .quad v1
+ .byte 3 # Abbrev [3] 0x33:0x13 DW_TAG_structure_type
+ .byte 5 # DW_AT_calling_convention
+ .long .Linfo_string6 # DW_AT_name
+ .byte 1 # DW_AT_byte_size
+ .byte 1 # DW_AT_decl_file
+ .byte 1 # DW_AT_decl_line
+ .byte 4 # Abbrev [4] 0x3c:0x9 DW_TAG_template_type_parameter
+ .long 70 # DW_AT_type
+ .long .Linfo_string5 # DW_AT_name
+ .byte 0 # End Of Children Mark
+ .byte 5 # Abbrev [5] 0x46:0x7 DW_TAG_base_type
+ .long .Linfo_string4 # DW_AT_name
+ .byte 5 # DW_AT_encoding
+ .byte 4 # DW_AT_byte_size
+ .byte 0 # End Of Children Mark
+.Ldebug_info_end0:
+ .section .debug_str,"MS", at progbits,1
+.Linfo_string0:
+ .asciz "clang version 14.0.0 (git at github.com:llvm/llvm-project.git 9daec0955132e6e33b086edc63c6f3e0f5712323)" # string offset=0
+.Linfo_string1:
+ .asciz "verify.cpp" # string offset=101
+.Linfo_string2:
+ .asciz "/usr/local/google/home/blaikie/dev/scratch" # string offset=112
+.Linfo_string3:
+ .asciz "v1" # string offset=155
+.Linfo_string4:
+ .asciz "int" # string offset=158
+.Linfo_string5:
+ .asciz "T" # string offset=162
+.Linfo_string6:
+ .asciz "_STNt1|<it>" # string offset=164
+ .ident "clang version 14.0.0 (git at github.com:llvm/llvm-project.git 9daec0955132e6e33b086edc63c6f3e0f5712323)"
+ .section ".note.GNU-stack","", at progbits
+ .addrsig
+ .section .debug_line,"", at progbits
+.Lline_table_start0:
More information about the llvm-commits
mailing list