[llvm] 3ba4d08 - [dwarfdump][dwarf] Fix parsing of tu-index
Alexander Yermolovich via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 20 11:42:37 PDT 2023
Author: Alexander Yermolovich
Date: 2023-04-20T11:42:24-07:00
New Revision: 3ba4d082da3dd6856887774fab694f81adc15a64
URL: https://github.com/llvm/llvm-project/commit/3ba4d082da3dd6856887774fab694f81adc15a64
DIFF: https://github.com/llvm/llvm-project/commit/3ba4d082da3dd6856887774fab694f81adc15a64.diff
LOG: [dwarfdump][dwarf] Fix parsing of tu-index
Fixed issue where {tu,cu}-index fixup code for DWARF5 that would report an error when
fixup map is empty. Which is the case when seciton(s) are not over 4GB or
--manaully-generate-unit-index is not specified
Differential Revision: https://reviews.llvm.org/D148578
Added:
Modified:
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/test/DebugInfo/X86/dwp-v5-tu-index.s
Removed:
################################################################################
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 347a5c7614426..8033ab4d9573a 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -869,6 +869,8 @@ void fixupIndexV5(const DWARFObject &DObj, DWARFContext &C,
Offset = Header.getNextUnitOffset();
}
});
+ if (Map.empty())
+ return;
for (DWARFUnitIndex::Entry &E : Index.getMutableRows()) {
if (!E.isValid())
continue;
diff --git a/llvm/test/DebugInfo/X86/dwp-v5-tu-index.s b/llvm/test/DebugInfo/X86/dwp-v5-tu-index.s
index 6a4f94fa8d7ad..8d054e1c7bb0c 100644
--- a/llvm/test/DebugInfo/X86/dwp-v5-tu-index.s
+++ b/llvm/test/DebugInfo/X86/dwp-v5-tu-index.s
@@ -2,8 +2,8 @@
## compliant to the DWARFv5 standard.
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o - | \
-# RUN: llvm-dwarfdump -debug-tu-index - | \
-# RUN: FileCheck %s
+# RUN: llvm-dwarfdump -debug-tu-index - 2>&1 | \
+# RUN: FileCheck %s --implicit-check-not "could not find unit with signature"
# CHECK: .debug_tu_index contents:
# CHECK-NEXT: version = 5, units = 1, slots = 2
More information about the llvm-commits
mailing list