llvm-project/lldb/source/Plugins/SymbolFile/DWARF
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
..
AppleDWARFIndex.cpp Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
AppleDWARFIndex.h Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
CMakeLists.txt [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code 2022-06-02 14:44:07 +00:00
DIERef.cpp Cache the manual DWARF index out to the LLDB cache directory when the LLDB index cache is enabled. 2021-12-28 11:00:28 -08:00
DIERef.h [lldb] Use single-argument static_assert where applicable (NFC) 2022-08-07 14:26:08 -07:00
DWARFASTParser.cpp [lldb][NFC] Move non-clang specific method to the generic DWARF Parser 2022-06-02 16:39:39 +00:00
DWARFASTParser.h Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
DWARFASTParserClang.cpp [lldb][ClangExpression] Add asm() label to all FunctionDecls we create from DWARF 2022-08-17 09:02:43 +01:00
DWARFASTParserClang.h Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
DWARFAbbreviationDeclaration.cpp [LLDB] Applying clang-tidy modernize-use-default-member-init over LLDB 2022-03-14 13:32:03 -07:00
DWARFAbbreviationDeclaration.h [lldb] Use C++11 default member initializers 2021-06-09 09:43:13 -07:00
DWARFAttribute.cpp [LLDB] Remove cases of using namespace llvm:: from header file 2022-03-03 10:39:06 -08:00
DWARFAttribute.h
DWARFBaseDIE.cpp
DWARFBaseDIE.h [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
DWARFCompileUnit.cpp
DWARFCompileUnit.h
DWARFContext.cpp
DWARFContext.h
DWARFDIE.cpp [DebugInfo] Teach LLVM and LLDB about ptrauth in DWARF 2022-07-27 11:48:35 -07:00
DWARFDIE.h Reland "[LLDB][NFC] Decouple dwarf location table from DWARFExpression." 2022-07-12 10:54:24 -07:00
DWARFDataExtractor.cpp
DWARFDataExtractor.h
DWARFDebugAbbrev.cpp [LLDB] Remove cases of using namespace std 2022-03-04 12:50:25 -08:00
DWARFDebugAbbrev.h [lldb] Use C++11 default member initializers 2021-06-09 09:43:13 -07:00
DWARFDebugArangeSet.cpp [lldb] Convert DWARF log to the new API 2022-01-28 10:41:10 +01:00
DWARFDebugArangeSet.h
DWARFDebugAranges.cpp [lldb] Convert DWARF log to the new API 2022-01-28 10:41:10 +01:00
DWARFDebugAranges.h
DWARFDebugInfo.cpp [LLDB] Remove cases of using namespace std 2022-03-04 12:50:25 -08:00
DWARFDebugInfo.h [nfc] [lldb] Removed unused DWARFDebugInfo::GetDIEForDIEOffset 2021-08-01 00:38:01 +02:00
DWARFDebugInfoEntry.cpp [lldb] LLVM_FALLTHROUGH => [[fallthrough]]. NFC 2022-08-08 11:31:49 -07:00
DWARFDebugInfoEntry.h Reland "[LLDB][NFC] Decouple dwarf location table from DWARFExpression." 2022-07-12 10:54:24 -07:00
DWARFDebugMacro.cpp [LLDB] Remove cases of using namespace llvm:: from header file 2022-03-03 10:39:06 -08:00
DWARFDebugMacro.h [lldb] Default initialize DWARFDebugMacroHeader 2022-02-16 10:38:05 -08:00
DWARFDebugRanges.cpp
DWARFDebugRanges.h
DWARFDeclContext.cpp [LLDB] Remove cases of using namespace llvm:: from header file 2022-03-03 10:39:06 -08:00
DWARFDeclContext.h [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
DWARFDefines.cpp
DWARFDefines.h
DWARFFormValue.cpp [LLDB] Remove cases of using namespace llvm:: from header file 2022-03-03 10:39:06 -08:00
DWARFFormValue.h [lldb] Use C++11 default member initializers 2021-06-09 09:43:13 -07:00
DWARFIndex.cpp Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
DWARFIndex.h Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
DWARFTypeUnit.cpp
DWARFTypeUnit.h
DWARFUnit.cpp [LLDB][NFC][Reliability] Fixes for int overflow and uninitialized state 2022-07-29 13:31:17 -07:00
DWARFUnit.h Reland "[LLDB][NFC] Decouple dwarf location table from DWARFExpression." 2022-07-12 10:54:24 -07:00
DebugNamesDWARFIndex.cpp Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
DebugNamesDWARFIndex.h Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
HashedNameToDIE.cpp [lldb] LLVM_FALLTHROUGH => [[fallthrough]]. NFC 2022-08-08 11:31:49 -07:00
HashedNameToDIE.h [lldb] Use C++11 default member initializers 2021-06-09 09:43:13 -07:00
LogChannelDWARF.cpp [lldb] Make logging machinery type-safe 2022-01-25 12:13:49 +01:00
LogChannelDWARF.h [lldb] Rename Logging.h to LLDBLog.h and clean up includes 2022-02-03 14:47:01 +01:00
ManualDWARFIndex.cpp Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
ManualDWARFIndex.h Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
NameToDIE.cpp Don't use Optional::getValue (NFC) 2022-06-20 23:35:53 -07:00
NameToDIE.h Cache the manual DWARF index out to the LLDB cache directory when the LLDB index cache is enabled. 2021-12-28 11:00:28 -08:00
SymbolFileDWARF.cpp Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
SymbolFileDWARF.h Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
SymbolFileDWARFDebugMap.cpp Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
SymbolFileDWARFDebugMap.h Re-submit "[lldb] Filter DIEs based on qualified name where possible" 2022-08-04 15:52:27 -07:00
SymbolFileDWARFDwo.cpp
SymbolFileDWARFDwo.h
SymbolFileDWARFProperties.td
UniqueDWARFASTType.cpp [LLDB] Remove cases of using namespace llvm:: from header file 2022-03-03 10:39:06 -08:00
UniqueDWARFASTType.h [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00