llvm-project/lldb/source
Michael Buch 88d3c1db45 [lldb][ClangExpression] Add asm() label to all FunctionDecls we create from DWARF
When resolving symbols during IR execution, lldb makes a last effort attempt
to resolve external symbols from object files by approximate name matching.
It currently uses `CPlusPlusNameParser` to parse the demangled function name
and arguments for the unresolved symbol and its candidates. However, this
hand-rolled C++ parser doesn’t support ABI tags which, depending on the demangler,
get demangled into `[abi:tag]`. This lack of parsing support causes lldb to never
consider a candidate mangled function name that has ABI tags.

The issue reproduces by calling an ABI-tagged template function from the
expression evaluator. This is particularly problematic with the recent
addition of ABI tags to numerous libcxx APIs.

The issue stems from the fact that `clang::CodeGen` emits function
function calls using the mangled name inferred from the `FunctionDecl`
LLDB constructs from DWARF. Debug info often lacks information for
us to construct a perfect FunctionDecl resulting in subtle mangled
name inaccuracies.

This patch side-steps the problem of inaccurate `FunctionDecl`s by
attaching an `asm()` label to each `FunctionDecl` LLDB creates from DWARF.
`clang::CodeGen` consults this label to get the mangled name as one of
the first courses of action when emitting a function call.

LLDB already does this for C++ member functions as of
[675767a591](https://reviews.llvm.org/D40283)

**Testing**

* Added API tests

Differential Revision: https://reviews.llvm.org/D131974
2022-08-17 09:02:43 +01:00
..
API [lldb] Automatically unwrap parameter packs in template argument accessors 2022-08-16 18:10:14 -07:00
Breakpoint Implement better path matching in FileSpecList::FindCompatibleIndex(...). 2022-08-08 15:20:38 -07:00
Commands Revert "[LLDB][NFC] Fix optons parsing and misc. reliability in CommandObjectThread" 2022-08-16 18:11:28 -07:00
Core [lldb] Fetching symbols in the background with dsymForUUID 2022-08-15 17:57:24 -07:00
DataFormatters Move FormattersMatchCandidate flags to a struct. 2022-08-09 10:48:49 -07:00
Expression [LLDB] Add basic floating point ops to IR interpreter 2022-08-10 16:34:52 +03:00
Host [lldb] Fix warning: comparison of integers of different signs 2022-08-15 11:25:46 -07:00
Initialization [lldb] Remove FileSystem::Initialize from FileCollector 2022-03-03 13:22:38 -08:00
Interpreter [lldb] LLVM_FALLTHROUGH => [[fallthrough]]. NFC 2022-08-08 11:31:49 -07:00
Plugins [lldb][ClangExpression] Add asm() label to all FunctionDecls we create from DWARF 2022-08-17 09:02:43 +01:00
Symbol [lldb] Automatically unwrap parameter packs in template argument accessors 2022-08-16 18:10:14 -07:00
Target Use llvm::all_of (NFC) 2022-08-14 16:25:36 -07:00
Utility [LLDB][JIT] Set processor for ARM architecture 2022-08-17 09:10:21 +03:00
Version [lldb] Fix LLDB_FULL_VERSION_STRING 2022-01-19 14:20:22 -08:00
CMakeLists.txt [lldb] Make lldbVersion a full fledged library 2021-12-08 15:14:34 -08:00