diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2025-10-01 08:37:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-01 08:37:15 +0100 |
commit | 332b4deb0dfe9f4d11325513d4122e69024beea9 (patch) | |
tree | 8b8a1fafecf01805b5ada9d3575f1aee534925eb /clang-tools-extra/clang-tidy/linuxkernel/LinuxKernelTidyModule.cpp | |
parent | 8c5c37582e909232dc5810c4809c2bd1a22fbe1b (diff) | |
download | llvm-332b4deb0dfe9f4d11325513d4122e69024beea9.zip llvm-332b4deb0dfe9f4d11325513d4122e69024beea9.tar.gz llvm-332b4deb0dfe9f4d11325513d4122e69024beea9.tar.bz2 |
[lldb][IRExecutionUnit] Return error on failure to resolve function address (#161363)
Starting with https://github.com/llvm/llvm-project/pull/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 ask
`SymbolFileDWARFDebugMap::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:
```
(lldb) expr CXXDecl->getName()
error: Couldn't look up symbols:
$__lldb_func::0x1:0x4000d000002359da:_ZNK5clang9NamedDecl7getNameEv
Hint: The expression tried to call a function that is not present in the target, perhaps because it was optimized out by the compiler.
```
unless you were stopped in the `.o` file whose definition of `getName`
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 implement
`SymbolFileDWARFDebugMap::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
Diffstat (limited to 'clang-tools-extra/clang-tidy/linuxkernel/LinuxKernelTidyModule.cpp')
0 files changed, 0 insertions, 0 deletions