@@ -1147,28 +1147,42 @@ void ProfiledBinary::loadSymbolsFromPseudoProbe() {
11471147 return ;
11481148
11491149 const AddressProbesMap &Address2ProbesMap = getAddress2ProbesMap ();
1150- for (auto &[Addr, Range] : StartAddrToFuncRangeMap) {
1151- auto Func = Range.Func ;
1152- if (!Range.IsFuncEntry || Func->NameStatus != DwarfNameStatus::Mismatch)
1150+ for (auto *Func : ProfiledFunctions) {
1151+ if (Func->NameStatus != DwarfNameStatus::Mismatch)
11531152 continue ;
1154- const auto &Probe = Address2ProbesMap.find (Addr, Range.EndAddress );
1155- if (Probe.begin () != Probe.end ()) {
1156- const MCDecodedPseudoProbeInlineTree *InlineTreeNode =
1157- Probe.begin ()->get ().getInlineTreeNode ();
1158- while (!InlineTreeNode->isTopLevelFunc ())
1159- InlineTreeNode = static_cast <MCDecodedPseudoProbeInlineTree *>(
1160- InlineTreeNode->Parent );
1161-
1162- auto TopLevelProbes = InlineTreeNode->getProbes ();
1163- auto TopProbe = TopLevelProbes.begin ();
1164- assert (TopProbe != TopLevelProbes.end () &&
1165- TopProbe->getAddress () >= Addr &&
1166- " Top level pseudo probe does not match function range" );
1167-
1168- const auto *ProbeDesc = getFuncDescForGUID (InlineTreeNode->Guid );
1169- auto Ret = PseudoProbeNames.emplace (Func, ProbeDesc->FuncName );
1170- assert ((Ret.second || Ret.first ->second == ProbeDesc->FuncName ) &&
1171- " Mismatched pseudo probe names" );
1153+ for (auto &[StartAddr, EndAddr] : Func->Ranges ) {
1154+ auto Range = findFuncRangeForStartAddr (StartAddr);
1155+ if (!Range->IsFuncEntry )
1156+ continue ;
1157+ const auto &Probe = Address2ProbesMap.find (StartAddr, EndAddr);
1158+ if (Probe.begin () != Probe.end ()) {
1159+ const MCDecodedPseudoProbeInlineTree *InlineTreeNode =
1160+ Probe.begin ()->get ().getInlineTreeNode ();
1161+ while (!InlineTreeNode->isTopLevelFunc ())
1162+ InlineTreeNode = static_cast <MCDecodedPseudoProbeInlineTree *>(
1163+ InlineTreeNode->Parent );
1164+
1165+ auto TopLevelProbes = InlineTreeNode->getProbes ();
1166+ auto TopProbe = TopLevelProbes.begin ();
1167+ assert (TopProbe != TopLevelProbes.end () &&
1168+ TopProbe->getAddress () >= StartAddr &&
1169+ TopProbe->getAddress () < EndAddr &&
1170+ " Top level pseudo probe does not match function range" );
1171+
1172+ const auto *ProbeDesc = getFuncDescForGUID (InlineTreeNode->Guid );
1173+ auto Ret = PseudoProbeNames.emplace (Func, ProbeDesc->FuncName );
1174+ if (!Ret.second && Ret.first ->second != ProbeDesc->FuncName &&
1175+ ShowDetailedWarning)
1176+ WithColor::warning ()
1177+ << " Mismatched pseudo probe names in function " << Func->FuncName
1178+ << " at range: (" << format (" %8" PRIx64, StartAddr) << " , "
1179+ << format (" %8" PRIx64, EndAddr) << " ). "
1180+ << " The previously found pseudo probe name is "
1181+ << Ret.first ->second << " but it conflicts with name "
1182+ << ProbeDesc->FuncName
1183+ << " This likely indicates a DWARF error that produces "
1184+ " conflicting symbols at the same starting address.\n " ;
1185+ }
11721186 }
11731187 }
11741188}
0 commit comments