This allows us to get rid of the original unrelocated object file after we're done processing relocations (but before applying them). Since we were already doing that anyway, this fixes the assertion failure uncovered in the MSVC build bots on my GOT commit. I have tested this on X86. I would appreciate if somebody could sanity check/test these changes on at least MIPS and ARM to make sure the remote mcjit tests don't regress. This represents my best understanding of how those relocations should work, but I may have missed something.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I don't have access to an ELF tester for this, but I can't see any problems on inspection. I think you should go ahead and commit, but maybe post a heads up to the dev-list. I'll chime in and recommend that ELF users take the time to write RuntimeDyldChecker regression tests for their architectures.
This commit seems to be causing regressions in the LLDB test suite http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/1698 on x86. I am not really sure what is going on, but reverting does fix the problem. Does this commit change the inferace of the code generator in any way? Should we adapt LLDB somehow?
In any case, I am going to revert this until we find a way to fix expression evaluation in LLDB.
I am getting the following backtrace from the test suite:
(gdb) bt full #0 0x00007ffff0c2e88d in llvm::support::endian::read<unsigned int, (llvm::support::endianness)1, 1ul> (memory=0x6) at /usr/local/google/home/labath/ll/llvm/include/llvm/Support/Endian.h:53 ret = 32767 #1 0x00007ffff37a5238 in llvm::support::detail::packed_endian_specific_integral<unsigned int, (llvm::support::endianness)1, 1ul>::ref::operator unsigned int (this=0x7fffffff8448) at /usr/local/google/home/labath/ll/llvm/include/llvm/Support/Endian.h:116 No locals. #2 0x00007ffff37a1a84 in llvm::RuntimeDyldELF::processRelocationRef (this=0xfc4860, SectionID=2, RelI=..., Obj=..., ObjSectionToID=std::map with 4 elements = {...}, Stubs=std::map with 0 elements) at /usr/local/google/home/labath/ll/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:1338 RelType = 1 Addend = 0 Symbol = {<llvm::object::content_iterator<llvm::object::BasicSymbolRef>> = {<std::iterator<std::forward_iterator_tag, llvm::object::BasicSymbolRef, long, llvm::object::BasicSymbolRef*, llvm::object::BasicSymbolRef&>> = {<No data fields>}, Current = {SymbolPimpl = {d = {a = 16514800, b = 0}, p = 16514800}, OwningObject = 0xfe0730}}, <No data fields>} TargetName = {static npos = 18446744073709551615, Data = 0xfbfd41 ".debug_abbrev", Length = 13} Value = {SectionID = 3, Offset = 0, Addend = 0, SymbolName = 0x0} SymType = llvm::object::SymbolRef::ST_Debug gsi = {Ptr = 0xfd7730} Offset = 6 #3 0x00007ffff37806dd in llvm::RuntimeDyldImpl::loadObjectImpl (this=0xfc4860, Obj=...) at /usr/local/google/home/labath/ll/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp:238 Stubs = std::map with 0 elements RelocatedSection = {<std::iterator<std::forward_iterator_tag, llvm::object::SectionRef, long, llvm::object::SectionRef*, llvm::object::SectionRef&>> = {<No data fields>}, Current = { SectionPimpl = {d = {a = 16515392, b = 0}, p = 16515392}, OwningObject = 0xfe0730}} I = {<std::iterator<std::forward_iterator_tag, llvm::object::RelocationRef, long, llvm::object::RelocationRef*, llvm::object::RelocationRef&>> = {<No data fields>}, Current = {RelocationPimpl = { d = {a = 8, b = 0}, p = 8}, OwningObject = 0xfe0730}} E = {<std::iterator<std::forward_iterator_tag, llvm::object::RelocationRef, long, llvm::object::RelocationRef*, llvm::object::RelocationRef&>> = {<No data fields>}, Current = {RelocationPimpl = { d = {a = 8, b = 11}, p = 47244640264}, OwningObject = 0xfe0730}} SectionID = 2 IsCode = false SI = {<std::iterator<std::forward_iterator_tag, llvm::object::SectionRef, long, llvm::object::SectionRef*, llvm::object::SectionRef&>> = {<No data fields>}, Current = {SectionPimpl = {d = { a = 16515432, b = 0}, p = 16515432}, OwningObject = 0xfe0730}} SE = {<std::iterator<std::forward_iterator_tag, llvm::object::SectionRef, long, llvm::object::SectionRef*, llvm::object::SectionRef&>> = {<No data fields>}, Current = {SectionPimpl = {d = { a = 16516032, b = 0}, p = 16516032}, OwningObject = 0xfe0730}} locked = {M = @0xfc5500} SectionsAddedBeginIdx = 0 LocalSections = std::map with 4 elements = {[{SectionPimpl = {d = {a = 16515352, b = 0}, p = 16515352}, OwningObject = 0xfe0730}] = 3, [{SectionPimpl = {d = {a = 16515392, b = 0}, p = 16515392}, OwningObject = 0xfe0730}] = 2, [{SectionPimpl = {d = { a = 16515152, b = 0}, p = 16515152}, OwningObject = 0xfe0730}] = 1, [{ SectionPimpl = {d = {a = 16515272, b = 0}, p = 16515272}, OwningObject = 0xfe0730}] = 0} CommonSymbols = std::vector of length 0, capacity 0 SectionsAddedEndIdx = 32767 #4 0x00007ffff379bf2e in llvm::RuntimeDyldELF::loadObject (this=0xfc4860, O=...) at /usr/local/google/home/labath/ll/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:218 SectionStartIdx = 32767 SectionEndIdx = 4084749621 #5 0x00007ffff3783385 in llvm::RuntimeDyld::loadObject (this=0xf82b28, Obj=...) at /usr/local/google/home/labath/ll/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp:913 No locals. #6 0x00007ffff36973ae in llvm::MCJIT::generateCodeForModule (this=0xf82a40, M=0xf1d9e0) ---Type <return> to continue, or q <return> to quit--- at /usr/local/google/home/labath/ll/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp:209 locked = {M = @0xf82ad8} ObjectToLoad = std::unique_ptr<llvm::MemoryBuffer> containing 0xfbca50 LoadedObject = {static isRef = false, {TStorage = {<llvm::AlignedCharArray<8, 8>> = { buffer = "0\a\376\000\000\000\000"}, <No data fields>}, ErrorStorage = {<llvm::AlignedCharArray<8, 16>> = { buffer = "0\a\376\000\000\000\000\000h+\370\000\000\000\000"}, <No data fields>}}, HasError = false} L = std::unique_ptr<llvm::RuntimeDyld::LoadedObjectInfo> containing 0xf1d9e0 #7 0x00007ffff36982cb in llvm::MCJIT::getPointerToFunction (this=0xf82a40, F=0xf7c6e0) at /usr/local/google/home/labath/ll/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp:388 locked = {M = @0xf82ad8} Mang = {DL = 0xf21020, AnonGlobalIDs = {<llvm::DenseMapBase<llvm::DenseMap<llvm::GlobalValue const*, unsigned int, llvm::DenseMapInfo<llvm::GlobalValue const*>, llvm::detail::DenseMapPair<llvm::GlobalValue const*, unsigned int> >, llvm::GlobalValue const*, unsigned int, llvm::DenseMapInfo<llvm::GlobalValue const*>, llvm::detail::DenseMapPair<llvm::GlobalValue const*, unsigned int> >> = {<llvm::DebugEpochBase> = { Epoch = 0}, <No data fields>}, Buckets = 0x0, NumEntries = 0, NumTombstones = 0, NumBuckets = 0}, NextAnonGlobalID = 1} Name = {<llvm::SmallVector<char, 128>> = {<llvm::SmallVectorImpl<char>> = {<llvm::SmallVectorTemplateBase<char, true>> = {<llvm::SmallVectorTemplateCommon<char, void>> = {<llvm::SmallVectorBase> = {BeginX = 0x7fffffff9410, EndX = 0x7fffffff942b, CapacityX = 0x7fffffff9490}, FirstEl = {<llvm::AlignedCharArray<1, 1>> = { buffer = "$"}, <No data fields>}}, <No data fields>}, <No data fields>}, Storage = {InlineElts = {{<llvm::AlignedCharArray<1, 1>> = { buffer = "_"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "_"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "l"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "l"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "d"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "b"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "_"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "v"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "a"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "l"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "i"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "d"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "_"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "p"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "o"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "i"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "n"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "t"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "e"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "r"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "_"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "c"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "h"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "e"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "c"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "k"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "P"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "\224"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { ---Type <return> to continue, or q <return> to quit--- buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "\177"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "\b"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = "\n"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = <incomplete sequence \365>}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "`"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\224"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\177"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\225"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\257"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = <incomplete sequence \322>}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = <incomplete sequence \361>}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\177"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "p"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\224"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\177"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\b"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\n"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = <incomplete sequence \365>}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\200"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\224"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\177"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "u"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\257"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = <incomplete sequence \322>}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { ---Type <return> to continue, or q <return> to quit--- buffer = <incomplete sequence \361>}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\177"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\220"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\224"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\177"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\b"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\n"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = <incomplete sequence \365>}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\240"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\224"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\177"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "U"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\257"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = <incomplete sequence \322>}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = <incomplete sequence \361>}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\377"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = "\177"}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = {buffer = ""}, <No data fields>}, {<llvm::AlignedCharArray<1, 1>> = { buffer = ""}, <No data fields>}}}}, <No data fields>} M = 0xf1d9e0 HasBeenAddedButNotLoaded = true #8 0x00007ffff1d258af in lldb_private::IRExecutionUnit::GetRunnableInfo (this=0xf50980, error=..., func_addr=@0xe3eab8: 18446744073709551615, func_end=@0xe3eac0: 18446744073709551615) at /usr/local/google/home/labath/ll/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp:334 s_runnable_info_mutex = {m_mutex = {__data = {__lock = 1, __count = 1, __owner = 29073, __nusers = 1, __kind = 1, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = "\001\000\000\000\001\000\000\000\221q\000\000\001\000\000\000\001", '\000' <repeats 22 times>, __align = 4294967297}} process_sp = warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::process_gdb_remote::ProcessGDBRemote*, (__gnu_cxx::_Lock_policy)2>' warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::process_gdb_remote::ProcessGDBRemote*, (__gnu_cxx::_Lock_policy)2>' std::shared_ptr (count 8, weak 13) 0xd2c800 runnable_info_mutex_locker = { m_mutex_ptr = 0x7ffff5c48338 <lldb_private::IRExecutionUnit::GetRunnableInfo(lldb_private::Error&, unsigned long&, unsigned long&)::s_runnable_info_mutex>} log = 0x0 error_string = "" triple = {Data = "i386-unknown-linux-gnu", Arch = llvm::Triple::x86, SubArch = llvm::Triple::NoSubArch, Vendor = llvm::Triple::UnknownVendor, OS = llvm::Triple::Linux, Environment = llvm::Triple::GNU, ---Type <return> to continue, or q <return> to quit--- ObjectFormat = llvm::Triple::ELF} function = 0xf7c6e0 relocModel = llvm::Reloc::Static codeModel = llvm::CodeModel::JITDefault builder = {M = std::unique_ptr<llvm::Module> containing 0x0, WhichEngine = llvm::EngineKind::JIT, ErrorStr = 0x7fffffff99b0, OptLevel = llvm::CodeGenOpt::Less, MemMgr = std::shared_ptr (empty) 0x0, Resolver = std::shared_ptr (empty) 0x0, Options = {PrintMachineCode = 0, NoFramePointerElim = 0, LessPreciseFPMADOption = 0, UnsafeFPMath = 0, NoInfsFPMath = 0, NoNaNsFPMath = 0, HonorSignDependentRoundingFPMathOption = 0, UseSoftFloat = 0, NoZerosInBSS = 0, JITEmitDebugInfo = 0, JITEmitDebugInfoToDisk = 0, GuaranteedTailCallOpt = 0, DisableTailCalls = 0, StackAlignmentOverride = 0, EnableFastISel = 0, PositionIndependentExecutable = 0, UseInitArray = 0, DisableIntegratedAS = 0, CompressDebugSections = 0, FunctionSections = 0, DataSections = 0, UniqueSectionNames = 1, TrapUnreachable = 0, TrapFuncName = "", FloatABIType = llvm::FloatABI::Default, AllowFPOpFusion = llvm::FPOpFusion::Standard, JTType = llvm::JumpTable::Single, FCFI = false, ThreadModel = llvm::ThreadModel::POSIX, CFIType = llvm::CFIntegrity::Sub, CFIEnforcing = false, CFIFuncName = "", MCOptions = { SanitizeAddress = false, MCRelaxAll = false, MCNoExecStack = false, MCFatalWarnings = false, MCSaveTempLabels = false, MCUseDwarfDirectory = false, ShowMCEncoding = false, ShowMCInst = false, AsmVerbose = false, DwarfVersion = 0, ABIName = ""}}, RelocModel = llvm::Reloc::Static, CMModel = llvm::CodeModel::JITDefault, MArch = "", MCPU = "", MAttrs = {<llvm::SmallVectorImpl<std::basic_string<char> >> = {<llvm::SmallVectorTemplateBase<std::basic_string<char>, false>> = {<llvm::SmallVectorTemplateCommon<std::basic_string<char>, void>> = {<llvm::SmallVectorBase> = {BeginX = 0x7fffffff98f8, EndX = 0x7fffffff98f8, CapacityX = 0x7fffffff9918}, FirstEl = {<llvm::AlignedCharArray<8, 8>> = { buffer = "\230\231\377\377\377\177\000"}, <No data fields>}}, <No data fields>}, <No data fields>}, Storage = {InlineElts = {{<llvm::AlignedCharArray<8, 8>> = { buffer = " \231\377\377\377\177\000"}, <No data fields>}, {<llvm::AlignedCharArray<8, 8>> = { buffer = "\362j\271\360\377\377\377\377"}, <No data fields>}, {<llvm::AlignedCharArray<8, 8>> = { buffer = "\340\306\367\000\000\000\000"}, <No data fields>}}}}, VerifyModules = true, UseOrcMCJITReplacement = false} mArch = {static npos = 18446744073709551615, Data = 0x0, Length = 0} mCPU = {static npos = 18446744073709551615, Data = 0x0, Length = 0} mAttrs = {<llvm::SmallVectorImpl<std::basic_string<char> >> = {<llvm::SmallVectorTemplateBase<std::basic_string<char>, false>> = {<llvm::SmallVectorTemplateCommon<std::basic_string<char>, void>> = {<llvm::SmallVectorBase> = {BeginX = 0x7fffffff97f0, EndX = 0x7fffffff97f0, CapacityX = 0x7fffffff97f0}, FirstEl = {<llvm::AlignedCharArray<8, 8>> = { buffer = "p\230\377\377\377\177\000"}, <No data fields>}}, <No data fields>}, <No data fields>}, Storage = {<No data fields>}} target_machine = 0xf21010 fun_ptr = 0x1007ffff1a01e28 #9 0x00007ffff1d55bd2 in lldb_private::ClangExpressionParser::PrepareForExecution ( this=0x7fffffff9de8, func_addr=@0xe3eab8: 18446744073709551615, func_end=@0xe3eac0: 18446744073709551615, execution_unit_sp=warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::IRExecutionUnit*, (__gnu_cxx::_Lock_policy)2>' warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::IRExecutionUnit*, (__gnu_cxx::_Lock_policy)2>' std::shared_ptr (count 1, weak 1) 0xf50980, exe_ctx=..., can_interpret=@0x7fffffff9ddf: true, execution_policy=lldb_private::eExecutionPolicyAlways) at /usr/local/google/home/labath/ll/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp:589 ir_for_target = {<llvm::ModulePass> = {<llvm::Pass> = { _vptr$Pass = 0x7ffff5b311f0 <vtable for IRForTarget+16>, Resolver = 0x0, PassID = 0x7ffff5c483b8 <_ZL2ID>, Kind = llvm::PT_Module}, <No data fields>}, m_resolve_vars = false, m_func_name = "$__lldb_valid_pointer_check", m_result_name = { m_string = 0x0}, m_result_type = warning: RTTI symbol not found for class 'lldb_private::TaggedASTType<0u>' {<lldb_private::ClangASTType> = {m_type = 0x0, m_ast = 0x0}, _vptr$TaggedASTType = 0x7ffff5a83890 <vtable for lldb_private::TaggedASTType<0u>+16>}, m_module = 0xf1d9e0, ---Type <return> to continue, or q <return> to quit--- m_target_data = std::unique_ptr<llvm::DataLayout> containing 0xf7b100, m_decl_map = 0xe9fd30, m_data_allocator = {m_execution_unit = @0xf50980, m_stream_string = {<lldb_private::Stream> = { _vptr$Stream = 0x7ffff5b2e920 <vtable for lldb_private::StreamString+16>, m_flags = { m_flags = 8}, m_addr_size = 4, m_byte_order = lldb::eByteOrderLittle, m_indent_level = 0}, m_packet = ""}, m_allocation = 18446744073709551615}, m_CFStringCreateWithBytes = 0x0, m_sel_registerName = 0x0, m_intptr_ty = 0xf1cee0, m_error_stream = 0xb3f920, m_result_store = 0x0, m_result_is_pointer = false, m_reloc_placeholder = 0xf7f1d8, m_entry_instruction_finder = { m_maker = {<std::_Maybe_unary_or_binary_function<llvm::Value*, llvm::Function*>> = {<std::unary_function<llvm::Function*, llvm::Value*>> = {<No data fields>}, <No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = { _M_object = 0x7ffff1d61c50 <FindEntryInstruction(llvm::Function*)>, _M_const_object = 0x7ffff1d61c50 <FindEntryInstruction(llvm::Function*)>, _M_function_pointer = 0x7ffff1d61c50 <FindEntryInstruction(llvm::Function*)>, _M_member_pointer = <error reading variable>, _M_pod_data = "P\034\326\361\377\177\000\000d^\324\361\377\177\000"}, _M_manager = 0x7ffff1d70020 <std::_Function_base::_Base_manager<llvm::Value* (*)(llvm::Function*)>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)>}, _M_invoker = 0x7ffff1d6ffe0 <std::_Function_handler<llvm::Value* (llvm::Function*), llvm::Value* (*)(llvm::Function*)>::_M_invoke(std::_Any_data const&, llvm::Function*)>}, m_values = std::map with 0 elements}} ir_can_run = true process = 0xd2c800 error_stream = 0xb3f920 target = 0xd0b280 interpret_error = {m_code = 0, m_type = lldb::eErrorTypeInvalid, m_string = ""} log = 0x0 llvm_module_ap = std::unique_ptr<llvm::Module> containing 0x0 function_name = {m_string = 0xf03cf8 "$__lldb_valid_pointer_check"} decl_map = 0xe9fd30 err = {m_code = 0, m_type = lldb::eErrorTypeInvalid, m_string = ""} #10 0x00007ffff1d91bf6 in lldb_private::ClangUtilityFunction::Install (this=0xe3eaa0, error_stream=..., exe_ctx=...) at /usr/local/google/home/labath/ll/llvm/tools/lldb/source/Expression/ClangUtilityFunction.cpp:144 target = 0xd0b280 process = 0xd2c800 keep_result_in_memory = false generate_debug_info = true parser = {m_expr = @0xe3eaa0, m_llvm_context = std::unique_ptr<llvm::LLVMContext> containing 0x0, m_file_manager = std::unique_ptr<clang::FileManager> containing 0xefa6d0, m_compiler = std::unique_ptr<clang::CompilerInstance> containing 0xef9570, m_builtin_context = std::unique_ptr<clang::Builtin::Context> containing 0xed26e0, m_selector_table = std::unique_ptr<clang::SelectorTable> containing 0xea3c00, m_code_generator = std::unique_ptr<clang::CodeGenerator> containing 0xf1d810, m_pp_callbacks = 0x0} num_errors = 0 can_interpret = true jit_error = {m_code = 0, m_type = lldb::eErrorTypeInvalid, m_string = ""} #11 0x00007ffff1d5dc1e in lldb_private::DynamicCheckerFunctions::Install (this=0xe9f010, error_stream=..., exe_ctx=...) at /usr/local/google/home/labath/ll/llvm/tools/lldb/source/Expression/IRDynamicChecks.cpp:57 process = 0x7fffffff9fa0 #12 0x00007ffff1d55a22 in lldb_private::ClangExpressionParser::PrepareForExecution ( this=0x7fffffffa330, func_addr=@0xea8388: 18446744073709551615, func_end=@0xea8390: 18446744073709551615, execution_unit_sp=warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::IRExecutionUnit*, (__gnu_cxx::_Lock_policy)2>' warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::IRExecutionUnit*, (__gnu_cxx::_Lock_policy)2>' std::shared_ptr (count 1, weak 1) 0xf064b0, exe_ctx=..., can_interpret=@0xea8440: false, execution_policy=lldb_private::eExecutionPolicyOnlyWhenNeeded) ---Type <return> to continue, or q <return> to quit--- at /usr/local/google/home/labath/ll/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp:563 dynamic_checkers = 0xe9f010 install_errors = {<lldb_private::Stream> = { _vptr$Stream = 0x7ffff5b2e920 <vtable for lldb_private::StreamString+16>, m_flags = { m_flags = 0}, m_addr_size = 4, m_byte_order = lldb::eByteOrderBig, m_indent_level = 0}, m_packet = ""} ir_dynamic_checks = {<llvm::ModulePass> = {<llvm::Pass> = {_vptr$Pass = 0x7fffffffa0e8, Resolver = 0x7fffffffa348, PassID = 0x7fffffffa0d8, Kind = 4122151664}, <No data fields>}, m_func_name = "\320U\361\000\000\000\000\000@\023\361\000\000\000\000\000\320\325\355\000\000\000\000\000\220\353\343", '\000' <repeats 13 times>, "\360\310\322\000\000\000\000\000\000\310\322\000\000\000\000\000p\203\352\000\000\000\000\000P\202\343\000\000\000\000\000\030\000\000\000\000\000\000\000`\200\321\361\377\177\000\000\060\200\321\361\377\177\000\000@\204\355\000\000\000\000\000\243|\354\365\377\177\000\000`\200\321\361\377\177\000\000\060\200\321\361\377\177\000\000\200\262\320\000\000\000\000\000 \244\377\377\004\000\000\000\300_\323\000\000\000\000\000p\203\352\000\000\000\000\000\000\063\361\000\000\000\000\000 \244\377\377\377\177\000\000\001m\270\361\377\177\000\000\000\063\361\000\000\000\000\000\300\245\377\377\377\177\000\000"..., m_checker_functions = @0x7ffff1c1a326} ir_for_target = {<llvm::ModulePass> = {<llvm::Pass> = { _vptr$Pass = 0x7ffff5b311f0 <vtable for IRForTarget+16>, Resolver = 0x0, PassID = 0x7ffff5c483b8 <_ZL2ID>, Kind = llvm::PT_Module}, <No data fields>}, m_resolve_vars = true, m_func_name = "_ZN1AIiE12$__lldb_exprEPv", m_result_name = { m_string = 0xf03be0 "$RESULT_NAME"}, m_result_type = warning: RTTI symbol not found for class 'lldb_private::TaggedASTType<0u>' {<lldb_private::ClangASTType> = { m_type = 0xf0b530, m_ast = 0xe39ee0}, _vptr$TaggedASTType = 0x7ffff5a83890 <vtable for lldb_private::TaggedASTType<0u>+16>}, m_module = 0xf0d4a0, m_target_data = std::unique_ptr<llvm::DataLayout> containing 0xe14f30, m_decl_map = 0xedb440, m_data_allocator = {m_execution_unit = @0xf064b0, m_stream_string = {<lldb_private::Stream> = { _vptr$Stream = 0x7ffff5b2e920 <vtable for lldb_private::StreamString+16>, m_flags = { m_flags = 8}, m_addr_size = 4, m_byte_order = lldb::eByteOrderLittle, m_indent_level = 0}, m_packet = ""}, m_allocation = 18446744073709551615}, m_CFStringCreateWithBytes = 0x0, m_sel_registerName = 0x0, m_intptr_ty = 0xf0ca60, m_error_stream = 0xb3f920, m_result_store = 0x0, m_result_is_pointer = true, m_reloc_placeholder = 0xe3e9c8, m_entry_instruction_finder = { m_maker = {<std::_Maybe_unary_or_binary_function<llvm::Value*, llvm::Function*>> = {<std::unary_function<llvm::Function*, llvm::Value*>> = {<No data fields>}, <No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = { _M_object = 0x7ffff1d61c50 <FindEntryInstruction(llvm::Function*)>, _M_const_object = 0x7ffff1d61c50 <FindEntryInstruction(llvm::Function*)>, _M_function_pointer = 0x7ffff1d61c50 <FindEntryInstruction(llvm::Function*)>, _M_member_pointer = <error reading variable>, _M_pod_data = "P\034\326\361\377\177\000\000d^\324\361\377\177\000"}, _M_manager = 0x7ffff1d70020 <std::_Function_base::_Base_manager<llvm::Value* (*)(llvm::Function*)>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)>}, _M_invoker = 0x7ffff1d6ffe0 <std::_Function_handler<llvm::Value* (llvm::Function*), llvm::Value* (*)(llvm::Function*)>::_M_invoke(std::_Any_data const&, llvm::Function*)>}, m_values = std::map with 1 elements = {[0xea1da0] = 0xea2428}}} ir_can_run = true process = 0xd2c800 error_stream = 0xb3f920 target = 0xd0b280 interpret_error = {m_code = 4294967295, m_type = lldb::eErrorTypeGeneric, m_string = "Interpreter doesn't handle one of the expression's opcodes"} log = 0x0 llvm_module_ap = std::unique_ptr<llvm::Module> containing 0x0 function_name = {m_string = 0xf03bb0 "_ZN1AIiE12$__lldb_exprEPv"} decl_map = 0xedb440 err = {m_code = 0, m_type = lldb::eErrorTypeInvalid, m_string = ""} #13 0x00007ffff1d15d82 in lldb_private::ClangUserExpression::Parse (this=0xea8370, error_stream=..., ---Type <return> to continue, or q <return> to quit--- exe_ctx=..., execution_policy=lldb_private::eExecutionPolicyOnlyWhenNeeded, keep_result_in_memory=true, generate_debug_info=false) at /usr/local/google/home/labath/ll/llvm/tools/lldb/source/Expression/ClangUserExpression.cpp:560 log = 0x0 err = {m_code = 0, m_type = lldb::eErrorTypeInvalid, m_string = ""} m_transformed_stream = {<lldb_private::Stream> = { _vptr$Stream = 0x7ffff5b2e920 <vtable for lldb_private::StreamString+16>, m_flags = { m_flags = 0}, m_addr_size = 4, m_byte_order = lldb::eByteOrderBig, m_indent_level = 0}, m_packet = ""} prefix = "" source_code = std::unique_ptr<lldb_private::ExpressionSourceCode> containing 0xd35fc0 lang_type = lldb::eLanguageTypeC_plus_plus target = 0xd0b280 on_exit = { m_callback = {<std::_Maybe_unary_or_binary_function<void>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = { _M_object = 0xed8440, _M_const_object = 0xed8440, _M_function_pointer = 0xed8440, _M_member_pointer = <error reading variable>, _M_pod_data = "@\204\355\000\000\000\000\000\243|\354\365\377\177\000"}, _M_manager = 0x7ffff1d18060 <std::_Function_base::_Base_manager<lldb_private::ClangUserExpression::Parse(lldb_private::Stream&, lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool)::$_1>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)>}, _M_invoker = 0x7ffff1d18030 <std::_Function_handler<void (), lldb_private::ClangUserExpression::Parse(lldb_private::Stream&, lldb_private::ExecutionContext&, lldb_private::ExecutionPolicy, bool, bool)::$_1>::_M_invoke(std::_Any_data const&)>}} process = 0xd2c800 exe_scope = 0xd2c8f0 parser = {m_expr = @0xea8370, m_llvm_context = std::unique_ptr<llvm::LLVMContext> containing 0x0, m_file_manager = std::unique_ptr<clang::FileManager> containing 0xf15290, m_compiler = std::unique_ptr<clang::CompilerInstance> containing 0xf155d0, m_builtin_context = std::unique_ptr<clang::Builtin::Context> containing 0xf11340, m_selector_table = std::unique_ptr<clang::SelectorTable> containing 0xedd5d0, m_code_generator = std::unique_ptr<clang::CodeGenerator> containing 0xe3eb90, m_pp_callbacks = 0x0} num_errors = 0 jit_error = {m_code = 0, m_type = lldb::eErrorTypeInvalid, m_string = ""} #14 0x00007ffff1d178ff in lldb_private::ClangUserExpression::Evaluate (exe_ctx=..., options=..., expr_cstr=0xf155ab "(int)getpid(); m_a", expr_prefix=0x0, result_valobj_sp=..., error=...) at /usr/local/google/home/labath/ll/llvm/tools/lldb/source/Expression/ClangUserExpression.cpp:1041 log = 0x0 execution_policy = lldb_private::eExecutionPolicyOnlyWhenNeeded language = lldb::eLanguageTypeUnknown desired_type = lldb_private::ClangExpression::eResultTypeAny execution_results = lldb::eExpressionSetupError process = 0xd2c800 user_expression_sp = warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::ClangUserExpression*, (__gnu_cxx::_Lock_policy)2>' warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::ClangUserExpression*, (__gnu_cxx::_Lock_policy)2>' std::shared_ptr (count 1, weak 0) 0xea8370 error_stream = {<lldb_private::Stream> = { _vptr$Stream = 0x7ffff5b2e920 <vtable for lldb_private::StreamString+16>, m_flags = { m_flags = 0}, m_addr_size = 4, m_byte_order = lldb::eByteOrderBig, m_indent_level = 0}, m_packet = "warning: function 'getpid' has internal linkage but is not defined\nnote: used here\n"} keep_expression_in_memory = true generate_debug_info = false #15 0x00007ffff1f09bcb in lldb_private::Target::EvaluateExpression (this=0xd0b280, expr_cstr=0xf155ab "(int)getpid(); m_a", frame=0x7fffd800bae0, result_valobj_sp=..., options=...) at /usr/local/google/home/labath/ll/llvm/tools/lldb/source/Target/Target.cpp:2020 prefix = 0x0 ---Type <return> to continue, or q <return> to quit--- error = {m_code = 0, m_type = lldb::eErrorTypeInvalid, m_string = ""} execution_results = lldb::eExpressionSetupError old_suppress_value = false exe_ctx = {m_target_sp = warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::Target*, (__gnu_cxx::_Lock_policy)2>' warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::Target*, (__gnu_cxx::_Lock_policy)2>' std::shared_ptr (count 20, weak 12) 0xd0b280, m_process_sp = warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::process_gdb_remote::ProcessGDBRemote*, (__gnu_cxx::_Lock_policy)2>' warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::process_gdb_remote::ProcessGDBRemote*, (__gnu_cxx::_Lock_policy)2>' std::shared_ptr (count 8, weak 13) 0xd2c800, m_thread_sp = warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::process_gdb_remote::ThreadGDBRemote*, (__gnu_cxx::_Lock_policy)2>' warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::process_gdb_remote::ThreadGDBRemote*, (__gnu_cxx::_Lock_policy)2>' std::shared_ptr (count 7, weak 12) 0xd3df20, m_frame_sp = warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::StackFrame*, (__gnu_cxx::_Lock_policy)2>' warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::StackFrame*, (__gnu_cxx::_Lock_policy)2>' std::shared_ptr (count 6, weak 1) 0x7fffd800bae0} persistent_var_sp = std::shared_ptr (empty) 0x0 #16 0x00007ffff21841f9 in lldb_private::CommandObjectExpression::EvaluateExpression (this=0xb459e0, expr=0xf155ab "(int)getpid(); m_a", output_stream=0xd1a1b0, error_stream=0xd1a208, result=0xd1a1b0) at /usr/local/google/home/labath/ll/llvm/tools/lldb/source/Commands/CommandObjectExpression.cpp:312 result_valobj_sp = {ptr_ = 0x0, cntrl_ = 0x0} keep_in_memory = true options = {static default_timeout = 500000, m_execution_policy = lldb_private::eExecutionPolicyOnlyWhenNeeded, m_language = lldb::eLanguageTypeUnknown, m_coerce_to_id = false, m_unwind_on_error = true, m_ignore_breakpoints = true, m_keep_in_memory = true, m_try_others = true, m_stop_others = true, m_debug = false, m_trap_exceptions = true, m_generate_debug_info = false, m_result_is_internal = false, m_use_dynamic = lldb::eNoDynamicValues, m_timeout_usec = 0, m_one_thread_timeout_usec = 0, m_cancel_callback = 0x0, m_cancel_callback_baton = 0x0} exe_ctx = {m_target_sp = warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::Target*, (__gnu_cxx::_Lock_policy)2>' warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::Target*, (__gnu_cxx::_Lock_policy)2>' std::shared_ptr (count 20, weak 12) 0xd0b280, m_process_sp = warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::process_gdb_remote::ProcessGDBRemote*, (__gnu_cxx::_Lock_policy)2>' warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::process_gdb_remote::ProcessGDBRemote*, (__gnu_cxx::_Lock_policy)2>' std::shared_ptr (count 8, weak 13) 0xd2c800, m_thread_sp = warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::process_gdb_remote::ThreadGDBRemote*, (__gnu_cxx::_Lock_policy)2>' warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::process_gdb_remote::ThreadGDBRemote*, (__gnu_cxx::_Lock_policy)2>' std::shared_ptr (count 7, weak 12) 0xd3df20, m_frame_sp = warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::StackFrame*, (__gnu_cxx::_Lock_policy)2>' warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<lldb_private::StackFrame*, (__gnu_cxx::_Lock_policy)2>' std::shared_ptr (count 6, weak 1) 0x7fffd800bae0} target = 0xd0b280 #17 0x00007ffff2184cd1 in lldb_private::CommandObjectExpression::DoExecute (this=0xb459e0, command=0xf155a8 "-- (int)getpid(); m_a", result=...) at /usr/local/google/home/labath/ll/llvm/tools/lldb/source/Commands/CommandObjectExpression.cpp:514 expr = 0xf155ab "(int)getpid(); m_a" #18 0x00007ffff1db7052 in lldb_private::CommandObjectRaw::Execute (this=0xb459e0, args_string=0xf155a8 "-- (int)getpid(); m_a", result=...) at /usr/local/google/home/labath/ll/llvm/tools/lldb/source/Interpreter/CommandObject.cpp:1103 handled = false
Steps to reproduce:
build lldb
cd test
./dotest.py -A x86 --executable path/to/built/lldb -p TestCPPThis.py
The expression we are evaluating is "(int)getpid(); m_a" (where m_a is a local variable), but I think it happens on pretty much any expression. Please let me know if I can somehow help you with this.
Hi Pavel, I'm finally getting around to trying to track down the LLDB failure and reapplying this. I had a patch that I thought should fix this, but I'm still getting failures with ninja check-lldb even though the command you listed succeeds. Any ideas on how I can reproduce outside the test suite?
Hello,
I would compare the list of test suite failures before and after applying your patch. If the results are the same then I think you are good to go.
Also, which system are you working on? We are trying to keep the linux build green (although failures still do creep up pretty often), but the Mac build is pretty much constantly red.
Judging by the tests that were failing originally, I think the original patch broke LLDB expression evaluation completely, so I think you can reproduce it by just loading any program into LLDB and evaluating random expressions. I.e., something like this:
labath /tmp $ cat a.cc #include <cstdio> int main() { int a = 4; int b = 7; printf("%d\n", a+b); return 0; } labath /tmp $ clang -g a.cc labath /tmp $ ~/ll/build/dbg/bin/lldb a.out (lldb) target create "a.out" Current executable set to 'a.out' (x86_64). (lldb) b 6 Breakpoint 1: where = a.out`main + 39 at a.cc:6, address = 0x0000000000400557 (lldb) r Process 11820 launched: '/tmp/a.out' (x86_64) Process 11820 stopped * thread #1: tid = 11820, 0x0000000000400557 a.out`main + 39 at a.cc:6, name = 'a.out', stop reason = breakpoint 1.1 frame #0: 0x0000000000400557 a.out`main + 39 at a.cc:6 3 int main() { 4 int a = 4; 5 int b = 7; -> 6 printf("%d\n", a+b); 7 return 0; 8 } (lldb) expr a (int) $0 = 4 (lldb) expr a+b (int) $1 = 11 (lldb) expr getpid() error: 'getpid' has unknown return type; cast the call to its declared return type error: 1 errors parsing expression (lldb) expr (int)getpid() (int) $2 = 11820 ...
Is this what you had in mind? If you want to reproduce a specific test case, you can go into the test/ directory and find the corresponding .py file. Inside you should find the exact expressions it is trying to evaluate, and in the same folder you can find the .c file, which it is testing. However, it is usually just easier to use the test runner (dotest.py) to run a single test case (you can run dotest in a debugger if you like).
Also, feel free to drop me a revised version of the patch. I'd be happy to check it out locally and see if things work now.
cheers,
pl
I tried a few things for expression evaluation and they worked fine. I'm looking into it more. For the record the patch I thought would fix the problem is:
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index a13ecb7..24a3ec1 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -574,10 +574,16 @@ unsigned RuntimeDyldImpl::emitSection(const ObjectFile &Obj, uint8_t *Addr; const char *pData = nullptr; + // In either case, set the location of the unrelocated section in memory, + // since we still process relocations for it even if we're not applying them. + Check(Section.getContents(data)); + // Virtual sections have no data in the object image, so leave pData = 0 + if (!IsVirtual) + pData = data.data(); + // Some sections, such as debug info, don't need to be loaded for execution. // Leave those where they are. if (IsRequired) { - Check(Section.getContents(data)); Allocate = DataSize + PaddingSize + StubBufSize; if (!Allocate) Allocate = 1; @@ -588,10 +594,6 @@ unsigned RuntimeDyldImpl::emitSection(const ObjectFile &Obj, if (!Addr) report_fatal_error("Unable to allocate section memory!"); - // Virtual sections have no data in the object image, so leave pData = 0 - if (!IsVirtual) - pData = data.data(); - // Zero-initialize or copy the data from the image if (IsZeroInit || IsVirtual) memset(Addr, 0, DataSize);
Hi Pavel, just to be sure, I ran the tests again without both patches and the same tests fail (I didn't see them a couple of weeks ago), but they seem to be unrelated to this patch now. Can you verify that reapplying my patch plus the additional patch I just posted works for you as well?
Hi,
I just tested the patch + the update and everything works fine. OK to commit. Thanks for fixing this.
cheers,
pl