File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -828,6 +828,14 @@ void ProfiledBinary::populateSymbolAddressList(const ObjectFile *Obj) {
828828 SymbolStartAddrs[GUID] = Addr;
829829 StartAddrToSymMap.emplace (Addr, GUID);
830830 }
831+
832+ // Load DWARF name too if they are overwritten by the symbol table
833+ for (auto [OldGUID, Func] : OverriddenBinaryFunctions) {
834+ uint64_t GUID = Function::getGUIDAssumingExternalLinkage (Func->FuncName );
835+ uint64_t Addr = SymbolStartAddrs[GUID];
836+ SymbolStartAddrs[OldGUID] = Addr;
837+ StartAddrToSymMap.emplace (Addr, OldGUID);
838+ }
831839}
832840
833841void ProfiledBinary::loadSymbolsFromSymtab (const ObjectFile *Obj) {
@@ -903,13 +911,16 @@ void ProfiledBinary::loadSymbolsFromSymtab(const ObjectFile *Obj) {
903911 if (!Ret.second )
904912 continue ;
905913
914+ uint64_t OldGUID = MD5Hash (Range->getFuncName ());
915+
906916 Func.FuncName = Ret.first ->first ;
907917 Func.Ranges = ErrSym->second .Ranges ;
908918 Func.FromSymtab = true ;
909919
910- HashBinaryFunctions.erase (MD5Hash (Range-> getFuncName ()) );
920+ HashBinaryFunctions.erase (OldGUID );
911921 BinaryFunctions.erase (ErrSym);
912922
923+ OverriddenBinaryFunctions[OldGUID] = &Func;
913924 HashBinaryFunctions[MD5Hash (StringRef (SymName))] = &Func;
914925 Range->Func = &Func;
915926 for (auto [RangeStart, _] : Func.Ranges ) {
Original file line number Diff line number Diff line change @@ -232,6 +232,10 @@ class ProfiledBinary {
232232 // GUID to symbol start address map
233233 DenseMap<uint64_t , uint64_t > SymbolStartAddrs;
234234
235+ // GUID mapping of the overridden DWARF symbol names to the binary functions
236+ // with the symbol table names
237+ std::unordered_map<uint64_t , BinaryFunction *> OverriddenBinaryFunctions;
238+
235239 // These maps are for temporary use of warning diagnosis.
236240 DenseSet<int64_t > AddrsWithMultipleSymbols;
237241 DenseSet<std::pair<uint64_t , uint64_t >> AddrsWithInvalidInstruction;
You can’t perform that action at this time.
0 commit comments