[all-commits] [llvm/llvm-project] 9c830c: [lldb] Implement TrackingOutputBuffer to track dem...

Michael Buch via All-commits all-commits at lists.llvm.org
Fri Apr 25 02:05:20 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c830cef3d7c2f1adfadcc0026a73ba2cdbeef05
      https://github.com/llvm/llvm-project/commit/9c830cef3d7c2f1adfadcc0026a73ba2cdbeef05
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2025-04-25 (Fri, 25 Apr 2025)

  Changed paths:
    A lldb/include/lldb/Core/DemangledNameInfo.h
    M lldb/source/Core/CMakeLists.txt
    A lldb/source/Core/DemangledNameInfo.cpp
    M lldb/unittests/Core/MangledTest.cpp

  Log Message:
  -----------
  [lldb] Implement TrackingOutputBuffer to track demangled name information (#131836)

This patch implements a new `TrackingOutputBuffer` which tracks where the scope/basename/arguments begin and end in the demangled string.

The idea that a function name can be decomposed into <scope, base, arguments>. The assumption is that given the ranges of those three elements and the demangled name, LLDB will be able to to reconstruct the full demangled name. The tracking of those ranges is pretty simple. We don’t ever deal with nesting, so whenever we recurse into a template argument list or another function type, we just stop tracking any positions. Once we recursed out of those, and are back to printing the top-level function name, we continue tracking the positions.

We introduce a new structure `FunctionNameInfo` that holds all this information and is stored in the new `TrackingOutputBuffer` class.

Tests are in `ItaniumDemangleTest.cpp`.

https://github.com/llvm/llvm-project/pull/131836


  Commit: f220ea2947b9c8b1e33db65b008086d47fa72af3
      https://github.com/llvm/llvm-project/commit/f220ea2947b9c8b1e33db65b008086d47fa72af3
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2025-04-25 (Fri, 25 Apr 2025)

  Changed paths:
    M lldb/include/lldb/Core/Mangled.h
    M lldb/source/Core/Mangled.cpp

  Log Message:
  -----------
  [lldb][Mangled] Add API to force re-demangling a Mangled object (#131836)

Add version of GetDemangledName that will force re-demangling. This is required because LLDB will SetDemangledName without going through the demangler. So we need a way to force demangling to set the m_demangled_info member when we need it.

https://github.com/llvm/llvm-project/pull/131836


  Commit: a2672250be871bdac18c1a955265a98704434218
      https://github.com/llvm/llvm-project/commit/a2672250be871bdac18c1a955265a98704434218
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2025-04-25 (Fri, 25 Apr 2025)

  Changed paths:
    M lldb/include/lldb/Core/DemangledNameInfo.h
    M lldb/include/lldb/Core/Mangled.h
    M lldb/source/Core/DemangledNameInfo.cpp
    M lldb/source/Core/Mangled.cpp
    M lldb/unittests/Core/MangledTest.cpp
    M llvm/include/llvm/Demangle/Demangle.h
    M llvm/lib/Demangle/ItaniumDemangle.cpp

  Log Message:
  -----------
  [lldb][Mangled] Retrieve and cache demangled name info (#131836)

Uses the `TrackingOutputBuffer` to populate the new member `Mangled::m_demangled_info`.

`m_demangled_info` is lazily popluated by `GetDemangledInfo`. To ensure `m_demangled` and `m_demangled_info` are in-sync we clear `m_demangled_info` anytime `m_demangled` is set/cleared.

https://github.com/llvm/llvm-project/pull/131836


  Commit: 8b91b44a3be680788f914af72f38f90d35925c23
      https://github.com/llvm/llvm-project/commit/8b91b44a3be680788f914af72f38f90d35925c23
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2025-04-25 (Fri, 25 Apr 2025)

  Changed paths:
    M lldb/include/lldb/Core/FormatEntity.h
    M lldb/include/lldb/Symbol/SymbolContext.h
    M lldb/include/lldb/Target/Language.h
    M lldb/source/Core/FormatEntity.cpp
    M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
    M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
    M lldb/source/Symbol/SymbolContext.cpp
    A lldb/test/Shell/Settings/TestFrameFormatFunctionBasename.test
    A lldb/test/Shell/Settings/TestFrameFormatFunctionBasenameObjC.test
    A lldb/test/Shell/Settings/TestFrameFormatFunctionFormattedArguments.test
    A lldb/test/Shell/Settings/TestFrameFormatFunctionFormattedArgumentsObjC.test
    A lldb/test/Shell/Settings/TestFrameFormatFunctionQualifiers.test
    A lldb/test/Shell/Settings/TestFrameFormatFunctionQualifiersObjC.test
    A lldb/test/Shell/Settings/TestFrameFormatFunctionReturn.test
    A lldb/test/Shell/Settings/TestFrameFormatFunctionReturnObjC.test
    A lldb/test/Shell/Settings/TestFrameFormatFunctionScope.test
    A lldb/test/Shell/Settings/TestFrameFormatFunctionScopeObjC.test
    A lldb/test/Shell/Settings/TestFrameFormatFunctionTemplateArguments.test
    A lldb/test/Shell/Settings/TestFrameFormatFunctionTemplateArgumentsObjC.test
    M lldb/test/Shell/Settings/TestFrameFormatName.test

  Log Message:
  -----------
  [lldb][Format] Introduce new frame-format variables for function parts (#131836)

Adds new frame-format variables and implements them in the CPlusPlusLanguage plugin.

We use the `DemangledNameInfo` type to retrieve the necessary part of the demangled name.

https://github.com/llvm/llvm-project/pull/131836


  Commit: d555b9f9a01705097edf2434cf897e351095e5c9
      https://github.com/llvm/llvm-project/commit/d555b9f9a01705097edf2434cf897e351095e5c9
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2025-04-25 (Fri, 25 Apr 2025)

  Changed paths:
    M lldb/include/lldb/Core/PluginManager.h
    M lldb/include/lldb/Target/Language.h
    M lldb/source/Core/FormatEntity.cpp
    M lldb/source/Core/PluginManager.cpp
    M lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt
    M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
    M lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h
    A lldb/source/Plugins/Language/CPlusPlus/LanguageCPlusPlusProperties.td
    A lldb/test/Shell/Settings/TestCxxFrameFormat.test
    A lldb/test/Shell/Settings/TestCxxFrameFormatMixedLanguages.test
    A lldb/test/Shell/Settings/TestCxxFrameFormatObjC.test
    A lldb/test/Shell/Settings/TestCxxFrameFormatPartialFailure.test
    A lldb/test/Shell/Settings/TestCxxFrameFormatRecursive.test

  Log Message:
  -----------
  [lldb][CPlusPlus] Add plugin.cplusplus.display.function-name-format setting (#131836)

Adds the new `plugin.cplusplus.display.function-name-format` setting and makes the `${function.name-with-args}` query it for formatting the function name.

One caveat is that the setting can't itself be set to `${function.name-with-args}` because that would cause infinite recursion and blow the stack. I added an XFAILed test-case for it and will address it in a follow-up patch.

https://github.com/llvm/llvm-project/pull/131836


Compare: https://github.com/llvm/llvm-project/compare/e046f2050578...d555b9f9a017

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list