diff options
Diffstat (limited to 'contrib/llvm/lib/DebugInfo/PDB/PDBContext.cpp')
-rw-r--r-- | contrib/llvm/lib/DebugInfo/PDB/PDBContext.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/contrib/llvm/lib/DebugInfo/PDB/PDBContext.cpp b/contrib/llvm/lib/DebugInfo/PDB/PDBContext.cpp index ca2ae66..7732302 100644 --- a/contrib/llvm/lib/DebugInfo/PDB/PDBContext.cpp +++ b/contrib/llvm/lib/DebugInfo/PDB/PDBContext.cpp @@ -19,6 +19,7 @@ using namespace llvm; using namespace llvm::object; +using namespace llvm::pdb; PDBContext::PDBContext(const COFFObjectFile &Object, std::unique_ptr<IPDBSession> PDBSession) @@ -28,7 +29,8 @@ PDBContext::PDBContext(const COFFObjectFile &Object, Session->setLoadAddress(ImageBase.get()); } -void PDBContext::dump(raw_ostream &OS, DIDumpType DumpType) {} +void PDBContext::dump(raw_ostream &OS, DIDumpType DumpType, + bool DumpEH) {} DILineInfo PDBContext::getLineInfoForAddress(uint64_t Address, DILineInfoSpecifier Specifier) { @@ -95,26 +97,24 @@ std::string PDBContext::getFunctionName(uint64_t Address, if (NameKind == DINameKind::None) return std::string(); + std::unique_ptr<PDBSymbol> FuncSymbol = + Session->findSymbolByAddress(Address, PDB_SymType::Function); + auto *Func = dyn_cast_or_null<PDBSymbolFunc>(FuncSymbol.get()); + if (NameKind == DINameKind::LinkageName) { // It is not possible to get the mangled linkage name through a // PDBSymbolFunc. For that we have to specifically request a // PDBSymbolPublicSymbol. auto PublicSym = Session->findSymbolByAddress(Address, PDB_SymType::PublicSymbol); - if (auto PS = dyn_cast_or_null<PDBSymbolPublicSymbol>(PublicSym.get())) - return PS->getName(); + if (auto *PS = dyn_cast_or_null<PDBSymbolPublicSymbol>(PublicSym.get())) { + // If we also have a function symbol, prefer the use of public symbol name + // only if it refers to the same address. The public symbol uses the + // linkage name while the function does not. + if (!Func || Func->getVirtualAddress() == PS->getVirtualAddress()) + return PS->getName(); + } } - auto FuncSymbol = - Session->findSymbolByAddress(Address, PDB_SymType::Function); - - // This could happen either if there was no public symbol (e.g. not - // external) or the user requested the short name. In the former case, - // although they technically requested the linkage name, if the linkage - // name is not available we fallback to at least returning a non-empty - // string. - if (auto Func = dyn_cast_or_null<PDBSymbolFunc>(FuncSymbol.get())) - return Func->getName(); - - return std::string(); + return Func ? Func->getName() : std::string(); } |