Skip to content

Commit 9a1d8cf

Browse files
committed
Respond to user feeback.
1 parent 49eb373 commit 9a1d8cf

File tree

2 files changed

+12
-30
lines changed

2 files changed

+12
-30
lines changed

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,27 +1744,18 @@ SymbolFileDWARF *SymbolFileDWARF::GetDIERefSymbolFile(const DIERef &die_ref) {
17441744
if (GetFileIndex() == file_index)
17451745
return this;
17461746

1747-
// If we are currently in a .dwo file and our file index doesn't match we need
1748-
// to let the base symbol file handle this.
1749-
SymbolFileDWARFDwo *dwo = llvm::dyn_cast_or_null<SymbolFileDWARFDwo>(this);
1750-
if (dwo)
1751-
return dwo->GetDIERefSymbolFile(die_ref);
1752-
17531747
if (file_index) {
1754-
SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile();
1755-
if (debug_map) {
17561748
// We have a SymbolFileDWARFDebugMap, so let it find the right file
1749+
\ if (SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile())
17571750
return debug_map->GetSymbolFileByOSOIndex(*file_index);
1758-
} else {
1759-
// Handle the .dwp file case correctly
1760-
if (*file_index == DIERef::k_file_index_mask)
1761-
return GetDwpSymbolFile().get(); // DWP case
1762-
1763-
// Handle the .dwo file case correctly
1764-
return DebugInfo()
1765-
.GetUnitAtIndex(*die_ref.file_index())
1766-
->GetDwoSymbolFile(); // DWO case
1767-
}
1751+
1752+
// Handle the .dwp file case correctly
1753+
if (*file_index == DIERef::k_file_index_mask)
1754+
return GetDwpSymbolFile().get(); // DWP case
1755+
1756+
// Handle the .dwo file case correctly
1757+
return DebugInfo().GetUnitAtIndex(*die_ref.file_index())
1758+
->GetDwoSymbolFile(); // DWO case
17681759
}
17691760
return this;
17701761
}

lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99
// type unit that is kept has the .dwo file name that it came from. When LLDB
1010
// loads the foreign type units, it needs to verify that any entries from
1111
// foreign type units come from the right .dwo file. We test this since the
12-
// contents of type units are not always the same even though they have the same
13-
// type hash. We don't want invalid accelerator table entries to come from one
14-
// .dwo file and be used on a type unit from another since this could cause
12+
// contents of type units are not always the same even though they have the
13+
// same type hash. We don't want invalid accelerator table entries to come from
14+
// one .dwo file and be used on a type unit from another since this could cause
1515
// invalid lookups to happen. LLDB knows how to track down which .dwo file a
1616
// type unit comes from by looking at the DW_AT_dwo_name attribute in the
1717
// DW_TAG_type_unit.
1818

19-
// Now test with DWARF5
2019
// RUN: %clang -target x86_64-pc-linux -gdwarf-5 -gsplit-dwarf \
2120
// RUN: -fdebug-types-section -gpubnames -c %s -o %t.main.o
2221
// RUN: %clang -target x86_64-pc-linux -gdwarf-5 -gsplit-dwarf -DVARIANT \
@@ -93,14 +92,6 @@
9392
// DWPFOO-NEXT: CustomType::FloatType y;
9493
// DWPFOO-NEXT: }
9594

96-
// We need to do this so we end with a type unit in each .dwo file and that has
97-
// the same signature but different contents. When we make the .dwp file, then
98-
// one of the type units will end up in the .dwp file and we will have
99-
// .debug_names accelerator tables for both type units and we need to ignore
100-
// the type units .debug_names entries that don't match the .dwo file whose
101-
// copy of the type unit ends up in the final .dwp file. To do this, LLDB will
102-
// look at the type unit and take the DWO name attribute and make sure it
103-
// matches, and if it doesn't, it will ignore the accelerator table entry.
10495
struct CustomType {
10596
// We switch the order of "FloatType" and "IntegerType" so that if we do
10697
// end up reading the wrong accelerator table entry, that we would end up

0 commit comments

Comments
 (0)