[clang-repl] Last value printing fails in out of process mode
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
I see the following
```
(xeus-cpp) abhinav@Abhinavs-MacBook-Air build % ./bin/clang-repl -oop-executor -orc-runtime -Xcc="-g" -Xcc="-O0" -Xcc="-debugger-tuning=lldb"
clang-repl> 1
JIT session error: Symbols not found: [ ___clang_Interpreter_SetValueNoAlloc ]
error: dlupdate failed
clang-repl>
```
In in-process mode
```
clang-repl> 1
(int) 1
```
When run using `--debug-only=orc` flag I see this difference
1) in-process
```
Looking up { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) } in [ ("main", MatchAllSymbols), ("", MatchExportedSymbolsOnly), ("", MatchExportedSymbolsOnly) ] (required state: Resolved)
Dispatching MaterializationUnits...
Done dispatching MaterializationUnits.
Entering OL_applyQueryPhase1:
Lookup kind: Static
Search order: [ ("main", MatchAllSymbols), ("", MatchExportedSymbolsOnly), ("", MatchExportedSymbolsOnly) ], Current index = 0 (entering new JITDylib)
Lookup set: { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
Definition generator candidates: { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
Definition generator non-candidates: { }
Visiting "main" (MatchAllSymbols) with lookup set { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }:
First time visiting main, resetting candidate sets and building generator stack
Updating candidate set...
Remaining candidates = { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
No generators to run for this JITDylib.
Phase 1 moving to next JITDylib.
Visiting "" (MatchExportedSymbolsOnly) with lookup set { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }:
First time visiting , resetting candidate sets and building generator stack
Updating candidate set...
Remaining candidates = { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
No generators to run for this JITDylib.
Phase 1 moving to next JITDylib.
Visiting "" (MatchExportedSymbolsOnly) with lookup set { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }:
First time visiting , resetting candidate sets and building generator stack
Updating candidate set...
Remaining candidates = { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
Running 1 remaining generators for 1 candidates
Attempting to generate { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
EPCDynamicLibrarySearchGenerator trying to generate { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
EPCDynamicLibrarySearchGenerator lookup returned { ("__clang_Interpreter_SetValueNoAlloc": 0x55555a34ec22 [Data]) }
Defining MU for (tracker: 0x0, default will be used)
{ ("__clang_Interpreter_SetValueNoAlloc", [Data]) }
Entering OL_applyQueryPhase1:
Lookup kind: Static
Search order: [ ("main", MatchAllSymbols), ("", MatchExportedSymbolsOnly), ("", MatchExportedSymbolsOnly) ], Current index = 2
Lookup set: { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
Definition generator candidates: { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
Definition generator non-candidates: { }
Visiting "" (MatchExportedSymbolsOnly) with lookup set { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }:
Updating candidate set...
Remaining candidates = { }
No generators to run for this JITDylib.
All symbols matched.
Phase 1 succeeded.
Entering OL_completeLookup:
Lookup kind: Static
Search order: [ ("main", MatchAllSymbols), ("", MatchExportedSymbolsOnly), ("", MatchExportedSymbolsOnly) ], Current index = 3
Lookup set: { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
Definition generator candidates: { }
Definition generator non-candidates: { }
Visiting "main" (MatchAllSymbols) with lookup set { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }:
Attempting to match "__clang_Interpreter_SetValueNoAlloc" (RequiredSymbol)... skipping: not present
Visiting "" (MatchExportedSymbolsOnly) with lookup set { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }:
Attempting to match "__clang_Interpreter_SetValueNoAlloc" (RequiredSymbol)... skipping: not present
Visiting "" (MatchExportedSymbolsOnly) with lookup set { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }:
Attempting to match "__clang_Interpreter_SetValueNoAlloc" (RequiredSymbol)... matched, preparing to dispatch MU@0x55556cfeee70 ()
Stripping unmatched weakly-referenced symbols
Query successfully lodged
Adding MUs to dispatch:
For : Adding 1 MUs.
Registering dependencies
Dispatching MaterializationUnits...
Dispatching ""
Dispatching: Materialization task: in
In resolving { ("__clang_Interpreter_SetValueNoAlloc": 0x55555a34ec22 [Data]) }
Dispatching: Execute query complete callback for { ("__clang_Interpreter_SetValueNoAlloc": 0x55555a34ec22 [Data]) }
```
2) out of process
```
Looking up { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) } in [ ("main", MatchAllSymbols), ("", MatchExportedSymbolsOnly), ("", MatchExportedSymbolsOnly) ] (required state: Resolved)
Dispatching MaterializationUnits...
Done dispatching MaterializationUnits.
Entering OL_applyQueryPhase1:
Lookup kind: Static
Search order: [ ("main", MatchAllSymbols), ("", MatchExportedSymbolsOnly), ("", MatchExportedSymbolsOnly) ], Current index = 0 (entering new JITDylib)
Lookup set: { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
Definition generator candidates: { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
Definition generator non-candidates: { }
Visiting "main" (MatchAllSymbols) with lookup set { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }:
First time visiting main, resetting candidate sets and building generator stack
Updating candidate set...
Remaining candidates = { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
No generators to run for this JITDylib.
Phase 1 moving to next JITDylib.
Visiting "" (MatchExportedSymbolsOnly) with lookup set { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }:
First time visiting , resetting candidate sets and building generator stack
Updating candidate set...
Remaining candidates = { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
Running 1 remaining generators for 1 candidates
Attempting to generate { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
Updating candidate set post-generation
Phase 1 moving to next JITDylib.
Visiting "" (MatchExportedSymbolsOnly) with lookup set { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }:
First time visiting , resetting candidate sets and building generator stack
Updating candidate set...
Remaining candidates = { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
Running 1 remaining generators for 1 candidates
Attempting to generate { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
EPCDynamicLibrarySearchGenerator trying to generate { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
SimpleRemoteEPC::sendMessage: opc = CallWrapper, seqno = 34, tag-addr = 0x5555555d5a44, arg-buffer = 0x3c bytes
LookupState captured. Exiting phase1 for now.
SimpleRemoteEPC::handleMessage: opc = Result, seqno = 34, tag-addr = 0x0, arg-buffer = 0x14 bytes
EPCDynamicLibrarySearchGenerator lookup returned { }
Entering OL_applyQueryPhase1:
Lookup kind: Static
Search order: [ ("main", MatchAllSymbols), ("", MatchExportedSymbolsOnly), ("", MatchExportedSymbolsOnly) ], Current index = 2
Lookup set: { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
Definition generator candidates: { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
Definition generator non-candidates: { }
Visiting "" (MatchExportedSymbolsOnly) with lookup set { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }:
Updating candidate set...
Remaining candidates = { (__clang_Interpreter_SetValueNoAlloc, RequiredSymbol) }
No generators to run for this JITDylib.
Phase 1 moving to next JITDylib.
Phase 1 failed with unresolved symbols.
SimpleRemoteEPC::sendMessage: opc = CallWrapper, seqno = 35, tag-addr = 0x5555555e47b0, arg-buffer = 0x18 bytes
SimpleRemoteEPC::handleMessage: opc = Result, seqno = 35, tag-addr = 0x0, arg-buffer = 0x1 bytes
JIT session error: Symbols not found: [ __clang_Interpreter_SetValueNoAlloc ]
```
Contributor guide
Research direction
Start by reproducing the failure with clang-repl using -oop-executor and -orc-runtime, then compare the out-of-process and in-process symbol lookup for __clang_Interpreter_SetValueNoAlloc. Done means evaluating 1 in out-of-process mode prints (int) 1 without an unresolved-symbol or dlupdate error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- devtools
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100