Skip to content

Commit 0446c58

Browse files
authored
[DebugInfo] Correctly report header parsing errors from DWARFContext::fixupIndex (#69505)
In ef762e5e7292, I shifted around where errors were reported when failing to parse and/or validate DWARFUnitHeaders. When we are doing so in DWARFContext::fixupIndex, the actual error message isn't prefixed with `warning:` like it would be elsewhere (because of the way `logAllUnhandledErrors` is implemented).
1 parent c35939b commit 0446c58

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

llvm/lib/DebugInfo/DWARF/DWARFContext.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,9 @@ void fixupIndexV4(DWARFContext &C, DWARFUnitIndex &Index) {
9191
DWARFUnitHeader Header;
9292
if (Error ExtractionErr = Header.extract(
9393
C, Data, &Offset, DWARFSectionKind::DW_SECT_INFO)) {
94-
logAllUnhandledErrors(
94+
C.getWarningHandler()(
9595
createError("Failed to parse CU header in DWP file: " +
96-
toString(std::move(ExtractionErr))),
97-
errs());
96+
toString(std::move(ExtractionErr))));
9897
Map.clear();
9998
break;
10099
}
@@ -154,10 +153,9 @@ void fixupIndexV5(DWARFContext &C, DWARFUnitIndex &Index) {
154153
DWARFUnitHeader Header;
155154
if (Error ExtractionErr = Header.extract(
156155
C, Data, &Offset, DWARFSectionKind::DW_SECT_INFO)) {
157-
logAllUnhandledErrors(
156+
C.getWarningHandler()(
158157
createError("Failed to parse CU header in DWP file: " +
159-
toString(std::move(ExtractionErr))),
160-
errs());
158+
toString(std::move(ExtractionErr))));
161159
break;
162160
}
163161
bool CU = Header.getUnitType() == DW_UT_split_compile;

llvm/test/tools/llvm-dwp/X86/cu_tu_units_manual_v5_invalid.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
# CHECK-NOT: .debug_info.dwo contents:
1414

1515
# CHECK-DAG: .debug_cu_index contents:
16-
# CHECK: Failed to parse CU header in DWP file: DWARF unit at offset 0x00000000 has unsupported version 6, supported are 2-5
16+
# CHECK: warning: Failed to parse CU header in DWP file: DWARF unit at offset 0x00000000 has unsupported version 6, supported are 2-5
1717

1818
# CHECK-DAG: .debug_tu_index contents:
19-
# CHECK: Failed to parse CU header in DWP file: DWARF unit at offset 0x00000000 has unsupported version 6, supported are 2-5
19+
# CHECK: warning: Failed to parse CU header in DWP file: DWARF unit at offset 0x00000000 has unsupported version 6, supported are 2-5
2020

2121
.section .debug_info.dwo,"e",@progbits
2222
.long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit

0 commit comments

Comments
 (0)