🍒 [lldb][IRExecutionUnit] Return error on failure to resolve function address #11536
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Starting with llvm#148877 we started encoding the module ID of the function DIE we are currently parsing into its
AsmLabel
in the AST. When the JIT asks LLDB to resolve our special mangled name, we would locate the module and resolve the function/symbol we found in it.If we are debugging with a
SymbolFileDWARFDebugMap
, the module ID we encode is that of the.o
file that is tracked by the debug-map. To resolve the address of the DIE in that.o
file, we have to askSymbolFileDWARFDebugMap::LinkOSOAddress
to turn the address of the.o
DIE into a real address in the linked executable. This will only work if the.o
address was actually tracked by the debug-map. However, if the function definition appears in multiple.o
files (which is the case for functions defined in headers), the linker will most likely de-deuplicate that definition. So most.o
's definition DIEs for that function won't have a contribution in the debug-map, and thus we fail to resolve the address.When debugging Clang on Darwin, e.g., you'd see:
unless you were stopped in the
.o
file whose definition ofgetName
made it into the final executable.The fix here is to error out if we fail to resolve the address, causing us to fall back on the old flow which did a lookup by mangled name, which the
SymbolFileDWARFDebugMap
will handle correctly.An alternative fix to this would be to encode the
SymbolFileDWARFDebugMap
's module-id. And implementSymbolFileDWARFDebugMap::ResolveFunctionCallLabel
by doing a mangled name lookup. The proposed approach doesn't stop us from implementing that, so we could choose to do it in a follow-up.rdar://161393045
(cherry-picked from 332b4de)