diff --git a/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp b/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp index d2fc4c784ec..324d0711870 100644 --- a/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp +++ b/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp @@ -88,26 +88,27 @@ void OProfileJITEventListener::NotifyObjectEmitted( // Use symbol info to iterate functions in the object. for (const std::pair &P : computeSymbolSizes(DebugObj)) { SymbolRef Sym = P.first; - if (Sym.getType() == SymbolRef::ST_Function) { - ErrorOr NameOrErr = Sym.getName(); - if (NameOrErr.getError()) - continue; - StringRef Name = *NameOrErr; - ErrorOr AddrOrErr = Sym.getAddress(); - if (AddrOrErr.getError()) - continue; - uint64_t Addr = *AddrOrErr; - uint64_t Size = P.second; + if (Sym.getType() != SymbolRef::ST_Function) + continue; - if (Wrapper->op_write_native_code(Name.data(), Addr, (void*)Addr, Size) - == -1) { - DEBUG(dbgs() << "Failed to tell OProfile about native function " - << Name << " at [" - << (void*)Addr << "-" << ((char*)Addr + Size) << "]\n"); - continue; - } - // TODO: support line number info (similar to IntelJITEventListener.cpp) + ErrorOr NameOrErr = Sym.getName(); + if (NameOrErr.getError()) + continue; + StringRef Name = *NameOrErr; + ErrorOr AddrOrErr = Sym.getAddress(); + if (AddrOrErr.getError()) + continue; + uint64_t Addr = *AddrOrErr; + uint64_t Size = P.second; + + if (Wrapper->op_write_native_code(Name.data(), Addr, (void *)Addr, Size) == + -1) { + DEBUG(dbgs() << "Failed to tell OProfile about native function " << Name + << " at [" << (void *)Addr << "-" << ((char *)Addr + Size) + << "]\n"); + continue; } + // TODO: support line number info (similar to IntelJITEventListener.cpp) } DebugObjects[Obj.getData().data()] = std::move(DebugObjOwner);