Skip to content

Commit dd5782e

Browse files
committed
fixup! don't check specification DIE
1 parent f20f628 commit dd5782e

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,9 @@ static unsigned GetCXXMethodCVQuals(const DWARFDIE &subprogram,
251251
}
252252

253253
static std::optional<std::string> MakeLLDBFuncAsmLabel(const DWARFDIE &die) {
254-
std::optional<std::string> label;
255-
char const *name = die.GetPubname();
256-
if (name)
257-
label.emplace(name);
254+
char const *name = die.GetMangledName(/*substitute_name_allowed*/ false);
255+
if (!name)
256+
return std::nullopt;
258257

259258
auto module_sp = die.GetModule();
260259
if (!module_sp)
@@ -268,8 +267,8 @@ static std::optional<std::string> MakeLLDBFuncAsmLabel(const DWARFDIE &die) {
268267
if (die_id == LLDB_INVALID_UID)
269268
return std::nullopt;
270269

271-
return llvm::formatv("{0}:{1}:{2:x}:{3:x}", FunctionCallLabelPrefix,
272-
name ? name : "", module_id, die_id)
270+
return llvm::formatv("{0}:{1}:{2:x}:{3:x}", FunctionCallLabelPrefix, name,
271+
module_id, die_id)
273272
.str();
274273
}
275274

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,9 +2479,8 @@ llvm::Error SymbolFileDWARF::ResolveFunctionUID(SymbolContextList &sc_list,
24792479
if (!die.IsValid())
24802480
return llvm::createStringError("invalid input DIE");
24812481

2482-
// Look up by DW_AT_linkage_name if we can. Otherwise we can use the
2483-
// DW_AT_name.
2484-
char const *name = die.GetPubname();
2482+
// Rely on DW_AT_linkage_name to find us the definition DIE.
2483+
char const *name = die.GetMangledName(/*substitute_name_allowed=*/false);
24852484
if (!name)
24862485
return llvm::createStringError("input DIE has no name");
24872486

@@ -2494,14 +2493,14 @@ llvm::Error SymbolFileDWARF::ResolveFunctionUID(SymbolContextList &sc_list,
24942493
if (entry.GetAttributeValueAsUnsigned(llvm::dwarf::DW_AT_declaration, 0))
24952494
return true;
24962495

2497-
if (auto spec = entry.GetAttributeValueAsReferenceDIE(
2498-
llvm::dwarf::DW_AT_specification);
2499-
spec == die) {
2500-
die = entry;
2501-
return false;
2502-
}
2503-
2504-
return true;
2496+
// We don't check whether the specification DIE for this function
2497+
// corresponds to the declaration DIE because the declaration might be in
2498+
// a type-unit but the definition in the compile-unit (and it's
2499+
// specifcation would point to the declaration in the compile-unit). We
2500+
// rely on the mangled name within the module to be enough to find us the
2501+
// unique definition.
2502+
die = entry;
2503+
return false;
25052504
});
25062505
}
25072506

0 commit comments

Comments
 (0)