[all-commits] [llvm/llvm-project] 3cc988: [lldb][CPlusPlus] Add abi_tag support to the CPlus...

Michael137 via All-commits all-commits at lists.llvm.org
Fri Oct 21 06:01:20 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3cc9884500ad53e878045bc1d119d8a6b326f274
      https://github.com/llvm/llvm-project/commit/3cc9884500ad53e878045bc1d119d8a6b326f274
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2022-10-21 (Fri, 21 Oct 2022)

  Changed paths:
    M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
    M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
    M lldb/test/API/functionalities/step-avoids-regexp/TestStepAvoidsRegexp.py
    M lldb/test/API/functionalities/step-avoids-regexp/main.cpp
    M lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp

  Log Message:
  -----------
  [lldb][CPlusPlus] Add abi_tag support to the CPlusPlusNameParser

This patch teaches the `CPlusPlusNameParser` to parse the
demangled/prettified [[gnu::abi_tag(...)]] attribute. The demangled format
isn't standardized and the additions to the parser were mainly driven
using Clang (and the limited information on this from the official
Clang docs).

This change is motivated by multiple failures around step-in
behaviour for libcxx APIs (many of which have ABI tags as of recently).
LLDB determines whether the `step-avoid-regexp` matches the current
frame by parsing the scope-qualified name out of the demangled
function symbol. On failure, the `CPlusPlusNameParser` will simply
return the fully demangled name (which can include the return type)
to the caller, which in `FrameMatchesAvoidCriteria` means we will
not correctly decide whether we should stop at a frame or not if
the function has an abi_tag.

Ideally we wouldn't want to rely on the non-standard format
of demangled attributes. Alternatives would be:

1. Use the mangle tree API to do the parsing for us
2. Reconstruct the scope-qualified name from DWARF instead of parsing
   the demangled name

(1) isn't feasible without a significant refactor of `lldb_private::Mangled`,
if we want to do this efficiently.

(2) could be feasible in cases where debug-info for a frame is
available. But it does mean we certain operations (such as step-in regexp,
and frame function names) won't work with/won't show ABI tags.

**Testing**

* Un-XFAILed step-in API test
* Added parser unit-tests

Differential Revision: https://reviews.llvm.org/D136306




More information about the All-commits mailing list