Index: llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp =================================================================== --- llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp +++ llvm/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp @@ -147,9 +147,14 @@ // Build the function loaded notification message iJIT_Method_Load FunctionMessage = FunctionDescToIntelJITFormat(*Wrapper, Name->data(), Addr, Size); - // TODO: it is neccessary to set proper SectionIndex here. - // object::SectionedAddress::UndefSection works for only absolute addresses. - DILineInfoTable Lines = Context->getLineInfoForAddressRange({Addr, object::SectionedAddress::UndefSection}, Size); + + uint64_t SectionIndex = object::SectionedAddress::UndefSection; + if (auto SectOrErr = Sym.getSection()) + if (*SectOrErr != Obj.section_end()) + SectionIndex = SectOrErr.get()->getIndex(); + + DILineInfoTable Lines = + Context->getLineInfoForAddressRange({Addr, SectionIndex}, Size); DILineInfoTable::iterator Begin = Lines.begin(); DILineInfoTable::iterator End = Lines.end(); for (DILineInfoTable::iterator It = Begin; It != End; ++It) {