[Lldb-commits] [PATCH] D131974: [lldb][ClangExpression] Add asm() label to all FunctionDecls we create from DWARF
Michael Buch via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 16 09:08:33 PDT 2022
Michael137 created this revision.
Michael137 added reviewers: labath, aprantl, jingham.
Herald added a reviewer: shafik.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
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
675767a5910d2ec77ef8b51c78fe312cf9022896 <https://reviews.llvm.org/D40283>
**Testing**
- Added API tests
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D131974
Files:
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/test/API/lang/cpp/abi_tag_lookup/Makefile
lldb/test/API/lang/cpp/abi_tag_lookup/TestAbiTagLookup.py
lldb/test/API/lang/cpp/abi_tag_lookup/main.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131974.453035.patch
Type: text/x-patch
Size: 6165 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220816/c38c3cb3/attachment.bin>
More information about the lldb-commits
mailing list