[llvm] eb12e61 - DebugInfoVerifier: Verify dwo units
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 16 14:47:42 PST 2021
Author: David Blaikie
Date: 2021-12-16T14:47:22-08:00
New Revision: eb12e61384ecda8f9d3396fb3e3c22ae4a215019
URL: https://github.com/llvm/llvm-project/commit/eb12e61384ecda8f9d3396fb3e3c22ae4a215019
DIFF: https://github.com/llvm/llvm-project/commit/eb12e61384ecda8f9d3396fb3e3c22ae4a215019.diff
LOG: DebugInfoVerifier: Verify dwo units
Initial pass - follow-up patches to address various limitations (debug
ranges, location lists... )
Added:
llvm/test/tools/llvm-dwarfdump/X86/verify_split_cu.s
Modified:
llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
llvm/test/DebugInfo/X86/skeleton-unit-verify.s
Removed:
################################################################################
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
index ae1afeb668be4..24714ac3d101f 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
@@ -189,6 +189,11 @@ class DWARFContext : public DIContext {
DWOUnits.begin() + DWOUnits.getNumInfoUnits());
}
+ const DWARFUnitVector &getDWOUnitsVector() {
+ parseDWOUnits();
+ return DWOUnits;
+ }
+
/// Get units from .debug_types.dwo in the DWO context.
unit_iterator_range dwo_types_section_units() {
parseDWOUnits();
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index 1e49798ab4260..67862200d7a90 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -390,6 +390,9 @@ bool DWARFVerifier::handleDebugInfo() {
OS << "Verifying non-dwo Units...\n";
NumErrors += verifyUnits(DCtx.getNormalUnitsVector());
+
+ OS << "Verifying dwo Units...\n";
+ NumErrors += verifyUnits(DCtx.getDWOUnitsVector());
return NumErrors == 0;
}
diff --git a/llvm/test/DebugInfo/X86/skeleton-unit-verify.s b/llvm/test/DebugInfo/X86/skeleton-unit-verify.s
index 6441aa31d808f..8c3a223fdbf42 100644
--- a/llvm/test/DebugInfo/X86/skeleton-unit-verify.s
+++ b/llvm/test/DebugInfo/X86/skeleton-unit-verify.s
@@ -8,6 +8,7 @@
# 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.
+# CHECK-NEXT: Verifying dwo Units...
# CHECK-NEXT: Errors detected.
.section .debug_abbrev,"", at progbits
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_split_cu.s b/llvm/test/tools/llvm-dwarfdump/X86/verify_split_cu.s
new file mode 100644
index 0000000000000..14c8da2fcf803
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_split_cu.s
@@ -0,0 +1,18 @@
+# RUN: llvm-mc %s -filetype obj -triple x86_64-linux-gnu -o - \
+# RUN: | not llvm-dwarfdump -v -verify - \
+# RUN: | FileCheck %s --implicit-check-not=error --implicit-check-not=warning
+
+# CHECK: Verifying dwo Units...
+# CHECK: error: Compilation unit root DIE is not a unit DIE: DW_TAG_null.
+# CHECK: error: Compilation unit type (DW_UT_split_compile) and root DIE (DW_TAG_null) do not match.
+# CHECK: Errors detected
+ .section .debug_info.dwo,"e", at progbits
+ .long .Ldebug_info_dwo_end1-.Ldebug_info_dwo_start1 # Length of Unit
+.Ldebug_info_dwo_start1:
+ .short 5 # DWARF version number
+ .byte 5 # DWARF Unit Type
+ .byte 8 # Address Size (in bytes)
+ .long 0 # Offset Into Abbrev. Section
+ .quad 5527374834836270265
+ .byte 0 # End Of Children Mark
+.Ldebug_info_dwo_end1:
More information about the llvm-commits
mailing list