[llvm] 727c590 - DebugInfo: Use hash-based unit lookup when available in dwp files
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 27 14:18:30 PDT 2022
Author: David Blaikie
Date: 2022-04-27T21:18:14Z
New Revision: 727c590fe955409fa59d89657b5f7e42d38326e2
URL: https://github.com/llvm/llvm-project/commit/727c590fe955409fa59d89657b5f7e42d38326e2
DIFF: https://github.com/llvm/llvm-project/commit/727c590fe955409fa59d89657b5f7e42d38326e2.diff
LOG: DebugInfo: Use hash-based unit lookup when available in dwp files
Fix a test case that had a bogus (probably I hand crafted it at some
point) index that didn't point to the right data in the process.
Added:
Modified:
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
llvm/test/DebugInfo/X86/dwarfdump-str-offsets-dwp.s
Removed:
################################################################################
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
index b91e26871a8f2..3f554e3feeb6b 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -83,7 +83,14 @@ void DWARFUnitVector::addUnitsImpl(
if (!IndexEntry && IsDWO) {
const DWARFUnitIndex &Index = getDWARFUnitIndex(
Context, Header.isTypeUnit() ? DW_SECT_EXT_TYPES : DW_SECT_INFO);
- IndexEntry = Index.getFromOffset(Header.getOffset());
+ if (Index) {
+ if (Header.isTypeUnit())
+ IndexEntry = Index.getFromHash(Header.getTypeHash());
+ else if (auto DWOId = Header.getDWOId())
+ IndexEntry = Index.getFromHash(*DWOId);
+ }
+ if (!IndexEntry)
+ IndexEntry = Index.getFromOffset(Header.getOffset());
}
if (IndexEntry && !Header.applyIndexEntry(IndexEntry))
return nullptr;
diff --git a/llvm/test/DebugInfo/X86/dwarfdump-str-offsets-dwp.s b/llvm/test/DebugInfo/X86/dwarfdump-str-offsets-dwp.s
index 9bbd4d77e01db..c5350a1e09acf 100644
--- a/llvm/test/DebugInfo/X86/dwarfdump-str-offsets-dwp.s
+++ b/llvm/test/DebugInfo/X86/dwarfdump-str-offsets-dwp.s
@@ -171,7 +171,7 @@ TU1_5_version:
.byte 2 # DWARF Unit Type
.byte 8 # Address Size (in bytes)
.long .debug_abbrev.dwo # Offset Into Abbrev. Section
- .quad 0x0011223344556677 # Type Signature
+ .quad 0xeeaaddbbaabbeedd # Type Signature
.long TU1_5_type-TU1_5_start # Type offset
# The type-unit DIE, which has a name.
.byte 2 # Abbreviation code
@@ -191,7 +191,7 @@ TU2_5_version:
.byte 2 # DWARF Unit Type
.byte 8 # Address Size (in bytes)
.long .debug_abbrev.dwo # Offset Into Abbrev. Section
- .quad 0x00aabbccddeeff99 # Type Signature
+ .quad 0x00ffeeffaaff00ff # Type Signature
.long TU2_5_type-TU2_5_start # Type offset
# The type-unit DIE, which has a name.
.byte 2 # Abbreviation code
More information about the llvm-commits
mailing list