Skip to content

Commit eb12e61

Browse files
committed
DebugInfoVerifier: Verify dwo units
Initial pass - follow-up patches to address various limitations (debug ranges, location lists... )
1 parent 58d9c1a commit eb12e61

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h

+5
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ class DWARFContext : public DIContext {
189189
DWOUnits.begin() + DWOUnits.getNumInfoUnits());
190190
}
191191

192+
const DWARFUnitVector &getDWOUnitsVector() {
193+
parseDWOUnits();
194+
return DWOUnits;
195+
}
196+
192197
/// Get units from .debug_types.dwo in the DWO context.
193198
unit_iterator_range dwo_types_section_units() {
194199
parseDWOUnits();

llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ bool DWARFVerifier::handleDebugInfo() {
390390

391391
OS << "Verifying non-dwo Units...\n";
392392
NumErrors += verifyUnits(DCtx.getNormalUnitsVector());
393+
394+
OS << "Verifying dwo Units...\n";
395+
NumErrors += verifyUnits(DCtx.getDWOUnitsVector());
393396
return NumErrors == 0;
394397
}
395398

llvm/test/DebugInfo/X86/skeleton-unit-verify.s

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# CHECK-NEXT: warning: DW_TAG_skeleton_unit has DW_CHILDREN_yes but DIE has no children
99
# CHECK-NEXT: DW_TAG_skeleton_unit
1010
# CHECK-NEXT: error: Skeleton compilation unit has children.
11+
# CHECK-NEXT: Verifying dwo Units...
1112
# CHECK-NEXT: Errors detected.
1213

1314
.section .debug_abbrev,"",@progbits
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# RUN: llvm-mc %s -filetype obj -triple x86_64-linux-gnu -o - \
2+
# RUN: | not llvm-dwarfdump -v -verify - \
3+
# RUN: | FileCheck %s --implicit-check-not=error --implicit-check-not=warning
4+
5+
# CHECK: Verifying dwo Units...
6+
# CHECK: error: Compilation unit root DIE is not a unit DIE: DW_TAG_null.
7+
# CHECK: error: Compilation unit type (DW_UT_split_compile) and root DIE (DW_TAG_null) do not match.
8+
# CHECK: Errors detected
9+
.section .debug_info.dwo,"e",@progbits
10+
.long .Ldebug_info_dwo_end1-.Ldebug_info_dwo_start1 # Length of Unit
11+
.Ldebug_info_dwo_start1:
12+
.short 5 # DWARF version number
13+
.byte 5 # DWARF Unit Type
14+
.byte 8 # Address Size (in bytes)
15+
.long 0 # Offset Into Abbrev. Section
16+
.quad 5527374834836270265
17+
.byte 0 # End Of Children Mark
18+
.Ldebug_info_dwo_end1:

0 commit comments

Comments
 (0)