llvm-project/lldb/source/Plugins
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
..
ABI [lldb][ARC] Fix -Wtautological-bitwise-compare warning 2022-08-13 00:18:37 -07:00
Architecture [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
Disassembler Move GetControlFlowKind's logic to DisassemblerLLVMC.cpp 2022-07-26 12:05:23 -07:00
DynamicLoader Use llvm::is_contained (NFC) 2022-08-07 00:16:17 -07:00
ExpressionParser LLVM_NODISCARD => [[nodiscard]]. NFC 2022-08-09 07:16:34 +00:00
Instruction [lldb] Fix warnings 2022-08-16 12:33:21 -07:00
InstrumentationRuntime [LLDB][NFC] Fix memory leak in IntstumentationRuntimeTSan.cpp 2022-08-16 14:34:50 -07:00
JITLoader [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
Language [lldb] LLVM_FALLTHROUGH => [[fallthrough]]. NFC 2022-08-08 11:31:49 -07:00
LanguageRuntime LLVM_NODISCARD => [[nodiscard]]. NFC 2022-08-09 07:16:34 +00:00
MemoryHistory [lldb] Migrate runtime instrumentation plugins to ReportWarning 2022-03-16 23:20:58 -07:00
ObjectContainer [lldb] Add support to load object files from thin archives 2022-07-05 10:52:26 +02:00
ObjectFile [LLDB][NFC] Reliability fixes for ObjectFileMachO.cpp (part 2) 2022-08-11 21:08:18 -07:00
OperatingSystem [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
Platform [lldb] LLVM_FALLTHROUGH => [[fallthrough]]. NFC 2022-08-08 11:31:49 -07:00
Process [LLDB][RISCV] Make software single stepping work 2022-08-16 23:44:50 +08:00
REPL [LLDB] Applying clang-tidy modernize-use-equals-default over LLDB 2022-03-31 13:21:49 -07:00
ScriptInterpreter [lldb] Remove uses of six module (NFC) 2022-08-11 19:06:15 -07:00
StructuredData [lldb] Report debugger diagnostics as events 2022-03-16 08:33:01 -07:00
SymbolFile [lldb][ClangExpression] Add asm() label to all FunctionDecls we create from DWARF 2022-08-17 09:02:43 +01:00
SymbolVendor [LLDB][NFC] Fix possible resource leak 2022-07-27 13:19:13 -07:00
SystemRuntime [LLDB][NFC][Reliability] Fixes for int overflow and uninitialized state 2022-07-29 13:31:17 -07:00
Trace [NFC][trace][intel pt] add simple documentation line 2022-08-15 00:56:12 -07:00
TraceExporter [trace] Add SBTraceCursor bindings 2022-08-02 16:55:33 -07:00
TypeSystem fold assert-only variable into assert to address non-assert -Wunused-variable 2022-08-17 04:10:59 +00:00
UnwindAssembly [NFC] Remove no-op code from x86AssemblyInspectionEngine::jmp_to_reg_p 2022-08-02 16:28:10 -07:00
CMakeLists.txt [lldb] Add a C language REPL to test LLDB's REPL infrastructure 2021-09-23 19:31:02 +02:00
Plugins.def.in