Skip to content

Commit a0c57a0

Browse files
committed
Revert "[lldb] Tolerate multiple compile units with the same DWO ID (#100577)"
The test appears to be flaky. Revert it while I investigate. This reverts commits 32a62eb and 7027cc6.
1 parent b3ed1d9 commit a0c57a0

File tree

3 files changed

+14
-159
lines changed

3 files changed

+14
-159
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,12 @@ void DWARFUnit::ExtractUnitDIEIfNeeded() {
9797
*m_dwo_id, m_first_die.GetOffset()));
9898
return; // Can't fetch the compile unit from the dwo file.
9999
}
100-
101-
// Link the DWO unit to this object, if it hasn't been linked already (this
102-
// can happen when we have an index, and the DWO unit is parsed first).
103-
if (!dwo_cu->LinkToSkeletonUnit(*this)) {
104-
SetDwoError(Status::createWithFormat(
105-
"multiple compile units with Dwo ID {0:x16}", *m_dwo_id));
106-
return;
107-
}
100+
// If the skeleton compile unit gets its unit DIE parsed first, then this
101+
// will fill in the DWO file's back pointer to this skeleton compile unit.
102+
// If the DWO files get parsed on their own first the skeleton back link
103+
// can be done manually in DWARFUnit::GetSkeletonCompileUnit() which will
104+
// do a reverse lookup and cache the result.
105+
dwo_cu->SetSkeletonUnit(this);
108106

109107
DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly();
110108
if (!dwo_cu_die.IsValid()) {
@@ -720,11 +718,13 @@ DWARFCompileUnit *DWARFUnit::GetSkeletonUnit() {
720718
return llvm::dyn_cast_or_null<DWARFCompileUnit>(m_skeleton_unit);
721719
}
722720

723-
bool DWARFUnit::LinkToSkeletonUnit(DWARFUnit &skeleton_unit) {
724-
if (m_skeleton_unit && m_skeleton_unit != &skeleton_unit)
725-
return false;
726-
m_skeleton_unit = &skeleton_unit;
727-
return true;
721+
void DWARFUnit::SetSkeletonUnit(DWARFUnit *skeleton_unit) {
722+
// If someone is re-setting the skeleton compile unit backlink, make sure
723+
// it is setting it to a valid value when it wasn't valid, or if the
724+
// value in m_skeleton_unit was valid, it should be the same value.
725+
assert(skeleton_unit);
726+
assert(m_skeleton_unit == nullptr || m_skeleton_unit == skeleton_unit);
727+
m_skeleton_unit = skeleton_unit;
728728
}
729729

730730
bool DWARFUnit::Supports_DW_AT_APPLE_objc_complete_type() {

lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class DWARFUnit : public UserID {
170170
/// both cases correctly and avoids crashes.
171171
DWARFCompileUnit *GetSkeletonUnit();
172172

173-
bool LinkToSkeletonUnit(DWARFUnit &skeleton_unit);
173+
void SetSkeletonUnit(DWARFUnit *skeleton_unit);
174174

175175
bool Supports_DW_AT_APPLE_objc_complete_type();
176176

lldb/test/Shell/SymbolFile/DWARF/x86/dwp-hash-collision.s

Lines changed: 0 additions & 145 deletions
This file was deleted.

0 commit comments

Comments
 (0)