[Lldb-commits] [PATCH] D131335: WIP: [lldb] abi_tag support 4/4 - Use mangle tree API to determine approximate mangle matches

Michael Buch via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 8 15:55:13 PDT 2022


Michael137 created this revision.
Michael137 added a reviewer: aprantl.
Herald added a project: All.
Michael137 added a reviewer: jingham.
Michael137 edited the summary of this revision.
Michael137 updated this revision to Diff 450751.
Michael137 added a comment.
Michael137 added a reviewer: labath.
Michael137 published this revision for review.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

- Rebase
- Fix API tests:
  - Weaken pre-condition for non-function mangled names
  - Allow non-C++ mangled names


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.

This patch deals with the above symbol resolution issue by using the
Itanium mangle tree API to compare mangled function symbols and no
longer relying on parsing demangled names via `CPlusPlusNameParser`. Since
the MSVC mangler doesn't expose the mangle tree we continue using the
old matching logic when the candidate symbol has the MSVC mangling
scheme.

**Testing**

- Added API tests


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131335

Files:
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
  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: D131335.450751.patch
Type: text/x-patch
Size: 13928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220808/d0d1e445/attachment.bin>


More information about the lldb-commits mailing list