[Lldb-commits] [lldb] [LLDB] Update SBMemoryRegionInfo doc strings to document len and str (PR #149903)
JDevlieghere wrote: > @JDevlieghere How would we go about documenting some of the python methods > `len()` and `str()` in doxygen? Asking for myself if you have an example Since those are Python specific they should remain docstrings in the `.i` interface files. I expect the latter to stick around, for that reason or when we have comments that are more tailored towards Python. But generic comments should go in the headers as Doxygen comments so both C++ and Python users can benefit from them. Unfortunately there's also no automatic way to convert them to Lua documentation, but maybe that'll come in a future version of SWIG. https://github.com/llvm/llvm-project/pull/149903 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libcxx] [lldb] [llvm] [mlir] [docs] Add clang/llvm release notes for mipsel-windows-* targets (PR #147133)
https://github.com/hpoussin updated https://github.com/llvm/llvm-project/pull/147133 From 6296ebd45d3f916bea6bf434c1b5580441f9234a Mon Sep 17 00:00:00 2001 From: Tobias Hieta Date: Tue, 15 Jul 2025 15:59:05 +0200 Subject: [PATCH 01/22] Bump version to 21.1.0-git --- cmake/Modules/LLVMVersion.cmake | 2 +- libcxx/include/__config | 2 +- llvm/utils/gn/secondary/llvm/version.gni | 2 +- llvm/utils/lit/lit/__init__.py | 2 +- llvm/utils/mlgo-utils/mlgo/__init__.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/Modules/LLVMVersion.cmake b/cmake/Modules/LLVMVersion.cmake index f14aae172f077..c12240f98e97f 100644 --- a/cmake/Modules/LLVMVersion.cmake +++ b/cmake/Modules/LLVMVersion.cmake @@ -4,7 +4,7 @@ if(NOT DEFINED LLVM_VERSION_MAJOR) set(LLVM_VERSION_MAJOR 21) endif() if(NOT DEFINED LLVM_VERSION_MINOR) - set(LLVM_VERSION_MINOR 0) + set(LLVM_VERSION_MINOR 1) endif() if(NOT DEFINED LLVM_VERSION_PATCH) set(LLVM_VERSION_PATCH 0) diff --git a/libcxx/include/__config b/libcxx/include/__config index d940461c30234..8f215bbe47928 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -28,7 +28,7 @@ // _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM. // Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is // defined to XXYYZZ. -# define _LIBCPP_VERSION 21 +# define _LIBCPP_VERSION 210100 # define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y # define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y) diff --git a/llvm/utils/gn/secondary/llvm/version.gni b/llvm/utils/gn/secondary/llvm/version.gni index 2b1a9076afe4a..ece4106de4aca 100644 --- a/llvm/utils/gn/secondary/llvm/version.gni +++ b/llvm/utils/gn/secondary/llvm/version.gni @@ -1,4 +1,4 @@ llvm_version_major = 21 -llvm_version_minor = 0 +llvm_version_minor = 1 llvm_version_patch = 0 llvm_version = "$llvm_version_major.$llvm_version_minor.$llvm_version_patch" diff --git a/llvm/utils/lit/lit/__init__.py b/llvm/utils/lit/lit/__init__.py index b5aa8edc03dc7..520ff22dc6fb0 100644 --- a/llvm/utils/lit/lit/__init__.py +++ b/llvm/utils/lit/lit/__init__.py @@ -2,7 +2,7 @@ __author__ = "Daniel Dunbar" __email__ = "dan...@minormatter.com" -__versioninfo__ = (21, 0, 0) +__versioninfo__ = (21, 1, 0) __version__ = ".".join(str(v) for v in __versioninfo__) + "dev" __all__ = [] diff --git a/llvm/utils/mlgo-utils/mlgo/__init__.py b/llvm/utils/mlgo-utils/mlgo/__init__.py index d3369abae70b9..03eee0028b3cc 100644 --- a/llvm/utils/mlgo-utils/mlgo/__init__.py +++ b/llvm/utils/mlgo-utils/mlgo/__init__.py @@ -4,7 +4,7 @@ from datetime import timezone, datetime -__versioninfo__ = (20, 0, 0) +__versioninfo__ = (21, 1, 0) __version__ = ( ".".join(str(v) for v in __versioninfo__) + "dev" From 18624ae54bc979e47ad990721eb20eb9ca982a2f Mon Sep 17 00:00:00 2001 From: Martin Erhart Date: Tue, 15 Jul 2025 14:48:05 +0100 Subject: [PATCH 02/22] [mlir][SliceAnalysis] Fix stack overflow in graph regions (#139694) This analysis currently just crashes when applied to a graph region that has a use-def cycle. This PR fixes that by keeping track of the operations the DFS has already visited when following use-def edges and stopping once we visit an operation again. --- mlir/include/mlir/Analysis/SliceAnalysis.h | 10 ++-- mlir/lib/Analysis/SliceAnalysis.cpp | 65 - mlir/test/Dialect/Affine/slicing-utils.mlir | 23 3 files changed, 79 insertions(+), 19 deletions(-) diff --git a/mlir/include/mlir/Analysis/SliceAnalysis.h b/mlir/include/mlir/Analysis/SliceAnalysis.h index d082d2d9f758b..18349d071bb2e 100644 --- a/mlir/include/mlir/Analysis/SliceAnalysis.h +++ b/mlir/include/mlir/Analysis/SliceAnalysis.h @@ -65,8 +65,9 @@ using ForwardSliceOptions = SliceOptions; /// /// The implementation traverses the use chains in postorder traversal for /// efficiency reasons: if an operation is already in `forwardSlice`, no -/// need to traverse its uses again. Since use-def chains form a DAG, this -/// terminates. +/// need to traverse its uses again. In the presence of use-def cycles in a +/// graph region, the traversal stops at the first operation that was already +/// visited (which is not added to the slice anymore). /// /// Upon return to the root call, `forwardSlice` is filled with a /// postorder list of uses (i.e. a reverse topological order). To get a proper @@ -114,8 +115,9 @@ void getForwardSlice(Value root, SetVector *forwardSlice, /// /// The implementation traverses the def chains in postorder traversal for /// efficiency reasons: if an operation is already in `backwardSlice`, no -/// need to traverse its definitions again. Since useuse-def chains form a DAG, -/// this terminates. +/// need to traverse its definitions again. In the presence of use-def cycles +/// in a graph region, the traversal stops at the first operation that was +/// already vis
[Lldb-commits] [clang] [libcxxabi] [lldb] [llvm] [DRAFT] [lldb][Expression] Add structor variant to LLDB's function call labels (PR #149827)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/149827 >From fd6b6e8a3168fc233635e783773554ac980edb46 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 15 Nov 2024 01:59:36 + Subject: [PATCH 1/5] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels --- lldb/include/lldb/Core/Module.h | 4 +- lldb/include/lldb/Expression/Expression.h | 25 ++ lldb/include/lldb/Symbol/SymbolFile.h | 14 lldb/include/lldb/Symbol/TypeSystem.h | 16 lldb/source/Core/Module.cpp | 19 - lldb/source/Expression/Expression.cpp | 16 lldb/source/Expression/IRExecutionUnit.cpp| 74 + .../Clang/ClangExpressionDeclMap.cpp | 2 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 43 ++ .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 41 ++ .../SymbolFile/DWARF/SymbolFileDWARF.h| 3 + .../SymbolFile/NativePDB/PdbAstBuilder.cpp| 6 +- .../NativePDB/UdtRecordCompleter.cpp | 5 +- .../Plugins/SymbolFile/PDB/PDBASTParser.cpp | 7 +- .../TypeSystem/Clang/TypeSystemClang.cpp | 81 +-- .../TypeSystem/Clang/TypeSystemClang.h| 11 ++- lldb/unittests/Symbol/TestTypeSystemClang.cpp | 12 +-- 17 files changed, 335 insertions(+), 44 deletions(-) diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 8bb55c95773bc..3991a12997541 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -86,7 +86,8 @@ struct ModuleFunctionSearchOptions { /// /// The module will parse more detailed information as more queries are made. class Module : public std::enable_shared_from_this, - public SymbolContextScope { + public SymbolContextScope, + public UserID { public: class LookupInfo; // Static functions that can track the lifetime of module objects. This is @@ -97,6 +98,7 @@ class Module : public std::enable_shared_from_this, // using the "--global" (-g for short). static size_t GetNumberAllocatedModules(); + static Module *GetAllocatedModuleWithUID(lldb::user_id_t uid); static Module *GetAllocatedModuleAtIndex(size_t idx); static std::recursive_mutex &GetAllocationModuleCollectionMutex(); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 8de9364436ccf..f32878c9bf876 100644 --- a/lldb/include/lldb/Expression/Expression.h +++ b/lldb/include/lldb/Expression/Expression.h @@ -96,6 +96,31 @@ class Expression { ///invalid. }; +/// Holds parsed information about a function call label that +/// LLDB attaches as an AsmLabel to function AST nodes it parses +/// from debug-info. +/// +/// The format being: +/// +/// ::: +/// +/// The label string needs to stay valid for the entire lifetime +/// of this object. +struct FunctionCallLabel { + llvm::StringRef m_lookup_name; + lldb::user_id_t m_module_id; + + /// Mostly for debuggability. + lldb::user_id_t m_die_id; +}; + +/// LLDB attaches this prefix to mangled names of functions that it get called +/// from JITted expressions. +inline constexpr llvm::StringRef FunctionCallLabelPrefix = "$__lldb_func"; + +bool consumeFunctionCallLabelPrefix(llvm::StringRef &name); +bool hasFunctionCallLabelPrefix(llvm::StringRef name); + } // namespace lldb_private #endif // LLDB_EXPRESSION_EXPRESSION_H diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index e95f95553c17c..6aca276fc85b6 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -18,6 +18,7 @@ #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SourceModule.h" +#include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/TypeSystem.h" @@ -328,6 +329,19 @@ class SymbolFile : public PluginInterface { GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector &mangled_names); + /// Resolves the function DIE identified by \c lookup_name within + /// this SymbolFile. + /// + /// \param[in,out] sc_list The resolved functions will be appended to this + /// list. + /// + /// \param[in] lookup_name The UID of the function DIE to resolve. + /// + virtual llvm::Error FindAndResolveFunction(SymbolContextList &sc_list, + llvm::StringRef lookup_name) { +return llvm::createStringError("Not implemented"); + } + virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list) = 0; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index cb1f0130b548d..742c09251ea2f 100644
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL unordered containers (PR #149519)
https://github.com/Nerixyz updated https://github.com/llvm/llvm-project/pull/149519 >From a791fe9b924b1722d11e11a25d940cc7c858a177 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Fri, 18 Jul 2025 16:08:04 +0200 Subject: [PATCH 1/2] [LLDB] Add formatters for MSVC STL unordered containers --- .../Plugins/Language/CPlusPlus/CMakeLists.txt | 1 + .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 28 ++-- .../Plugins/Language/CPlusPlus/MsvcStl.h | 6 ++ .../Language/CPlusPlus/MsvcStlUnordered.cpp | 69 +++ .../TestDataFormatterGenericUnordered.py | 18 +++-- 5 files changed, 111 insertions(+), 11 deletions(-) create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlUnordered.cpp diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt index e1dd5bf84d7eb..dbea81834e976 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt +++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt @@ -38,6 +38,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN MsvcStlTuple.cpp MsvcStlVariant.cpp MsvcStlVector.cpp + MsvcStlUnordered.cpp MSVCUndecoratedNameParser.cpp LINK_COMPONENTS diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 481fe6106849c..97066f00eb766 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1434,8 +1434,7 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { stl_deref_flags, "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider"))); cpp_category_sp->AddTypeSynthetic( - "^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$", - eFormatterMatchRegex, + "^std::__debug::unordered_(multi)?(map|set)<.+> >$", eFormatterMatchRegex, SyntheticChildrenSP(new ScriptedSyntheticChildren( stl_deref_flags, "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider"))); @@ -1490,8 +1489,8 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { AddCXXSummary(cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider, -"libstdc++ std unordered container summary provider", -"^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$", +"libstdc++ debug std unordered container summary provider", +"^std::__debug::unordered_(multi)?(map|set)<.+> >$", stl_summary_flags, true); AddCXXSummary( @@ -1660,6 +1659,19 @@ static bool GenericVariantSummaryProvider(ValueObject &valobj, Stream &stream, return LibStdcppVariantSummaryProvider(valobj, stream, options); } +static SyntheticChildrenFrontEnd * +GenericUnorderedSyntheticFrontEndCreator(CXXSyntheticChildren *children, + ValueObjectSP valobj_sp) { + if (!valobj_sp) +return nullptr; + + if (IsMsvcStlUnordered(*valobj_sp)) +return MsvcStlUnorderedSyntheticFrontEndCreator(children, valobj_sp); + return new ScriptedSyntheticChildren::FrontEnd( + "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider", + *valobj_sp); +} + /// Load formatters that are formatting types from more than one STL static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { if (!cpp_category_sp) @@ -1727,6 +1739,10 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { AddCXXSynthetic(cpp_category_sp, GenericVariantSyntheticFrontEndCreator, "std::variant synthetic children", "^std::variant<.*>$", stl_synth_flags, true); + AddCXXSynthetic(cpp_category_sp, GenericUnorderedSyntheticFrontEndCreator, + "std::unordered container synthetic children", + "^std::unordered_(multi)?(map|set)<.+> ?>$", stl_synth_flags, + true); SyntheticChildren::Flags stl_deref_flags = stl_synth_flags; stl_deref_flags.SetFrontEndWantsDereference(); @@ -1766,6 +1782,10 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { AddCXXSummary(cpp_category_sp, GenericVariantSummaryProvider, "MSVC STL/libstdc++ std::variant summary provider", "^std::variant<.*>$", stl_summary_flags, true); + AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider, +"MSVC STL/libstdc++ std unordered container summary provider", +"^std::unordered_(multi)?(map|set)<.+> ?>$", stl_summary_flags, +true); } static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h index 9058d2e579adb..bfffa14b4660d 100644 --- a/lldb/sourc
[Lldb-commits] [clang] [libcxxabi] [lldb] [llvm] [DRAFT] [lldb][Expression] Add structor variant to LLDB's function call labels (PR #149827)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/149827 >From fd6b6e8a3168fc233635e783773554ac980edb46 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 15 Nov 2024 01:59:36 + Subject: [PATCH 1/4] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels --- lldb/include/lldb/Core/Module.h | 4 +- lldb/include/lldb/Expression/Expression.h | 25 ++ lldb/include/lldb/Symbol/SymbolFile.h | 14 lldb/include/lldb/Symbol/TypeSystem.h | 16 lldb/source/Core/Module.cpp | 19 - lldb/source/Expression/Expression.cpp | 16 lldb/source/Expression/IRExecutionUnit.cpp| 74 + .../Clang/ClangExpressionDeclMap.cpp | 2 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 43 ++ .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 41 ++ .../SymbolFile/DWARF/SymbolFileDWARF.h| 3 + .../SymbolFile/NativePDB/PdbAstBuilder.cpp| 6 +- .../NativePDB/UdtRecordCompleter.cpp | 5 +- .../Plugins/SymbolFile/PDB/PDBASTParser.cpp | 7 +- .../TypeSystem/Clang/TypeSystemClang.cpp | 81 +-- .../TypeSystem/Clang/TypeSystemClang.h| 11 ++- lldb/unittests/Symbol/TestTypeSystemClang.cpp | 12 +-- 17 files changed, 335 insertions(+), 44 deletions(-) diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 8bb55c95773bc..3991a12997541 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -86,7 +86,8 @@ struct ModuleFunctionSearchOptions { /// /// The module will parse more detailed information as more queries are made. class Module : public std::enable_shared_from_this, - public SymbolContextScope { + public SymbolContextScope, + public UserID { public: class LookupInfo; // Static functions that can track the lifetime of module objects. This is @@ -97,6 +98,7 @@ class Module : public std::enable_shared_from_this, // using the "--global" (-g for short). static size_t GetNumberAllocatedModules(); + static Module *GetAllocatedModuleWithUID(lldb::user_id_t uid); static Module *GetAllocatedModuleAtIndex(size_t idx); static std::recursive_mutex &GetAllocationModuleCollectionMutex(); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 8de9364436ccf..f32878c9bf876 100644 --- a/lldb/include/lldb/Expression/Expression.h +++ b/lldb/include/lldb/Expression/Expression.h @@ -96,6 +96,31 @@ class Expression { ///invalid. }; +/// Holds parsed information about a function call label that +/// LLDB attaches as an AsmLabel to function AST nodes it parses +/// from debug-info. +/// +/// The format being: +/// +/// ::: +/// +/// The label string needs to stay valid for the entire lifetime +/// of this object. +struct FunctionCallLabel { + llvm::StringRef m_lookup_name; + lldb::user_id_t m_module_id; + + /// Mostly for debuggability. + lldb::user_id_t m_die_id; +}; + +/// LLDB attaches this prefix to mangled names of functions that it get called +/// from JITted expressions. +inline constexpr llvm::StringRef FunctionCallLabelPrefix = "$__lldb_func"; + +bool consumeFunctionCallLabelPrefix(llvm::StringRef &name); +bool hasFunctionCallLabelPrefix(llvm::StringRef name); + } // namespace lldb_private #endif // LLDB_EXPRESSION_EXPRESSION_H diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index e95f95553c17c..6aca276fc85b6 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -18,6 +18,7 @@ #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SourceModule.h" +#include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/TypeSystem.h" @@ -328,6 +329,19 @@ class SymbolFile : public PluginInterface { GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector &mangled_names); + /// Resolves the function DIE identified by \c lookup_name within + /// this SymbolFile. + /// + /// \param[in,out] sc_list The resolved functions will be appended to this + /// list. + /// + /// \param[in] lookup_name The UID of the function DIE to resolve. + /// + virtual llvm::Error FindAndResolveFunction(SymbolContextList &sc_list, + llvm::StringRef lookup_name) { +return llvm::createStringError("Not implemented"); + } + virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list) = 0; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index cb1f0130b548d..742c09251ea2f 100644
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL unordered containers (PR #149519)
https://github.com/Nerixyz updated https://github.com/llvm/llvm-project/pull/149519 >From a791fe9b924b1722d11e11a25d940cc7c858a177 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Fri, 18 Jul 2025 16:08:04 +0200 Subject: [PATCH 1/2] [LLDB] Add formatters for MSVC STL unordered containers --- .../Plugins/Language/CPlusPlus/CMakeLists.txt | 1 + .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 28 ++-- .../Plugins/Language/CPlusPlus/MsvcStl.h | 6 ++ .../Language/CPlusPlus/MsvcStlUnordered.cpp | 69 +++ .../TestDataFormatterGenericUnordered.py | 18 +++-- 5 files changed, 111 insertions(+), 11 deletions(-) create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlUnordered.cpp diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt index e1dd5bf84d7eb..dbea81834e976 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt +++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt @@ -38,6 +38,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN MsvcStlTuple.cpp MsvcStlVariant.cpp MsvcStlVector.cpp + MsvcStlUnordered.cpp MSVCUndecoratedNameParser.cpp LINK_COMPONENTS diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 481fe6106849c..97066f00eb766 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1434,8 +1434,7 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { stl_deref_flags, "lldb.formatters.cpp.gnu_libstdcpp.StdMapLikeSynthProvider"))); cpp_category_sp->AddTypeSynthetic( - "^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$", - eFormatterMatchRegex, + "^std::__debug::unordered_(multi)?(map|set)<.+> >$", eFormatterMatchRegex, SyntheticChildrenSP(new ScriptedSyntheticChildren( stl_deref_flags, "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider"))); @@ -1490,8 +1489,8 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { AddCXXSummary(cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider, -"libstdc++ std unordered container summary provider", -"^std::(__debug::)?unordered_(multi)?(map|set)<.+> >$", +"libstdc++ debug std unordered container summary provider", +"^std::__debug::unordered_(multi)?(map|set)<.+> >$", stl_summary_flags, true); AddCXXSummary( @@ -1660,6 +1659,19 @@ static bool GenericVariantSummaryProvider(ValueObject &valobj, Stream &stream, return LibStdcppVariantSummaryProvider(valobj, stream, options); } +static SyntheticChildrenFrontEnd * +GenericUnorderedSyntheticFrontEndCreator(CXXSyntheticChildren *children, + ValueObjectSP valobj_sp) { + if (!valobj_sp) +return nullptr; + + if (IsMsvcStlUnordered(*valobj_sp)) +return MsvcStlUnorderedSyntheticFrontEndCreator(children, valobj_sp); + return new ScriptedSyntheticChildren::FrontEnd( + "lldb.formatters.cpp.gnu_libstdcpp.StdUnorderedMapSynthProvider", + *valobj_sp); +} + /// Load formatters that are formatting types from more than one STL static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { if (!cpp_category_sp) @@ -1727,6 +1739,10 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { AddCXXSynthetic(cpp_category_sp, GenericVariantSyntheticFrontEndCreator, "std::variant synthetic children", "^std::variant<.*>$", stl_synth_flags, true); + AddCXXSynthetic(cpp_category_sp, GenericUnorderedSyntheticFrontEndCreator, + "std::unordered container synthetic children", + "^std::unordered_(multi)?(map|set)<.+> ?>$", stl_synth_flags, + true); SyntheticChildren::Flags stl_deref_flags = stl_synth_flags; stl_deref_flags.SetFrontEndWantsDereference(); @@ -1766,6 +1782,10 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { AddCXXSummary(cpp_category_sp, GenericVariantSummaryProvider, "MSVC STL/libstdc++ std::variant summary provider", "^std::variant<.*>$", stl_summary_flags, true); + AddCXXSummary(cpp_category_sp, ContainerSizeSummaryProvider, +"MSVC STL/libstdc++ std unordered container summary provider", +"^std::unordered_(multi)?(map|set)<.+> ?>$", stl_summary_flags, +true); } static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h index 9058d2e579adb..bfffa14b4660d 100644 --- a/lldb/sourc
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL unordered containers (PR #149519)
@@ -127,8 +123,16 @@ def look_for_content_and_continue(self, var_name, patterns): @add_test_categories(["libstdcxx"]) def test_with_run_command_libstdcpp(self): -self.do_test_with_run_command(USE_LIBSTDCPP) +self.build(dictionary={"USE_LIBSTDCPP": 1}) +self.do_test_with_run_command() @add_test_categories(["libc++"]) def test_with_run_command_libcpp(self): -self.do_test_with_run_command(USE_LIBCPP) +self.build(dictionary={"USE_LIBCPP": 1}) +self.do_test_with_run_command() Nerixyz wrote: Looks like this just works. https://github.com/llvm/llvm-project/pull/149519 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::atomic (PR #149801)
@@ -1784,6 +1787,17 @@ static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { stl_summary_flags, MsvcStlStringSummaryProvider, "MSVC STL std::u32string summary provider")); + + stl_summary_flags.SetDontShowChildren(false); Nerixyz wrote: > Would that make `std::atomic` look like: > > ``` > (std::atomic) val = 5 > ``` > > ? Yes. I don't think that's always desired. Atomics can store structs as well (not sure why) and users might want to inspect these. This is also done in the tests [here](https://github.com/llvm/llvm-project/blob/b184dd9c6f4facf3c4c513ef826c584ead8220d9/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/main.cpp#L21). https://github.com/llvm/llvm-project/pull/149801 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Update SBMemoryRegionInfo doc strings to document len and str (PR #149903)
https://github.com/barsolo2000 updated https://github.com/llvm/llvm-project/pull/149903 >From e9fdc0a001823db1df26158845301aec94cd2b8a Mon Sep 17 00:00:00 2001 From: Bar Soloveychik Date: Mon, 21 Jul 2025 13:29:58 -0700 Subject: [PATCH 1/3] added documenatation on GetDescription --- .../interface/SBMemoryRegionInfoDocstrings.i | 52 --- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i index d7c68baf100e2..dd578f53c828c 100644 --- a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i +++ b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i @@ -1,31 +1,43 @@ -%feature("docstring", -"API clients can get information about memory regions in processes." -) lldb::SBMemoryRegionInfo; +% feature("docstring", + "API clients can get information about memory regions in processes.") +lldb::SBMemoryRegionInfo; %feature("docstring", " Returns whether this memory region has a list of modified (dirty) pages available or not. When calling GetNumDirtyPages(), you will -have 0 returned for both \"dirty page list is not known\" and +have 0 returned for both \"dirty page list is not known\" and \"empty dirty page list\" (that is, no modified pages in this memory region). You must use this method to disambiguate." ) lldb::SBMemoryRegionInfo::HasDirtyMemoryPageList; -%feature("docstring", " -Return the number of dirty (modified) memory pages in this -memory region, if available. You must use the -SBMemoryRegionInfo::HasDirtyMemoryPageList() method to -determine if a dirty memory list is available; it will depend -on the target system can provide this information." -) lldb::SBMemoryRegionInfo::GetNumDirtyPages; +% feature( + "docstring", + " + Return the number of dirty(modified) memory pages in this memory region, + if available.You must use the SBMemoryRegionInfo::HasDirtyMemoryPageList() + method to determine if a dirty memory list is available; + it will depend on the target system can provide this information." + ) lldb::SBMemoryRegionInfo::GetNumDirtyPages; -%feature("docstring", " -Return the address of a modified, or dirty, page of memory. -If the provided index is out of range, or this memory region -does not have dirty page information, LLDB_INVALID_ADDRESS -is returned." -) lldb::SBMemoryRegionInfo::GetDirtyPageAddressAtIndex; +% feature("docstring", + " + Return the address of a modified, + or dirty, page of memory.If the provided index is out of range, + or this memory region does not have dirty page information, + LLDB_INVALID_ADDRESS is returned." + ) lldb::SBMemoryRegionInfo::GetDirtyPageAddressAtIndex; + +% feature("docstring", " + Return the size of pages in this memory region .0 will be + returned if this information was unavailable." + ) lldb::SBMemoryRegionInfo::GetPageSize(); %feature("docstring", " -Return the size of pages in this memory region. 0 will be returned -if this information was unavailable." -) lldb::SBMemoryRegionInfo::GetPageSize(); +takes a SBStream parameter 'description' where it will write the output to. +it formats the memory region information into a string with Memory region info +[Hex start - Hex End) and premission flags R/W/X +returns a boolean value indicating success or failure + +alternative to using this method to find out the size of the memory region +is to use the len() function on the SBMemoryRegionInfo object" +) lldb::SBMemoryRegionInfo::GetDescription; >From 17f46d31903ab451a5944d4097ae1ef62bd631cc Mon Sep 17 00:00:00 2001 From: Bar Soloveychik Date: Mon, 21 Jul 2025 14:08:01 -0700 Subject: [PATCH 2/3] added doc on str/len overwritten functions --- .../interface/SBMemoryRegionInfoDocstrings.i | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i index dd578f53c828c..6b7f4a32ed17e 100644 --- a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i +++ b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i @@ -1,5 +1,8 @@ % feature("docstring", - "API clients can get information about memory regions in processes.") + "API clients can get information about memory regions in processes. + + When printed using str(), the memory region info is formatted as: +'[Hex start - Hex End] RWX' ") lldb::SBMemoryRegionInfo; %feature("docstring", " @@ -34,10 +37,11 @@ %feature("docstring", " takes a SBStream parameter 'description' where it will
[Lldb-commits] [lldb] [LLDB] Update SBMemoryRegionInfo doc strings to document len and str (PR #149903)
https://github.com/barsolo2000 updated https://github.com/llvm/llvm-project/pull/149903 >From e9fdc0a001823db1df26158845301aec94cd2b8a Mon Sep 17 00:00:00 2001 From: Bar Soloveychik Date: Mon, 21 Jul 2025 13:29:58 -0700 Subject: [PATCH 1/4] added documenatation on GetDescription --- .../interface/SBMemoryRegionInfoDocstrings.i | 52 --- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i index d7c68baf100e2..dd578f53c828c 100644 --- a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i +++ b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i @@ -1,31 +1,43 @@ -%feature("docstring", -"API clients can get information about memory regions in processes." -) lldb::SBMemoryRegionInfo; +% feature("docstring", + "API clients can get information about memory regions in processes.") +lldb::SBMemoryRegionInfo; %feature("docstring", " Returns whether this memory region has a list of modified (dirty) pages available or not. When calling GetNumDirtyPages(), you will -have 0 returned for both \"dirty page list is not known\" and +have 0 returned for both \"dirty page list is not known\" and \"empty dirty page list\" (that is, no modified pages in this memory region). You must use this method to disambiguate." ) lldb::SBMemoryRegionInfo::HasDirtyMemoryPageList; -%feature("docstring", " -Return the number of dirty (modified) memory pages in this -memory region, if available. You must use the -SBMemoryRegionInfo::HasDirtyMemoryPageList() method to -determine if a dirty memory list is available; it will depend -on the target system can provide this information." -) lldb::SBMemoryRegionInfo::GetNumDirtyPages; +% feature( + "docstring", + " + Return the number of dirty(modified) memory pages in this memory region, + if available.You must use the SBMemoryRegionInfo::HasDirtyMemoryPageList() + method to determine if a dirty memory list is available; + it will depend on the target system can provide this information." + ) lldb::SBMemoryRegionInfo::GetNumDirtyPages; -%feature("docstring", " -Return the address of a modified, or dirty, page of memory. -If the provided index is out of range, or this memory region -does not have dirty page information, LLDB_INVALID_ADDRESS -is returned." -) lldb::SBMemoryRegionInfo::GetDirtyPageAddressAtIndex; +% feature("docstring", + " + Return the address of a modified, + or dirty, page of memory.If the provided index is out of range, + or this memory region does not have dirty page information, + LLDB_INVALID_ADDRESS is returned." + ) lldb::SBMemoryRegionInfo::GetDirtyPageAddressAtIndex; + +% feature("docstring", " + Return the size of pages in this memory region .0 will be + returned if this information was unavailable." + ) lldb::SBMemoryRegionInfo::GetPageSize(); %feature("docstring", " -Return the size of pages in this memory region. 0 will be returned -if this information was unavailable." -) lldb::SBMemoryRegionInfo::GetPageSize(); +takes a SBStream parameter 'description' where it will write the output to. +it formats the memory region information into a string with Memory region info +[Hex start - Hex End) and premission flags R/W/X +returns a boolean value indicating success or failure + +alternative to using this method to find out the size of the memory region +is to use the len() function on the SBMemoryRegionInfo object" +) lldb::SBMemoryRegionInfo::GetDescription; >From 17f46d31903ab451a5944d4097ae1ef62bd631cc Mon Sep 17 00:00:00 2001 From: Bar Soloveychik Date: Mon, 21 Jul 2025 14:08:01 -0700 Subject: [PATCH 2/4] added doc on str/len overwritten functions --- .../interface/SBMemoryRegionInfoDocstrings.i | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i index dd578f53c828c..6b7f4a32ed17e 100644 --- a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i +++ b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i @@ -1,5 +1,8 @@ % feature("docstring", - "API clients can get information about memory regions in processes.") + "API clients can get information about memory regions in processes. + + When printed using str(), the memory region info is formatted as: +'[Hex start - Hex End] RWX' ") lldb::SBMemoryRegionInfo; %feature("docstring", " @@ -34,10 +37,11 @@ %feature("docstring", " takes a SBStream parameter 'description' where it will
[Lldb-commits] [lldb] Reland "[lldb][RPC] Upstream lldb-rpc-gen tool" (#146969)" Attempt 2 (PR #148996)
chelcassanova wrote: > To be more precisely, the generated sources also will get built on the host > for the cross-platform builds, but during the second stage when the clang > toolchain for the target platform is already fully in place. Ah ok, this is why for lldb-server it has a CMake variable to skip building it in phase 1. I added a variable to CMake (`LLDB_CAN_USE_LLDB_RPC_SERVER`) that when enabled, should allow the lldb-rpc-server to get built separate from the lldb-rpc-gen tool. https://github.com/llvm/llvm-project/pull/148996 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Store the dummy target in the selected exeuction context (PR #149615)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/149615 >From 770178784e122e99596280159791c0e7c7db7cf5 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 18 Jul 2025 16:32:06 -0700 Subject: [PATCH] [lldb] Store the dummy target in the selected exeuction context --- lldb/source/Core/Debugger.cpp | 4 +-- lldb/source/Core/Statusline.cpp | 6 +--- lldb/source/Interpreter/CommandObject.cpp | 37 --- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index ed674ee1275c7..3a3fb9eb0bdaa 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1221,8 +1221,8 @@ void Debugger::RedrawStatusline(bool update) { } ExecutionContext Debugger::GetSelectedExecutionContext() { - bool adopt_selected = true; - ExecutionContextRef exe_ctx_ref(GetSelectedTarget().get(), adopt_selected); + ExecutionContextRef exe_ctx_ref(&GetSelectedOrDummyTarget(), + /*adopt_selected=*/true); return ExecutionContext(exe_ctx_ref); } diff --git a/lldb/source/Core/Statusline.cpp b/lldb/source/Core/Statusline.cpp index 393d427241021..cfed40ac7fb2b 100644 --- a/lldb/source/Core/Statusline.cpp +++ b/lldb/source/Core/Statusline.cpp @@ -134,11 +134,7 @@ void Statusline::Redraw(bool update) { } ExecutionContext exe_ctx = m_debugger.GetSelectedExecutionContext(); - - // For colors and progress events, the format entity needs access to the - // debugger, which requires a target in the execution context. - if (!exe_ctx.HasTargetScope()) -exe_ctx.SetTargetPtr(&m_debugger.GetSelectedOrDummyTarget()); + assert(exe_ctx.HasTargetScope() && "format entity needs a target"); SymbolContext symbol_ctx; if (ProcessSP process_sp = exe_ctx.GetProcessSP()) { diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index 129646ebddb94..a72d804e5db5f 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -147,10 +147,11 @@ bool CommandObject::CheckRequirements(CommandReturnObject &result) { // we don't want any CommandObject instances to keep any of these objects // around longer than for a single command. Every command should call // CommandObject::Cleanup() after it has completed. - assert(!m_exe_ctx.GetTargetPtr()); - assert(!m_exe_ctx.GetProcessPtr()); - assert(!m_exe_ctx.GetThreadPtr()); - assert(!m_exe_ctx.GetFramePtr()); + assert(!m_exe_ctx.HasTargetScope() || + m_exe_ctx.GetTargetRef().IsDummyTarget()); + assert(!m_exe_ctx.HasProcessScope()); + assert(!m_exe_ctx.HasThreadScope()); + assert(!m_exe_ctx.HasFrameScope()); // Lock down the interpreter's execution context prior to running the command // so we guarantee the selected target, process, thread and frame can't go @@ -312,7 +313,7 @@ void CommandObject::HandleArgumentCompletion( assert(entry_ptr && "We said there was one entry, but there wasn't."); return; // Not worth crashing if asserts are off... } - + CommandArgumentEntry &entry = *entry_ptr; // For now, we only handle the simple case of one homogenous argument type. if (entry.size() != 1) @@ -495,21 +496,21 @@ bool CommandObject::IsPairType(ArgumentRepetitionType arg_repeat_type) { (arg_repeat_type == eArgRepeatPairRangeOptional); } -std::optional +std::optional CommandObject::ArgRepetitionFromString(llvm::StringRef string) { return llvm::StringSwitch(string) - .Case("plain", eArgRepeatPlain) - .Case("optional", eArgRepeatOptional) - .Case("plus", eArgRepeatPlus) - .Case("star", eArgRepeatStar) - .Case("range", eArgRepeatRange) - .Case("pair-plain", eArgRepeatPairPlain) - .Case("pair-optional", eArgRepeatPairOptional) - .Case("pair-plus", eArgRepeatPairPlus) - .Case("pair-star", eArgRepeatPairStar) - .Case("pair-range", eArgRepeatPairRange) - .Case("pair-range-optional", eArgRepeatPairRangeOptional) - .Default({}); + .Case("plain", eArgRepeatPlain) + .Case("optional", eArgRepeatOptional) + .Case("plus", eArgRepeatPlus) + .Case("star", eArgRepeatStar) + .Case("range", eArgRepeatRange) + .Case("pair-plain", eArgRepeatPairPlain) + .Case("pair-optional", eArgRepeatPairOptional) + .Case("pair-plus", eArgRepeatPairPlus) + .Case("pair-star", eArgRepeatPairStar) + .Case("pair-range", eArgRepeatPairRange) + .Case("pair-range-optional", eArgRepeatPairRangeOptional) + .Default({}); } static CommandObject::CommandArgumentEntry ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Store the dummy target in the selected exeuction context (PR #149615)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/149615 >From 2f65e1072e4e8dc729627b79ca6a4afa644f79dd Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 18 Jul 2025 16:32:06 -0700 Subject: [PATCH] [lldb] Store the dummy target in the selected exeuction context --- lldb/source/Core/Debugger.cpp | 4 +-- lldb/source/Core/Statusline.cpp | 6 +--- lldb/source/Interpreter/CommandObject.cpp | 37 --- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index ed674ee1275c7..3a3fb9eb0bdaa 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1221,8 +1221,8 @@ void Debugger::RedrawStatusline(bool update) { } ExecutionContext Debugger::GetSelectedExecutionContext() { - bool adopt_selected = true; - ExecutionContextRef exe_ctx_ref(GetSelectedTarget().get(), adopt_selected); + ExecutionContextRef exe_ctx_ref(&GetSelectedOrDummyTarget(), + /*adopt_selected=*/true); return ExecutionContext(exe_ctx_ref); } diff --git a/lldb/source/Core/Statusline.cpp b/lldb/source/Core/Statusline.cpp index 393d427241021..cfed40ac7fb2b 100644 --- a/lldb/source/Core/Statusline.cpp +++ b/lldb/source/Core/Statusline.cpp @@ -134,11 +134,7 @@ void Statusline::Redraw(bool update) { } ExecutionContext exe_ctx = m_debugger.GetSelectedExecutionContext(); - - // For colors and progress events, the format entity needs access to the - // debugger, which requires a target in the execution context. - if (!exe_ctx.HasTargetScope()) -exe_ctx.SetTargetPtr(&m_debugger.GetSelectedOrDummyTarget()); + assert(exe_ctx.HasTargetScope() && "format entity needs a target"); SymbolContext symbol_ctx; if (ProcessSP process_sp = exe_ctx.GetProcessSP()) { diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index 129646ebddb94..a72d804e5db5f 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -147,10 +147,11 @@ bool CommandObject::CheckRequirements(CommandReturnObject &result) { // we don't want any CommandObject instances to keep any of these objects // around longer than for a single command. Every command should call // CommandObject::Cleanup() after it has completed. - assert(!m_exe_ctx.GetTargetPtr()); - assert(!m_exe_ctx.GetProcessPtr()); - assert(!m_exe_ctx.GetThreadPtr()); - assert(!m_exe_ctx.GetFramePtr()); + assert(!m_exe_ctx.HasTargetScope() || + m_exe_ctx.GetTargetRef().IsDummyTarget()); + assert(!m_exe_ctx.HasProcessScope()); + assert(!m_exe_ctx.HasThreadScope()); + assert(!m_exe_ctx.HasFrameScope()); // Lock down the interpreter's execution context prior to running the command // so we guarantee the selected target, process, thread and frame can't go @@ -312,7 +313,7 @@ void CommandObject::HandleArgumentCompletion( assert(entry_ptr && "We said there was one entry, but there wasn't."); return; // Not worth crashing if asserts are off... } - + CommandArgumentEntry &entry = *entry_ptr; // For now, we only handle the simple case of one homogenous argument type. if (entry.size() != 1) @@ -495,21 +496,21 @@ bool CommandObject::IsPairType(ArgumentRepetitionType arg_repeat_type) { (arg_repeat_type == eArgRepeatPairRangeOptional); } -std::optional +std::optional CommandObject::ArgRepetitionFromString(llvm::StringRef string) { return llvm::StringSwitch(string) - .Case("plain", eArgRepeatPlain) - .Case("optional", eArgRepeatOptional) - .Case("plus", eArgRepeatPlus) - .Case("star", eArgRepeatStar) - .Case("range", eArgRepeatRange) - .Case("pair-plain", eArgRepeatPairPlain) - .Case("pair-optional", eArgRepeatPairOptional) - .Case("pair-plus", eArgRepeatPairPlus) - .Case("pair-star", eArgRepeatPairStar) - .Case("pair-range", eArgRepeatPairRange) - .Case("pair-range-optional", eArgRepeatPairRangeOptional) - .Default({}); + .Case("plain", eArgRepeatPlain) + .Case("optional", eArgRepeatOptional) + .Case("plus", eArgRepeatPlus) + .Case("star", eArgRepeatStar) + .Case("range", eArgRepeatRange) + .Case("pair-plain", eArgRepeatPairPlain) + .Case("pair-optional", eArgRepeatPairOptional) + .Case("pair-plus", eArgRepeatPairPlus) + .Case("pair-star", eArgRepeatPairStar) + .Case("pair-range", eArgRepeatPairRange) + .Case("pair-range-optional", eArgRepeatPairRangeOptional) + .Default({}); } static CommandObject::CommandArgumentEntry ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NativePDB] Allow type lookup in namespaces (PR #149876)
@@ -1630,6 +1630,53 @@ size_t SymbolFileNativePDB::ParseSymbolArrayInScope( return count; } +void SymbolFileNativePDB::CacheTypeNames() { ZequanWu wrote: Actually, `SymbolFileNativePDB::BuildParentMap()` already does the tpi stream iteration and it's called at NativePDB plugin initial setup. We could just cache the those base names there instead of iterating it the second time. https://github.com/llvm/llvm-project/pull/149876 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [DRAFT] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)
https://github.com/Michael137 ready_for_review https://github.com/llvm/llvm-project/pull/148877 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [DRAFT] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/148877 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/148877 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Michael Buch (Michael137) Changes LLDB currently attaches `AsmLabel`s to `FunctionDecl`s such that that the `IRExecutionUnit` can determine which mangled name to call (we can't rely on Clang deriving the correct mangled name to call because the debug-info AST doesn't contain all the info that would be encoded in the DWARF linkage names). However, we don't attach `AsmLabel`s for structors because they have multiple variants and thus it's not clear which mangled name to use. In the [RFC on fixing expression evaluation of abi-tagged structors](https://discourse.llvm.org/t/rfc-lldb-handling-abi-tagged-constructors-destructors-in-expression-evaluator/82816) we discussed encoding the structor variant into the `AsmLabel`s. Specifically in [this thread](https://discourse.llvm.org/t/rfc-lldb-handling-abi-tagged-constructors-destructors-in-expression-evaluator/82816/7) we discussed that the contents of the `AsmLabel` are completely under LLDB's control and we could make use of it to uniquely identify a function by encoding the exact module and DIE that the function is associated with (mangled names need not be enough since two identical mangled symbols may live in different modules). So if we already have a custom `AsmLabel` format, we can encode the structor variant in a follow-up (the current idea is to append the structor variant as a suffix to our custom `AsmLabel` when Clang emits the mangled name into the JITted IR). Then we would just have to teach the `IRExecutionUnit` to pick the correct structor variant DIE during symbol resolution. This patch sets up the infrastructure for the custom `AsmLabel` format by encoding the module id, DIE id and mangled name in it. **Implementation** The flow is as follows: 1. Create the label in `DWARFASTParserClang`. The format is: `$__lldb_func:mangled_name:module_id:die_id` 2. When resolving external symbols in `IRExecutionUnit`, we parse this label and then do a lookup by mangled name into the module. The reason I'm not using the DIE ID here is that for C++ methods, we create the decl using the declaration `DW_TAG_subprogram`. So we would still need to do some kind of search for the definition. I made the label creation an API on `TypeSystemClang` because the whole `AsmLabel` logic is Clang-specific, and in the future I want to stuff knowledge about constructor/destructor variants into the label, which is even more C++/Clang specific. But happy to consider other architectures for this. --- Patch is 34.44 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/148877.diff 17 Files Affected: - (modified) lldb/include/lldb/Core/Module.h (+3-1) - (modified) lldb/include/lldb/Expression/Expression.h (+25) - (modified) lldb/include/lldb/Symbol/SymbolFile.h (+14) - (modified) lldb/include/lldb/Symbol/TypeSystem.h (+16) - (modified) lldb/source/Core/Module.cpp (+16-3) - (modified) lldb/source/Expression/Expression.cpp (+16) - (modified) lldb/source/Expression/IRExecutionUnit.cpp (+74) - (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp (+1-1) - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (+26-17) - (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+41) - (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (+3) - (modified) lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp (+3-3) - (modified) lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp (+2-3) - (modified) lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp (+4-3) - (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+76-5) - (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h (+9-2) - (modified) lldb/unittests/Symbol/TestTypeSystemClang.cpp (+6-6) ``diff diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 8bb55c95773bc..3991a12997541 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -86,7 +86,8 @@ struct ModuleFunctionSearchOptions { /// /// The module will parse more detailed information as more queries are made. class Module : public std::enable_shared_from_this, - public SymbolContextScope { + public SymbolContextScope, + public UserID { public: class LookupInfo; // Static functions that can track the lifetime of module objects. This is @@ -97,6 +98,7 @@ class Module : public std::enable_shared_from_this, // using the "--global" (-g for short). static size_t GetNumberAllocatedModules(); + static Module *GetAllocatedModuleWithUID(lldb::user_id_t uid); static Module *GetAllocatedModuleAtIndex(size_t idx); static std::recursive_mutex &GetAllocationModuleCollectionMutex(); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 8de9364436cc
[Lldb-commits] [lldb] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/148877 >From fd6b6e8a3168fc233635e783773554ac980edb46 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 15 Nov 2024 01:59:36 + Subject: [PATCH 1/2] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels --- lldb/include/lldb/Core/Module.h | 4 +- lldb/include/lldb/Expression/Expression.h | 25 ++ lldb/include/lldb/Symbol/SymbolFile.h | 14 lldb/include/lldb/Symbol/TypeSystem.h | 16 lldb/source/Core/Module.cpp | 19 - lldb/source/Expression/Expression.cpp | 16 lldb/source/Expression/IRExecutionUnit.cpp| 74 + .../Clang/ClangExpressionDeclMap.cpp | 2 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 43 ++ .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 41 ++ .../SymbolFile/DWARF/SymbolFileDWARF.h| 3 + .../SymbolFile/NativePDB/PdbAstBuilder.cpp| 6 +- .../NativePDB/UdtRecordCompleter.cpp | 5 +- .../Plugins/SymbolFile/PDB/PDBASTParser.cpp | 7 +- .../TypeSystem/Clang/TypeSystemClang.cpp | 81 +-- .../TypeSystem/Clang/TypeSystemClang.h| 11 ++- lldb/unittests/Symbol/TestTypeSystemClang.cpp | 12 +-- 17 files changed, 335 insertions(+), 44 deletions(-) diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 8bb55c95773bc..3991a12997541 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -86,7 +86,8 @@ struct ModuleFunctionSearchOptions { /// /// The module will parse more detailed information as more queries are made. class Module : public std::enable_shared_from_this, - public SymbolContextScope { + public SymbolContextScope, + public UserID { public: class LookupInfo; // Static functions that can track the lifetime of module objects. This is @@ -97,6 +98,7 @@ class Module : public std::enable_shared_from_this, // using the "--global" (-g for short). static size_t GetNumberAllocatedModules(); + static Module *GetAllocatedModuleWithUID(lldb::user_id_t uid); static Module *GetAllocatedModuleAtIndex(size_t idx); static std::recursive_mutex &GetAllocationModuleCollectionMutex(); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 8de9364436ccf..f32878c9bf876 100644 --- a/lldb/include/lldb/Expression/Expression.h +++ b/lldb/include/lldb/Expression/Expression.h @@ -96,6 +96,31 @@ class Expression { ///invalid. }; +/// Holds parsed information about a function call label that +/// LLDB attaches as an AsmLabel to function AST nodes it parses +/// from debug-info. +/// +/// The format being: +/// +/// ::: +/// +/// The label string needs to stay valid for the entire lifetime +/// of this object. +struct FunctionCallLabel { + llvm::StringRef m_lookup_name; + lldb::user_id_t m_module_id; + + /// Mostly for debuggability. + lldb::user_id_t m_die_id; +}; + +/// LLDB attaches this prefix to mangled names of functions that it get called +/// from JITted expressions. +inline constexpr llvm::StringRef FunctionCallLabelPrefix = "$__lldb_func"; + +bool consumeFunctionCallLabelPrefix(llvm::StringRef &name); +bool hasFunctionCallLabelPrefix(llvm::StringRef name); + } // namespace lldb_private #endif // LLDB_EXPRESSION_EXPRESSION_H diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index e95f95553c17c..6aca276fc85b6 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -18,6 +18,7 @@ #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SourceModule.h" +#include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/TypeSystem.h" @@ -328,6 +329,19 @@ class SymbolFile : public PluginInterface { GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector &mangled_names); + /// Resolves the function DIE identified by \c lookup_name within + /// this SymbolFile. + /// + /// \param[in,out] sc_list The resolved functions will be appended to this + /// list. + /// + /// \param[in] lookup_name The UID of the function DIE to resolve. + /// + virtual llvm::Error FindAndResolveFunction(SymbolContextList &sc_list, + llvm::StringRef lookup_name) { +return llvm::createStringError("Not implemented"); + } + virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list) = 0; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index cb1f0130b548d..742c09251ea2f 100644
[Lldb-commits] [lldb] [lldb] Proofread formatting.rst (PR #149768)
@@ -203,7 +203,7 @@ Scoping Many times the information that you might have in your prompt might not be available and you won``t want it to print out if it isn``t valid. To take care kazutakahirata wrote: Fixed in the latest revision. Thanks! https://github.com/llvm/llvm-project/pull/149768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Proofread formatting.rst (PR #149768)
https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/149768 >From b9c3f2c64644b0fcde6677151a8e49795c18c6cb Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 20 Jul 2025 23:41:50 -0700 Subject: [PATCH 1/2] [lldb] Proofread formatting.rst --- lldb/docs/use/formatting.rst | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lldb/docs/use/formatting.rst b/lldb/docs/use/formatting.rst index 21b3ca1912b02..af0d03ecc19f2 100644 --- a/lldb/docs/use/formatting.rst +++ b/lldb/docs/use/formatting.rst @@ -3,7 +3,7 @@ Frame and Thread Format LLDB has a facility to allow users to define the format of the information that generates the descriptions for threads and stack frames. Typically when your -program stops at a breakpoint you will get two lines that describes why your +program stops at a breakpoint you will get two lines that describe why your thread stopped and where: :: @@ -192,7 +192,7 @@ you to desensitize control characters and also emit non-printable characters. Desensitizing Characters in the Format String - -The backslash control character allows your to enter the typical ``\a``, +The backslash control character allows you to enter the typical ``\a``, ``\b``, ``\f``, ``\n``, ``\r``, ``\t``, ``\v``, ``\\``, characters and along with the standard octal representation ``\0123`` and hex ``\xAB`` characters. This allows you to enter escape characters into your format strings and will @@ -203,7 +203,7 @@ Scoping Many times the information that you might have in your prompt might not be available and you won``t want it to print out if it isn``t valid. To take care -of this you can enclose everything that must resolve into a scope. A scope is +of this you can enclose everything that must resolve into a scope. A scope starts with ``{`` and ends with ``}``. For example in order to only display the current frame line table entry basename and line number when the information is available for the current frame: @@ -269,7 +269,7 @@ thread information: frame #0: 0x00010e85 a.out`main + 4 at test.c:19 frame #1: 0x00010e40 a.out`start + 52 -The frame related variables are: +The frame-related variables are: - ``${file.*}`` - ``${frame.*}`` >From 1c31eb8e481b70f863a086cde5294623d9db99df Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 21 Jul 2025 07:22:17 -0700 Subject: [PATCH 2/2] Address a comment. --- lldb/docs/use/formatting.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/docs/use/formatting.rst b/lldb/docs/use/formatting.rst index af0d03ecc19f2..39ccfed30a2ca 100644 --- a/lldb/docs/use/formatting.rst +++ b/lldb/docs/use/formatting.rst @@ -202,7 +202,7 @@ Scoping --- Many times the information that you might have in your prompt might not be -available and you won``t want it to print out if it isn``t valid. To take care +available and you won't want it to print out if it isn't valid. To take care of this you can enclose everything that must resolve into a scope. A scope starts with ``{`` and ends with ``}``. For example in order to only display the current frame line table entry basename and line number when the information is ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::atomic (PR #149801)
https://github.com/Michael137 approved this pull request. https://github.com/llvm/llvm-project/pull/149801 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 19e2991 - [lldb] Proofread formatting.rst (#149768)
Author: Kazu Hirata Date: 2025-07-21T07:24:15-07:00 New Revision: 19e299120936a8480b6da35dd8c98a1dd5483a5a URL: https://github.com/llvm/llvm-project/commit/19e299120936a8480b6da35dd8c98a1dd5483a5a DIFF: https://github.com/llvm/llvm-project/commit/19e299120936a8480b6da35dd8c98a1dd5483a5a.diff LOG: [lldb] Proofread formatting.rst (#149768) Added: Modified: lldb/docs/use/formatting.rst Removed: diff --git a/lldb/docs/use/formatting.rst b/lldb/docs/use/formatting.rst index 21b3ca1912b02..39ccfed30a2ca 100644 --- a/lldb/docs/use/formatting.rst +++ b/lldb/docs/use/formatting.rst @@ -3,7 +3,7 @@ Frame and Thread Format LLDB has a facility to allow users to define the format of the information that generates the descriptions for threads and stack frames. Typically when your -program stops at a breakpoint you will get two lines that describes why your +program stops at a breakpoint you will get two lines that describe why your thread stopped and where: :: @@ -192,7 +192,7 @@ you to desensitize control characters and also emit non-printable characters. Desensitizing Characters in the Format String - -The backslash control character allows your to enter the typical ``\a``, +The backslash control character allows you to enter the typical ``\a``, ``\b``, ``\f``, ``\n``, ``\r``, ``\t``, ``\v``, ``\\``, characters and along with the standard octal representation ``\0123`` and hex ``\xAB`` characters. This allows you to enter escape characters into your format strings and will @@ -202,8 +202,8 @@ Scoping --- Many times the information that you might have in your prompt might not be -available and you won``t want it to print out if it isn``t valid. To take care -of this you can enclose everything that must resolve into a scope. A scope is +available and you won't want it to print out if it isn't valid. To take care +of this you can enclose everything that must resolve into a scope. A scope starts with ``{`` and ends with ``}``. For example in order to only display the current frame line table entry basename and line number when the information is available for the current frame: @@ -269,7 +269,7 @@ thread information: frame #0: 0x00010e85 a.out`main + 4 at test.c:19 frame #1: 0x00010e40 a.out`start + 52 -The frame related variables are: +The frame-related variables are: - ``${file.*}`` - ``${frame.*}`` ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Proofread formatting.rst (PR #149768)
https://github.com/kazutakahirata closed https://github.com/llvm/llvm-project/pull/149768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::atomic (PR #149801)
@@ -1784,6 +1787,17 @@ static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { stl_summary_flags, MsvcStlStringSummaryProvider, "MSVC STL std::u32string summary provider")); + + stl_summary_flags.SetDontShowChildren(false); + stl_summary_flags.SetSkipPointers(false); Michael137 wrote: ```suggestion ``` We already set this above https://github.com/llvm/llvm-project/pull/149801 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] support moduleId in the stackTrace response (PR #149774)
https://github.com/woruyu updated https://github.com/llvm/llvm-project/pull/149774 >From 33c94346ac2b96d9f68fd1b8d62aebfa7b273499 Mon Sep 17 00:00:00 2001 From: woruyu <1214539...@qq.com> Date: Mon, 21 Jul 2025 15:52:50 +0800 Subject: [PATCH 1/3] [lldb-dap] support moduleId in the stackTrace response --- lldb/tools/lldb-dap/JSONUtils.cpp | 9 + 1 file changed, 9 insertions(+) diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 41ca29a405ac9..7abd9618cc71f 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -550,6 +550,15 @@ llvm::json::Value CreateStackFrame(DAP &dap, lldb::SBFrame &frame, if (frame.IsArtificial() || frame.IsHidden()) object.try_emplace("presentationHint", "subtle"); + lldb::SBModule module = frame.GetModule(); + if (module.IsValid()) { +std::string uuid = module.GetUUIDString(); +if (!uuid.empty()) + object.try_emplace("moduleId", uuid); +else + object.try_emplace("moduleId", module.GetFileSpec().GetFilename()); + } + return llvm::json::Value(std::move(object)); } >From 3c47de26e1e680e7d14727b6068da99963c21b2e Mon Sep 17 00:00:00 2001 From: woruyu <1214539...@qq.com> Date: Mon, 21 Jul 2025 17:09:08 +0800 Subject: [PATCH 2/3] fix: ci test for moduleId --- lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py index db43dbaf515cf..2743fca58e81d 100644 --- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py +++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py @@ -26,6 +26,7 @@ def test_core_file(self): "column": 0, "id": 524288, "line": 4, +"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "bar", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x40011C", @@ -34,6 +35,7 @@ def test_core_file(self): "column": 0, "id": 524289, "line": 10, +"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "foo", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x400142", @@ -42,6 +44,7 @@ def test_core_file(self): "column": 0, "id": 524290, "line": 16, +"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "_start", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x40015F", >From 5359fd9fe54326f9820cc0c1a0b23f1b7e06fc93 Mon Sep 17 00:00:00 2001 From: woruyu <1214539...@qq.com> Date: Mon, 21 Jul 2025 17:21:39 +0800 Subject: [PATCH 3/3] fix: python format --- lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py index 2743fca58e81d..1143cd93a70b3 100644 --- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py +++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py @@ -26,7 +26,7 @@ def test_core_file(self): "column": 0, "id": 524288, "line": 4, -"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", +"moduleId": "01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "bar", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x40011C", @@ -35,7 +35,7 @@ def test_core_file(self): "column": 0, "id": 524289, "line": 10, -"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", +"moduleId": "01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "foo", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x400142", @@ -44,7 +44,7 @@ def test_core_file(self): "column": 0, "id": 524290, "line": 16, -"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", +"moduleId": "01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "_start", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x40015F", ___ lldb-commits mailing list lldb-commits@lists.llvm.o
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::variant (PR #148554)
https://github.com/Michael137 approved this pull request. https://github.com/llvm/llvm-project/pull/148554 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NativePDB] Create functions with mangled name (PR #149701)
@@ -2353,3 +2356,67 @@ SymbolFileNativePDB::GetParentType(llvm::codeview::TypeIndex ti) { return std::nullopt; return parent_iter->second; } + +std::optional +SymbolFileNativePDB::FindMangledFunctionName(PdbCompilandSymId func_id) { + const CompilandIndexItem *cci = + m_index->compilands().GetCompiland(func_id.modi); + if (!cci) +return std::nullopt; + + CVSymbol sym_record = cci->m_debug_stream.readSymbolAtOffset(func_id.offset); + if (sym_record.kind() != S_LPROC32 && sym_record.kind() != S_GPROC32) +return std::nullopt; + + ProcSym proc(static_cast(sym_record.kind())); + cantFail(SymbolDeserializer::deserializeAs(sym_record, proc)); + return FindMangledSymbol(SegmentOffset(proc.Segment, proc.CodeOffset)); +} + +/// Find the mangled name of a function at \a so. Michael137 wrote: @rnk any thoughts on this? Could this live somewhere in LLVM's PDB support? https://github.com/llvm/llvm-project/pull/149701 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NativePDB] Create functions with mangled name (PR #149701)
@@ -888,22 +890,27 @@ PdbAstBuilder::CreateFunctionDecl(PdbCompilandSymId func_id, tag_record = CVTagRecord::create(index.tpi().getType(*eti)).asTag(); } } + +ConstString mangled_name; +if (auto mangled_name_opt = pdb->FindMangledFunctionName(func_id)) + mangled_name = ConstString(*mangled_name_opt); Michael137 wrote: Could be: ```suggestion ConstString mangled_name = pdb->FindMangledFunctionName(func_id).value_or(ConstString()); ``` https://github.com/llvm/llvm-project/pull/149701 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NativePDB] Create functions with mangled name (PR #149701)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/149701 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NativePDB] Create functions with mangled name (PR #149701)
https://github.com/Michael137 commented: I don't see anything wrong with trying to attach a mangled name to methods here. Though not a PDB expert so CCing @rnk @ZequanWu https://github.com/llvm/llvm-project/pull/149701 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Proofread formatting.rst (PR #149768)
@@ -203,7 +203,7 @@ Scoping Many times the information that you might have in your prompt might not be available and you won``t want it to print out if it isn``t valid. To take care DavidSpickett wrote: You can fix the uses double back tick instead of apostrophe `'` as well. https://github.com/llvm/llvm-project/pull/149768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] support moduleId in the stackTrace response (PR #149774)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r HEAD~1...HEAD lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py `` View the diff from darker here. ``diff --- TestDAP_coreFile.py 2025-07-21 09:09:08.00 + +++ TestDAP_coreFile.py 2025-07-21 09:11:18.976236 + @@ -24,29 +24,29 @@ expected_frames = [ { "column": 0, "id": 524288, "line": 4, -"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", +"moduleId": "01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "bar", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x40011C", }, { "column": 0, "id": 524289, "line": 10, -"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", +"moduleId": "01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "foo", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x400142", }, { "column": 0, "id": 524290, "line": 16, -"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", +"moduleId": "01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "_start", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x40015F", }, ] `` https://github.com/llvm/llvm-project/pull/149774 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Fix arm64 hardware breakpoint/watchpoint to arm32 process. (PR #147198)
@@ -8,6 +8,7 @@ add_lldb_library(lldbPluginProcessLinux NativeRegisterContextLinux.cpp NativeRegisterContextLinux_arm.cpp NativeRegisterContextLinux_arm64.cpp + NativeRegisterContextLinuxArm64Shared.cpp DavidSpickett wrote: We have the term "dbreg" in use already, so use that and follow the existing naming style. `NativeRegisterContextLinux_arm64dbreg.cpp`. https://github.com/llvm/llvm-project/pull/147198 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Fix arm64 hardware breakpoint/watchpoint to arm32 process. (PR #147198)
@@ -0,0 +1,63 @@ +#include "NativeRegisterContextLinuxArm64Shared.h" DavidSpickett wrote: Also the top of this file needs a comment explaining why it needed to be split out. https://github.com/llvm/llvm-project/pull/147198 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Fix arm64 hardware breakpoint/watchpoint to arm32 process. (PR #147198)
@@ -74,8 +75,10 @@ class NativeRegisterContextLinux_arm : public NativeRegisterContextLinux { bool WatchpointIsEnabled(uint32_t wp_index); - // Debug register type select - enum DREGType { eDREGTypeWATCH = 0, eDREGTypeBREAK }; + using DREGType = NativeRegisterContextDBReg::DREGType; + static const DREGType eDREGTypeBREAK = DREGType::eDREGTypeBREAK; + static const DREGType eDREGTypeWATCH = DREGType::eDREGTypeWATCH; + using DREG = NativeRegisterContextDBReg::DREG; DavidSpickett wrote: I don't see the need for `static const DREGType eDREGTypeBREAK` and I think it would be clearer to fully qualify DREGType and DREG rather than `using` them. https://github.com/llvm/llvm-project/pull/147198 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Fix arm64 hardware breakpoint/watchpoint to arm32 process. (PR #147198)
@@ -0,0 +1,63 @@ +#include "NativeRegisterContextLinuxArm64Shared.h" DavidSpickett wrote: All new .cpp and .h files need the license header, you can copy one from an existing file and modify it. https://github.com/llvm/llvm-project/pull/147198 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Fix arm64 hardware breakpoint/watchpoint to arm32 process. (PR #147198)
@@ -0,0 +1,63 @@ +#include "NativeRegisterContextLinuxArm64Shared.h" + +using namespace lldb_private::process_linux::arm64; + +namespace lldb_private { +namespace process_linux { +namespace arm64 { + +namespace { +Status ReadHardwareDebugInfoHelper(int regset, ::pid_t tid, DavidSpickett wrote: llvm style is to use a static function rather than anonymous namespaces. https://llvm.org/docs/CodingStandards.html#restrict-visibility Though it doesn't actually show an example of doing it, I will fix that. It does say right at the end to use static. https://github.com/llvm/llvm-project/pull/147198 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Fix arm64 hardware breakpoint/watchpoint to arm32 process. (PR #147198)
@@ -0,0 +1,63 @@ +#include "NativeRegisterContextLinuxArm64Shared.h" + +using namespace lldb_private::process_linux::arm64; + +namespace lldb_private { +namespace process_linux { +namespace arm64 { DavidSpickett wrote: You don't need `using namespace` if you're then going to open the same namespaces. Here I would just write out the fully qualified names and have `using namespace` if you still need it after doing that. `lldb_private::proccess_linux::arm64::ReadHardwareDebugInfo` for example. https://github.com/llvm/llvm-project/pull/147198 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Fix arm64 hardware breakpoint/watchpoint to arm32 process. (PR #147198)
@@ -0,0 +1,23 @@ +#include "Plugins/Process/Linux/NativeProcessLinux.h" +#include "Plugins/Process/Utility/NativeRegisterContextDBReg.h" +#include "lldb/Utility/Status.h" +#include +#include +#include +#include +#include + +namespace lldb_private { +namespace process_linux { +namespace arm64 { + +Status ReadHardwareDebugInfo(::pid_t tid, uint32_t &max_hwp_supported, + uint32_t &max_hbp_supported); + +Status WriteHardwareDebugRegs( +int hwbType, ::pid_t tid, uint32_t max_supported, +const std::array ®s); + +} // namespace arm64 +} // namespace process_linux +} // namespace lldb_private DavidSpickett wrote: Add a newline at the end of the file. I'm of the camp that wonders why this is needed in this day and age, but it does trip up some tools and it's easy to fix. https://github.com/llvm/llvm-project/pull/147198 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Fix arm64 hardware breakpoint/watchpoint to arm32 process. (PR #147198)
@@ -102,18 +105,8 @@ class NativeRegisterContextLinux_arm : public NativeRegisterContextLinux { uint32_t m_gpr_arm[k_num_gpr_registers_arm]; RegisterInfoPOSIX_arm::FPU m_fpr; - // Debug register info for hardware breakpoints and watchpoints management. - struct DREG { -lldb::addr_t address; // Breakpoint/watchpoint address value. -lldb::addr_t hit_addr; // Address at which last watchpoint trigger exception - // occurred. -lldb::addr_t real_addr; // Address value that should cause target to stop. -uint32_t control; // Breakpoint/watchpoint control value. -uint32_t refcount; // Serves as enable/disable and reference counter. DavidSpickett wrote: Switching to the other definition removes `refcount` which appears to be unused anyway. Send a separate PR to remove that field from all definitions so the bots can test that assertion in isolation. https://github.com/llvm/llvm-project/pull/147198 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)
@@ -130,8 +139,11 @@ Module *Module::GetAllocatedModuleAtIndex(size_t idx) { return nullptr; } +// TODO: needs a mutex +static lldb::user_id_t g_unique_id = 1; + Module::Module(const ModuleSpec &module_spec) -: m_unwind_table(*this), m_file_has_changed(false), +: UserID(g_unique_id++), m_unwind_table(*this), m_file_has_changed(false), Michael137 wrote: Is this more-or-less what you had in mind @labath re. the unique module identifiers? https://github.com/llvm/llvm-project/pull/148877 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] support moduleId in the stackTrace response (PR #149774)
@@ -550,6 +550,15 @@ llvm::json::Value CreateStackFrame(DAP &dap, lldb::SBFrame &frame, if (frame.IsArtificial() || frame.IsHidden()) object.try_emplace("presentationHint", "subtle"); + lldb::SBModule module = frame.GetModule(); + if (module.IsValid()) { +std::string uuid = module.GetUUIDString(); +if (!uuid.empty()) + object.try_emplace("moduleId", uuid); +else + object.try_emplace("moduleId", module.GetFileSpec().GetFilename()); da-viper wrote: Do not set the file name if there is no UUID since it is optional. https://github.com/llvm/llvm-project/pull/149774 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [DRAFT] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/148877 >From fd6b6e8a3168fc233635e783773554ac980edb46 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 15 Nov 2024 01:59:36 + Subject: [PATCH] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels --- lldb/include/lldb/Core/Module.h | 4 +- lldb/include/lldb/Expression/Expression.h | 25 ++ lldb/include/lldb/Symbol/SymbolFile.h | 14 lldb/include/lldb/Symbol/TypeSystem.h | 16 lldb/source/Core/Module.cpp | 19 - lldb/source/Expression/Expression.cpp | 16 lldb/source/Expression/IRExecutionUnit.cpp| 74 + .../Clang/ClangExpressionDeclMap.cpp | 2 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 43 ++ .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 41 ++ .../SymbolFile/DWARF/SymbolFileDWARF.h| 3 + .../SymbolFile/NativePDB/PdbAstBuilder.cpp| 6 +- .../NativePDB/UdtRecordCompleter.cpp | 5 +- .../Plugins/SymbolFile/PDB/PDBASTParser.cpp | 7 +- .../TypeSystem/Clang/TypeSystemClang.cpp | 81 +-- .../TypeSystem/Clang/TypeSystemClang.h| 11 ++- lldb/unittests/Symbol/TestTypeSystemClang.cpp | 12 +-- 17 files changed, 335 insertions(+), 44 deletions(-) diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 8bb55c95773bc..3991a12997541 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -86,7 +86,8 @@ struct ModuleFunctionSearchOptions { /// /// The module will parse more detailed information as more queries are made. class Module : public std::enable_shared_from_this, - public SymbolContextScope { + public SymbolContextScope, + public UserID { public: class LookupInfo; // Static functions that can track the lifetime of module objects. This is @@ -97,6 +98,7 @@ class Module : public std::enable_shared_from_this, // using the "--global" (-g for short). static size_t GetNumberAllocatedModules(); + static Module *GetAllocatedModuleWithUID(lldb::user_id_t uid); static Module *GetAllocatedModuleAtIndex(size_t idx); static std::recursive_mutex &GetAllocationModuleCollectionMutex(); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 8de9364436ccf..f32878c9bf876 100644 --- a/lldb/include/lldb/Expression/Expression.h +++ b/lldb/include/lldb/Expression/Expression.h @@ -96,6 +96,31 @@ class Expression { ///invalid. }; +/// Holds parsed information about a function call label that +/// LLDB attaches as an AsmLabel to function AST nodes it parses +/// from debug-info. +/// +/// The format being: +/// +/// ::: +/// +/// The label string needs to stay valid for the entire lifetime +/// of this object. +struct FunctionCallLabel { + llvm::StringRef m_lookup_name; + lldb::user_id_t m_module_id; + + /// Mostly for debuggability. + lldb::user_id_t m_die_id; +}; + +/// LLDB attaches this prefix to mangled names of functions that it get called +/// from JITted expressions. +inline constexpr llvm::StringRef FunctionCallLabelPrefix = "$__lldb_func"; + +bool consumeFunctionCallLabelPrefix(llvm::StringRef &name); +bool hasFunctionCallLabelPrefix(llvm::StringRef name); + } // namespace lldb_private #endif // LLDB_EXPRESSION_EXPRESSION_H diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index e95f95553c17c..6aca276fc85b6 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -18,6 +18,7 @@ #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SourceModule.h" +#include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/TypeSystem.h" @@ -328,6 +329,19 @@ class SymbolFile : public PluginInterface { GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector &mangled_names); + /// Resolves the function DIE identified by \c lookup_name within + /// this SymbolFile. + /// + /// \param[in,out] sc_list The resolved functions will be appended to this + /// list. + /// + /// \param[in] lookup_name The UID of the function DIE to resolve. + /// + virtual llvm::Error FindAndResolveFunction(SymbolContextList &sc_list, + llvm::StringRef lookup_name) { +return llvm::createStringError("Not implemented"); + } + virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list) = 0; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index cb1f0130b548d..742c09251ea2f 100644 ---
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::atomic (PR #149801)
https://github.com/Nerixyz created https://github.com/llvm/llvm-project/pull/149801 Adds synthetic children and a summary provider for `std::atomic` on MSVC's STL. This currently only supports DWARF because it relies on the template argument. Once there are PDB tests, this will probably use the return type of some method like `value()` because template types aren't available there. Towards #24834. >From 679f4fae45cb25fbc16fc8117c287122afd219d2 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Mon, 21 Jul 2025 13:36:44 +0200 Subject: [PATCH] [LLDB] Add formatters for MSVC STL std::atomic --- .../Plugins/Language/CPlusPlus/CMakeLists.txt | 1 + .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 14 +++ .../Plugins/Language/CPlusPlus/MsvcStl.h | 7 ++ .../Language/CPlusPlus/MsvcStlAtomic.cpp | 102 ++ .../atomic/TestDataFormatterStdAtomic.py | 6 ++ 5 files changed, 130 insertions(+) create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt index 5905d9b9a6d03..ce4e2d6f0f5af 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt +++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt @@ -34,6 +34,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN LibStdcppTuple.cpp LibStdcppUniquePointer.cpp MsvcStl.cpp + MsvcStlAtomic.cpp MsvcStlSmartPointer.cpp MsvcStlTuple.cpp MsvcStlVector.cpp diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index a0d5e1dfe3227..16b4d55d2db73 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1763,6 +1763,9 @@ static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { .SetDontShowValue(false) .SetShowMembersOneLiner(false) .SetHideItemNames(false); + SyntheticChildren::Flags stl_synth_flags; + stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences( + false); using StringElementType = StringPrinter::StringElementType; @@ -1784,6 +1787,17 @@ static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { stl_summary_flags, MsvcStlStringSummaryProvider, "MSVC STL std::u32string summary provider")); + + stl_summary_flags.SetDontShowChildren(false); + stl_summary_flags.SetSkipPointers(false); + + AddCXXSynthetic(cpp_category_sp, MsvcStlAtomicSyntheticFrontEndCreator, + "MSVC STL std::atomic synthetic children", + "^std::atomic<.+>$", stl_synth_flags, true); + + AddCXXSummary(cpp_category_sp, MsvcStlAtomicSummaryProvider, +"MSVC STL std::atomic summary provider", "^std::atomic<.+>$", +stl_summary_flags, true); } static void LoadSystemFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h index c08eecfdecee7..3ac12c17a96e1 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h @@ -71,6 +71,13 @@ SyntheticChildrenFrontEnd * MsvcStlOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp); +// MSVC STL std::atomic<> +bool MsvcStlAtomicSummaryProvider(ValueObject &valobj, Stream &stream, + const TypeSummaryOptions &options); +SyntheticChildrenFrontEnd * +MsvcStlAtomicSyntheticFrontEndCreator(CXXSyntheticChildren *, + lldb::ValueObjectSP valobj_sp); + } // namespace formatters } // namespace lldb_private diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp new file mode 100644 index 0..3ec324577ac76 --- /dev/null +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp @@ -0,0 +1,102 @@ +//===-- MsvcStlAtomic.cpp -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "MsvcStl.h" + +#include "lldb/DataFormatters/TypeSynthetic.h" + +using namespace lldb; + +namespace lldb_private { +namespace formatters { + +class MsvcStlAtomicSyntheticFrontEnd : public SyntheticChildrenFrontEnd { +public: + MsvcStlAtomicSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp); + + llvm::Expected CalculateNumChildren() override; + + lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override; + + lldb::ChildCacheSta
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::atomic (PR #149801)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: nerix (Nerixyz) Changes Adds synthetic children and a summary provider for `std::atomic` on MSVC's STL. This currently only supports DWARF because it relies on the template argument. Once there are PDB tests, this will probably use the return type of some method like `value()` because template types aren't available there. Towards #24834. --- Full diff: https://github.com/llvm/llvm-project/pull/149801.diff 5 Files Affected: - (modified) lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt (+1) - (modified) lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp (+14) - (modified) lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h (+7) - (added) lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp (+102) - (modified) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py (+6) ``diff diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt index 5905d9b9a6d03..ce4e2d6f0f5af 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt +++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt @@ -34,6 +34,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN LibStdcppTuple.cpp LibStdcppUniquePointer.cpp MsvcStl.cpp + MsvcStlAtomic.cpp MsvcStlSmartPointer.cpp MsvcStlTuple.cpp MsvcStlVector.cpp diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index a0d5e1dfe3227..16b4d55d2db73 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1763,6 +1763,9 @@ static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { .SetDontShowValue(false) .SetShowMembersOneLiner(false) .SetHideItemNames(false); + SyntheticChildren::Flags stl_synth_flags; + stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences( + false); using StringElementType = StringPrinter::StringElementType; @@ -1784,6 +1787,17 @@ static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { stl_summary_flags, MsvcStlStringSummaryProvider, "MSVC STL std::u32string summary provider")); + + stl_summary_flags.SetDontShowChildren(false); + stl_summary_flags.SetSkipPointers(false); + + AddCXXSynthetic(cpp_category_sp, MsvcStlAtomicSyntheticFrontEndCreator, + "MSVC STL std::atomic synthetic children", + "^std::atomic<.+>$", stl_synth_flags, true); + + AddCXXSummary(cpp_category_sp, MsvcStlAtomicSummaryProvider, +"MSVC STL std::atomic summary provider", "^std::atomic<.+>$", +stl_summary_flags, true); } static void LoadSystemFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h index c08eecfdecee7..3ac12c17a96e1 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h @@ -71,6 +71,13 @@ SyntheticChildrenFrontEnd * MsvcStlOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp); +// MSVC STL std::atomic<> +bool MsvcStlAtomicSummaryProvider(ValueObject &valobj, Stream &stream, + const TypeSummaryOptions &options); +SyntheticChildrenFrontEnd * +MsvcStlAtomicSyntheticFrontEndCreator(CXXSyntheticChildren *, + lldb::ValueObjectSP valobj_sp); + } // namespace formatters } // namespace lldb_private diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp new file mode 100644 index 0..3ec324577ac76 --- /dev/null +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp @@ -0,0 +1,102 @@ +//===-- MsvcStlAtomic.cpp -===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "MsvcStl.h" + +#include "lldb/DataFormatters/TypeSynthetic.h" + +using namespace lldb; + +namespace lldb_private { +namespace formatters { + +class MsvcStlAtomicSyntheticFrontEnd : public SyntheticChildrenFrontEnd { +public: + MsvcStlAtomicSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp); + + llvm::Expected CalculateNumChildren() override; + + lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override; + + lldb::ChildCacheState Update() override; + + llvm::Expected GetIndexOfChildWithName(ConstStri
[Lldb-commits] [lldb] f0a7462 - [LLDB] Add formatters for MSVC STL std::optional (#149545)
Author: nerix Date: 2025-07-21T10:20:47+01:00 New Revision: f0a7462cf03dd69dc9d5affb870facc098d9e73d URL: https://github.com/llvm/llvm-project/commit/f0a7462cf03dd69dc9d5affb870facc098d9e73d DIFF: https://github.com/llvm/llvm-project/commit/f0a7462cf03dd69dc9d5affb870facc098d9e73d.diff LOG: [LLDB] Add formatters for MSVC STL std::optional (#149545) Adds synthetic children for `std::optional` from MSVC's STL. Most of the machinery for `std::optional` is already there. Towards #24834. Added: Modified: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/optional/TestDataFormatterGenericOptional.py Removed: diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index a8ebde0b55815..a0d5e1dfe3227 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1545,20 +1545,10 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { "std::bitset synthetic child", "^std::(__debug::)?bitset<.+>(( )?&)?$", stl_deref_flags, true); - AddCXXSynthetic( - cpp_category_sp, - lldb_private::formatters::LibStdcppOptionalSyntheticFrontEndCreator, - "std::optional synthetic child", "^std::optional<.+>(( )?&)?$", - stl_deref_flags, true); - AddCXXSummary(cpp_category_sp, lldb_private::formatters::StdlibCoroutineHandleSummaryProvider, "libstdc++ std::coroutine_handle summary provider", libstdcpp_std_coroutine_handle_regex, stl_summary_flags, true); - AddCXXSummary(cpp_category_sp, -lldb_private::formatters::GenericOptionalSummaryProvider, -"libstd++ std::optional summary provider", -"^std::optional<.+>(( )?&)?$", stl_summary_flags, true); } static lldb_private::SyntheticChildrenFrontEnd * @@ -1648,6 +1638,17 @@ GenericForwardListSyntheticFrontEndCreator(CXXSyntheticChildren *children, *valobj_sp); } +static SyntheticChildrenFrontEnd * +GenericOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *children, +lldb::ValueObjectSP valobj_sp) { + if (!valobj_sp) +return nullptr; + + if (IsMsvcStlOptional(*valobj_sp)) +return MsvcStlOptionalSyntheticFrontEndCreator(children, valobj_sp); + return LibStdcppOptionalSyntheticFrontEndCreator(children, valobj_sp); +} + /// Load formatters that are formatting types from more than one STL static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { if (!cpp_category_sp) @@ -1713,6 +1714,12 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { "std::forward_list synthetic children", "^std::forward_list<.+>(( )?&)?$", stl_synth_flags, true); + SyntheticChildren::Flags stl_deref_flags = stl_synth_flags; + stl_deref_flags.SetFrontEndWantsDereference(); + AddCXXSynthetic(cpp_category_sp, GenericOptionalSyntheticFrontEndCreator, + "std::optional synthetic children", + "^std::optional<.+>(( )?&)?$", stl_deref_flags, true); + AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider, "MSVC STL/libstdc++ std::shared_ptr summary provider", "^std::shared_ptr<.+>(( )?&)?$", stl_summary_flags, true); @@ -1739,6 +1746,9 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { TypeSummaryImplSP(new ScriptSummaryFormat( stl_summary_flags, "lldb.formatters.cpp.gnu_libstdcpp.ForwardListSummaryProvider"))); + AddCXXSummary(cpp_category_sp, GenericOptionalSummaryProvider, +"MSVC STL/libstd++ std::optional summary provider", +"^std::optional<.+>(( )?&)?$", stl_summary_flags, true); } static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { diff --git a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp index c041f39022d10..7fc6eb55d4e3e 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp @@ -9,6 +9,7 @@ #include "Generic.h" #include "LibCxx.h" #include "LibStdcpp.h" +#include "MsvcStl.h" #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/Target/Target.h" @@ -32,6 +33,7 @@ class GenericOptionalFrontend : public SyntheticChildrenFrontEnd { enum class StdLib { LibCxx, LibStdcpp, +MsvcStl,
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::optional (PR #149545)
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/149545 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] support moduleId in the stackTrace response (PR #149774)
da-viper wrote: > where a test should go—`DAPTests.cpp`, `ProtocolTypesTest.cpp`, or elsewhere It should go into `TestDAP_stackTrace` https://github.com/llvm/llvm-project/blob/e94bc16b8e12a64ff28aedc58ee6e95e1f9d6f4b/lldb/test/API/tools/lldb-dap/stackTrace/TestDAP_stackTrace.py#L29-L31 >Also, is there a simple way to test this locally without a full frontend? Not that I am aware of, you can look at LLDB_DAP logs (you need to set a log path) when running the DAP adapter or looking at the logs in a failed test. https://github.com/llvm/llvm-project/pull/149774 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64][Linux] Show MTE store only setting in mte_ctrl (PR #145033)
DavidSpickett wrote: ping! https://github.com/llvm/llvm-project/pull/145033 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Add HWCAP3 to register field detection (PR #145029)
DavidSpickett wrote: ping! https://github.com/llvm/llvm-project/pull/145029 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 401b5cc - [LLDB] Add formatters for MSVC STL std::variant (#148554)
Author: nerix Date: 2025-07-21T12:46:34+01:00 New Revision: 401b5ccf6b507ed36e959e7ae2f4b5e052647196 URL: https://github.com/llvm/llvm-project/commit/401b5ccf6b507ed36e959e7ae2f4b5e052647196 DIFF: https://github.com/llvm/llvm-project/commit/401b5ccf6b507ed36e959e7ae2f4b5e052647196.diff LOG: [LLDB] Add formatters for MSVC STL std::variant (#148554) Adds a summary and synthetic children for MSVC STL's `std::variant`. This one is a bit complicated because of DWARF vs PDB differences. I put the representations in comments. Being able to `GetChildMemberWithName` a member in an anonymous union would make this a lot simpler (`std::optional` will have something similar iirc). Towards #24834. Added: lldb/source/Plugins/Language/CPlusPlus/MsvcStlVariant.cpp Modified: lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.h lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py Removed: diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt index 5905d9b9a6d03..e1dd5bf84d7eb 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt +++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt @@ -36,6 +36,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN MsvcStl.cpp MsvcStlSmartPointer.cpp MsvcStlTuple.cpp + MsvcStlVariant.cpp MsvcStlVector.cpp MSVCUndecoratedNameParser.cpp diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index a0d5e1dfe3227..481fe6106849c 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1449,11 +1449,6 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { SyntheticChildrenSP(new ScriptedSyntheticChildren( stl_synth_flags, "lldb.formatters.cpp.gnu_libstdcpp.StdForwardListSynthProvider"))); - cpp_category_sp->AddTypeSynthetic( - "^std::variant<.+>$", eFormatterMatchRegex, - SyntheticChildrenSP(new ScriptedSyntheticChildren( - stl_synth_flags, - "lldb.formatters.cpp.gnu_libstdcpp.VariantSynthProvider"))); stl_summary_flags.SetDontShowChildren(false); stl_summary_flags.SetSkipPointers(false); @@ -1509,9 +1504,6 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { TypeSummaryImplSP(new ScriptSummaryFormat( stl_summary_flags, "lldb.formatters.cpp.gnu_libstdcpp.ForwardListSummaryProvider"))); - AddCXXSummary(cpp_category_sp, LibStdcppVariantSummaryProvider, -"libstdc++ std::variant summary provider", "^std::variant<.+>$", -stl_summary_flags, true); AddCXXSynthetic( cpp_category_sp, @@ -1649,6 +1641,25 @@ GenericOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *children, return LibStdcppOptionalSyntheticFrontEndCreator(children, valobj_sp); } +static SyntheticChildrenFrontEnd * +GenericVariantSyntheticFrontEndCreator(CXXSyntheticChildren *children, + lldb::ValueObjectSP valobj_sp) { + if (!valobj_sp) +return nullptr; + + if (IsMsvcStlVariant(*valobj_sp)) +return MsvcStlVariantSyntheticFrontEndCreator(children, valobj_sp); + return new ScriptedSyntheticChildren::FrontEnd( + "lldb.formatters.cpp.gnu_libstdcpp.VariantSynthProvider", *valobj_sp); +} + +static bool GenericVariantSummaryProvider(ValueObject &valobj, Stream &stream, + const TypeSummaryOptions &options) { + if (IsMsvcStlVariant(valobj)) +return MsvcStlVariantSummaryProvider(valobj, stream, options); + return LibStdcppVariantSummaryProvider(valobj, stream, options); +} + /// Load formatters that are formatting types from more than one STL static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { if (!cpp_category_sp) @@ -1713,6 +1724,9 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { AddCXXSynthetic(cpp_category_sp, GenericForwardListSyntheticFrontEndCreator, "std::forward_list synthetic children", "^std::forward_list<.+>(( )?&)?$", stl_synth_flags, true); + AddCXXSynthetic(cpp_category_sp, GenericVariantSyntheticFrontEndCreator, + "std::variant synthetic children", "^std::variant<.*>$", + stl_synth_flags, true); SyntheticChildren::Flags stl_deref_flags = stl_synth_flags; stl_deref_flags.SetFrontEndWantsDereference(); @@ -1749,6 +1763,9 @@ static void LoadCommonStlFormatters(lld
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::variant (PR #148554)
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/148554 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL unordered containers (PR #149519)
@@ -127,8 +123,16 @@ def look_for_content_and_continue(self, var_name, patterns): @add_test_categories(["libstdcxx"]) def test_with_run_command_libstdcpp(self): -self.do_test_with_run_command(USE_LIBSTDCPP) +self.build(dictionary={"USE_LIBSTDCPP": 1}) +self.do_test_with_run_command() @add_test_categories(["libc++"]) def test_with_run_command_libcpp(self): -self.do_test_with_run_command(USE_LIBCPP) +self.build(dictionary={"USE_LIBCPP": 1}) +self.do_test_with_run_command() Michael137 wrote: Huh looks like we're not actually testing the `__debug` libstdc++ version. Probably because we don't have support for it anyway. Might be nice to add an XFAILed test for it here. Ofc not necessary as part of this PR https://github.com/llvm/llvm-project/pull/149519 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL unordered containers (PR #149519)
https://github.com/Michael137 approved this pull request. nice https://github.com/llvm/llvm-project/pull/149519 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::variant (PR #148554)
https://github.com/Nerixyz updated https://github.com/llvm/llvm-project/pull/148554 >From fe30b282bb0ba181060d52ea823e357a5cd6f527 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Mon, 14 Jul 2025 00:30:48 +0200 Subject: [PATCH 1/2] [LLDB] Add formatters for MSVC STL std::variant --- .../Plugins/Language/CPlusPlus/CMakeLists.txt | 1 + .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 33 ++- .../Plugins/Language/CPlusPlus/LibStdcpp.h| 3 + .../Plugins/Language/CPlusPlus/MsvcStl.h | 8 + .../Language/CPlusPlus/MsvcStlVariant.cpp | 221 ++ .../variant/TestDataFormatterStdVariant.py| 6 + 6 files changed, 264 insertions(+), 8 deletions(-) create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlVariant.cpp diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt index 5905d9b9a6d03..e1dd5bf84d7eb 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt +++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt @@ -36,6 +36,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN MsvcStl.cpp MsvcStlSmartPointer.cpp MsvcStlTuple.cpp + MsvcStlVariant.cpp MsvcStlVector.cpp MSVCUndecoratedNameParser.cpp diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index a0d5e1dfe3227..481fe6106849c 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1449,11 +1449,6 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { SyntheticChildrenSP(new ScriptedSyntheticChildren( stl_synth_flags, "lldb.formatters.cpp.gnu_libstdcpp.StdForwardListSynthProvider"))); - cpp_category_sp->AddTypeSynthetic( - "^std::variant<.+>$", eFormatterMatchRegex, - SyntheticChildrenSP(new ScriptedSyntheticChildren( - stl_synth_flags, - "lldb.formatters.cpp.gnu_libstdcpp.VariantSynthProvider"))); stl_summary_flags.SetDontShowChildren(false); stl_summary_flags.SetSkipPointers(false); @@ -1509,9 +1504,6 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { TypeSummaryImplSP(new ScriptSummaryFormat( stl_summary_flags, "lldb.formatters.cpp.gnu_libstdcpp.ForwardListSummaryProvider"))); - AddCXXSummary(cpp_category_sp, LibStdcppVariantSummaryProvider, -"libstdc++ std::variant summary provider", "^std::variant<.+>$", -stl_summary_flags, true); AddCXXSynthetic( cpp_category_sp, @@ -1649,6 +1641,25 @@ GenericOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *children, return LibStdcppOptionalSyntheticFrontEndCreator(children, valobj_sp); } +static SyntheticChildrenFrontEnd * +GenericVariantSyntheticFrontEndCreator(CXXSyntheticChildren *children, + lldb::ValueObjectSP valobj_sp) { + if (!valobj_sp) +return nullptr; + + if (IsMsvcStlVariant(*valobj_sp)) +return MsvcStlVariantSyntheticFrontEndCreator(children, valobj_sp); + return new ScriptedSyntheticChildren::FrontEnd( + "lldb.formatters.cpp.gnu_libstdcpp.VariantSynthProvider", *valobj_sp); +} + +static bool GenericVariantSummaryProvider(ValueObject &valobj, Stream &stream, + const TypeSummaryOptions &options) { + if (IsMsvcStlVariant(valobj)) +return MsvcStlVariantSummaryProvider(valobj, stream, options); + return LibStdcppVariantSummaryProvider(valobj, stream, options); +} + /// Load formatters that are formatting types from more than one STL static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { if (!cpp_category_sp) @@ -1713,6 +1724,9 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { AddCXXSynthetic(cpp_category_sp, GenericForwardListSyntheticFrontEndCreator, "std::forward_list synthetic children", "^std::forward_list<.+>(( )?&)?$", stl_synth_flags, true); + AddCXXSynthetic(cpp_category_sp, GenericVariantSyntheticFrontEndCreator, + "std::variant synthetic children", "^std::variant<.*>$", + stl_synth_flags, true); SyntheticChildren::Flags stl_deref_flags = stl_synth_flags; stl_deref_flags.SetFrontEndWantsDereference(); @@ -1749,6 +1763,9 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { AddCXXSummary(cpp_category_sp, GenericOptionalSummaryProvider, "MSVC STL/libstd++ std::optional summary provider", "^std::optional<.+>(( )?&)?$", stl_summary_flags, true); + AddCXXSummary(cpp_category_sp, GenericVariantSummaryProvider, +"MSVC STL/libstdc++ std::variant summary provider", +"^std::variant<.*>$", stl_summary_flags, true); } static void
[Lldb-commits] [lldb] [lldb-dap] support moduleId in the stackTrace response (PR #149774)
da-viper wrote: You can either use the `self.dap_server.get_modules` and compare the uuid received with the one returned from the stacktrace request. OR send an evaluate request of `image list --uuid --basename` and regex parse the modules to get the uuid. https://github.com/llvm/llvm-project/pull/149774 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Proofread formatting.rst (PR #149768)
https://github.com/DavidSpickett approved this pull request. With the lack of apostrophes fixed, this LGTM. https://github.com/llvm/llvm-project/pull/149768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] support moduleId in the stackTrace response (PR #149774)
https://github.com/woruyu updated https://github.com/llvm/llvm-project/pull/149774 >From 33c94346ac2b96d9f68fd1b8d62aebfa7b273499 Mon Sep 17 00:00:00 2001 From: woruyu <1214539...@qq.com> Date: Mon, 21 Jul 2025 15:52:50 +0800 Subject: [PATCH 1/2] [lldb-dap] support moduleId in the stackTrace response --- lldb/tools/lldb-dap/JSONUtils.cpp | 9 + 1 file changed, 9 insertions(+) diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 41ca29a405ac9..7abd9618cc71f 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -550,6 +550,15 @@ llvm::json::Value CreateStackFrame(DAP &dap, lldb::SBFrame &frame, if (frame.IsArtificial() || frame.IsHidden()) object.try_emplace("presentationHint", "subtle"); + lldb::SBModule module = frame.GetModule(); + if (module.IsValid()) { +std::string uuid = module.GetUUIDString(); +if (!uuid.empty()) + object.try_emplace("moduleId", uuid); +else + object.try_emplace("moduleId", module.GetFileSpec().GetFilename()); + } + return llvm::json::Value(std::move(object)); } >From 3c47de26e1e680e7d14727b6068da99963c21b2e Mon Sep 17 00:00:00 2001 From: woruyu <1214539...@qq.com> Date: Mon, 21 Jul 2025 17:09:08 +0800 Subject: [PATCH 2/2] fix: ci test for moduleId --- lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py index db43dbaf515cf..2743fca58e81d 100644 --- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py +++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py @@ -26,6 +26,7 @@ def test_core_file(self): "column": 0, "id": 524288, "line": 4, +"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "bar", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x40011C", @@ -34,6 +35,7 @@ def test_core_file(self): "column": 0, "id": 524289, "line": 10, +"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "foo", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x400142", @@ -42,6 +44,7 @@ def test_core_file(self): "column": 0, "id": 524290, "line": 16, +"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "_start", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x40015F", ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] support moduleId in the stackTrace response (PR #149774)
https://github.com/woruyu updated https://github.com/llvm/llvm-project/pull/149774 >From 33c94346ac2b96d9f68fd1b8d62aebfa7b273499 Mon Sep 17 00:00:00 2001 From: woruyu <1214539...@qq.com> Date: Mon, 21 Jul 2025 15:52:50 +0800 Subject: [PATCH 1/2] [lldb-dap] support moduleId in the stackTrace response --- lldb/tools/lldb-dap/JSONUtils.cpp | 9 + 1 file changed, 9 insertions(+) diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 41ca29a405ac9..7abd9618cc71f 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -550,6 +550,15 @@ llvm::json::Value CreateStackFrame(DAP &dap, lldb::SBFrame &frame, if (frame.IsArtificial() || frame.IsHidden()) object.try_emplace("presentationHint", "subtle"); + lldb::SBModule module = frame.GetModule(); + if (module.IsValid()) { +std::string uuid = module.GetUUIDString(); +if (!uuid.empty()) + object.try_emplace("moduleId", uuid); +else + object.try_emplace("moduleId", module.GetFileSpec().GetFilename()); + } + return llvm::json::Value(std::move(object)); } >From 2d48be5dbf7b39df690395d42997ee51bad56dd5 Mon Sep 17 00:00:00 2001 From: woruyu <1214539...@qq.com> Date: Mon, 21 Jul 2025 17:07:09 +0800 Subject: [PATCH 2/2] fix: ci test --- .../lldb-dap/coreFile/TestDAP_coreFile.py | 43 ++- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py index db43dbaf515cf..d59e8c454b4b4 100644 --- a/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py +++ b/lldb/test/API/tools/lldb-dap/coreFile/TestDAP_coreFile.py @@ -26,6 +26,7 @@ def test_core_file(self): "column": 0, "id": 524288, "line": 4, +"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "bar", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x40011C", @@ -34,6 +35,7 @@ def test_core_file(self): "column": 0, "id": 524289, "line": 10, +"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "foo", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x400142", @@ -42,6 +44,7 @@ def test_core_file(self): "column": 0, "id": 524290, "line": 16, +"moduleId":"01DF54A6-045E-657D-3F8F-FB9CE1118789-14F8BD6D", "name": "_start", "source": {"name": "main.c", "path": "/home/labath/test/main.c"}, "instructionPointerReference": "0x40015F", @@ -58,30 +61,30 @@ def test_core_file(self): self.dap_server.request_next(threadId=32259) self.assertEqual(self.get_stackFrames(), expected_frames) -@skipIfLLVMTargetMissing("X86") -def test_core_file_source_mapping_array(self): -"""Test that sourceMap property is correctly applied when loading a core""" -current_dir = os.path.dirname(__file__) -exe_file = os.path.join(current_dir, "linux-x86_64.out") -core_file = os.path.join(current_dir, "linux-x86_64.core") +# @skipIfLLVMTargetMissing("X86") +# def test_core_file_source_mapping_array(self): +# """Test that sourceMap property is correctly applied when loading a core""" +# current_dir = os.path.dirname(__file__) +# exe_file = os.path.join(current_dir, "linux-x86_64.out") +# core_file = os.path.join(current_dir, "linux-x86_64.core") -self.create_debug_adapter() +# self.create_debug_adapter() -source_map = [["/home/labath/test", current_dir]] -self.attach(program=exe_file, coreFile=core_file, sourceMap=source_map) +# source_map = [["/home/labath/test", current_dir]] +# self.attach(program=exe_file, coreFile=core_file, sourceMap=source_map) -self.assertIn(current_dir, self.get_stackFrames()[0]["source"]["path"]) +# self.assertIn(current_dir, self.get_stackFrames()[0]["source"]["path"]) -@skipIfLLVMTargetMissing("X86") -def test_core_file_source_mapping_object(self): -"""Test that sourceMap property is correctly applied when loading a core""" -current_dir = os.path.dirname(__file__) -exe_file = os.path.join(current_dir, "linux-x86_64.out") -core_file = os.path.join(current_dir, "linux-x86_64.core") +# @skipIfLLVMTargetMissing("X86") +# def test_core_file_source_mapping_object(self): +# """Test that sourceMap property is correctly applied when loading a core""" +# current_dir = os.path.dirname(__file__) +# exe_file = os.path.join(current_dir, "linux-x86_64.out") +#
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::atomic (PR #149801)
@@ -1784,6 +1787,17 @@ static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { stl_summary_flags, MsvcStlStringSummaryProvider, "MSVC STL std::u32string summary provider")); + + stl_summary_flags.SetDontShowChildren(false); Michael137 wrote: What happens if you don't set this? I think we probably do want this to be `true`? Would that make `std::atomic` look like: ``` (std::atomic) val = 5 ``` ? (i.e., just not print the synthetic child?) I know that's not what libc++/libstdc++ does, but we probably should? https://github.com/llvm/llvm-project/pull/149801 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::atomic (PR #149801)
@@ -1784,6 +1787,17 @@ static void LoadMsvcStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { stl_summary_flags, MsvcStlStringSummaryProvider, "MSVC STL std::u32string summary provider")); + + stl_summary_flags.SetDontShowChildren(false); Michael137 wrote: Can be done separately since that's what libc++ and libstdc++ already do https://github.com/llvm/llvm-project/pull/149801 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libcxxabi] [lldb] [llvm] [DRAFT] [lldb][Expression] Add structor variant to LLDB's function call labels (PR #149827)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/149827 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/148877 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libcxxabi] [lldb] [llvm] [DRAFT] [lldb][Expression] Add structor variant to LLDB's function call labels (PR #149827)
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/149827 None >From fd6b6e8a3168fc233635e783773554ac980edb46 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 15 Nov 2024 01:59:36 + Subject: [PATCH 1/3] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels --- lldb/include/lldb/Core/Module.h | 4 +- lldb/include/lldb/Expression/Expression.h | 25 ++ lldb/include/lldb/Symbol/SymbolFile.h | 14 lldb/include/lldb/Symbol/TypeSystem.h | 16 lldb/source/Core/Module.cpp | 19 - lldb/source/Expression/Expression.cpp | 16 lldb/source/Expression/IRExecutionUnit.cpp| 74 + .../Clang/ClangExpressionDeclMap.cpp | 2 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 43 ++ .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 41 ++ .../SymbolFile/DWARF/SymbolFileDWARF.h| 3 + .../SymbolFile/NativePDB/PdbAstBuilder.cpp| 6 +- .../NativePDB/UdtRecordCompleter.cpp | 5 +- .../Plugins/SymbolFile/PDB/PDBASTParser.cpp | 7 +- .../TypeSystem/Clang/TypeSystemClang.cpp | 81 +-- .../TypeSystem/Clang/TypeSystemClang.h| 11 ++- lldb/unittests/Symbol/TestTypeSystemClang.cpp | 12 +-- 17 files changed, 335 insertions(+), 44 deletions(-) diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 8bb55c95773bc..3991a12997541 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -86,7 +86,8 @@ struct ModuleFunctionSearchOptions { /// /// The module will parse more detailed information as more queries are made. class Module : public std::enable_shared_from_this, - public SymbolContextScope { + public SymbolContextScope, + public UserID { public: class LookupInfo; // Static functions that can track the lifetime of module objects. This is @@ -97,6 +98,7 @@ class Module : public std::enable_shared_from_this, // using the "--global" (-g for short). static size_t GetNumberAllocatedModules(); + static Module *GetAllocatedModuleWithUID(lldb::user_id_t uid); static Module *GetAllocatedModuleAtIndex(size_t idx); static std::recursive_mutex &GetAllocationModuleCollectionMutex(); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 8de9364436ccf..f32878c9bf876 100644 --- a/lldb/include/lldb/Expression/Expression.h +++ b/lldb/include/lldb/Expression/Expression.h @@ -96,6 +96,31 @@ class Expression { ///invalid. }; +/// Holds parsed information about a function call label that +/// LLDB attaches as an AsmLabel to function AST nodes it parses +/// from debug-info. +/// +/// The format being: +/// +/// ::: +/// +/// The label string needs to stay valid for the entire lifetime +/// of this object. +struct FunctionCallLabel { + llvm::StringRef m_lookup_name; + lldb::user_id_t m_module_id; + + /// Mostly for debuggability. + lldb::user_id_t m_die_id; +}; + +/// LLDB attaches this prefix to mangled names of functions that it get called +/// from JITted expressions. +inline constexpr llvm::StringRef FunctionCallLabelPrefix = "$__lldb_func"; + +bool consumeFunctionCallLabelPrefix(llvm::StringRef &name); +bool hasFunctionCallLabelPrefix(llvm::StringRef name); + } // namespace lldb_private #endif // LLDB_EXPRESSION_EXPRESSION_H diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index e95f95553c17c..6aca276fc85b6 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -18,6 +18,7 @@ #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SourceModule.h" +#include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/TypeSystem.h" @@ -328,6 +329,19 @@ class SymbolFile : public PluginInterface { GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector &mangled_names); + /// Resolves the function DIE identified by \c lookup_name within + /// this SymbolFile. + /// + /// \param[in,out] sc_list The resolved functions will be appended to this + /// list. + /// + /// \param[in] lookup_name The UID of the function DIE to resolve. + /// + virtual llvm::Error FindAndResolveFunction(SymbolContextList &sc_list, + llvm::StringRef lookup_name) { +return llvm::createStringError("Not implemented"); + } + virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list) = 0; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index cb1f0130b548d..742c09251ea2f
[Lldb-commits] [lldb] [lldb-dap] support moduleId in the stackTrace response (PR #149774)
https://github.com/woruyu created https://github.com/llvm/llvm-project/pull/149774 ### Summary This PR resolves https://github.com/llvm/llvm-project/issues/149316 >From 33c94346ac2b96d9f68fd1b8d62aebfa7b273499 Mon Sep 17 00:00:00 2001 From: woruyu <1214539...@qq.com> Date: Mon, 21 Jul 2025 15:52:50 +0800 Subject: [PATCH] [lldb-dap] support moduleId in the stackTrace response --- lldb/tools/lldb-dap/JSONUtils.cpp | 9 + 1 file changed, 9 insertions(+) diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 41ca29a405ac9..7abd9618cc71f 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -550,6 +550,15 @@ llvm::json::Value CreateStackFrame(DAP &dap, lldb::SBFrame &frame, if (frame.IsArtificial() || frame.IsHidden()) object.try_emplace("presentationHint", "subtle"); + lldb::SBModule module = frame.GetModule(); + if (module.IsValid()) { +std::string uuid = module.GetUUIDString(); +if (!uuid.empty()) + object.try_emplace("moduleId", uuid); +else + object.try_emplace("moduleId", module.GetFileSpec().GetFilename()); + } + return llvm::json::Value(std::move(object)); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] support moduleId in the stackTrace response (PR #149774)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: woruyu (woruyu) Changes ### Summary This PR resolves https://github.com/llvm/llvm-project/issues/149316 --- Full diff: https://github.com/llvm/llvm-project/pull/149774.diff 1 Files Affected: - (modified) lldb/tools/lldb-dap/JSONUtils.cpp (+9) ``diff diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 41ca29a405ac9..7abd9618cc71f 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -550,6 +550,15 @@ llvm::json::Value CreateStackFrame(DAP &dap, lldb::SBFrame &frame, if (frame.IsArtificial() || frame.IsHidden()) object.try_emplace("presentationHint", "subtle"); + lldb::SBModule module = frame.GetModule(); + if (module.IsValid()) { +std::string uuid = module.GetUUIDString(); +if (!uuid.empty()) + object.try_emplace("moduleId", uuid); +else + object.try_emplace("moduleId", module.GetFileSpec().GetFilename()); + } + return llvm::json::Value(std::move(object)); } `` https://github.com/llvm/llvm-project/pull/149774 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] support moduleId in the stackTrace response (PR #149774)
woruyu wrote: @da-viper , I added `moduleId` to the `stackTrace` response where I think it fits, but I’m not very familiar with lldb-dap. Would appreciate feedback on whether this is the right place, and where a test should go—`DAPTests.cpp`, `ProtocolTypesTest.cpp`, or elsewhere? Also, is there a simple way to test this locally without a full frontend? https://github.com/llvm/llvm-project/pull/149774 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [DRAFT] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/148877 >From 019e83d2e589b0b90da2db1cc56bb567559db04b Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 15 Nov 2024 01:59:36 + Subject: [PATCH 1/2] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels --- lldb/include/lldb/Core/Module.h | 4 +- lldb/include/lldb/Expression/Expression.h | 25 ++ lldb/include/lldb/Symbol/SymbolFile.h | 14 lldb/include/lldb/Symbol/TypeSystem.h | 16 lldb/source/Core/Module.cpp | 19 - lldb/source/Expression/Expression.cpp | 16 lldb/source/Expression/IRExecutionUnit.cpp| 73 + .../Clang/ClangExpressionDeclMap.cpp | 2 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 43 ++ .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 37 + .../SymbolFile/DWARF/SymbolFileDWARF.h| 3 + .../SymbolFile/NativePDB/PdbAstBuilder.cpp| 6 +- .../NativePDB/UdtRecordCompleter.cpp | 5 +- .../Plugins/SymbolFile/PDB/PDBASTParser.cpp | 7 +- .../TypeSystem/Clang/TypeSystemClang.cpp | 81 +-- .../TypeSystem/Clang/TypeSystemClang.h| 11 ++- lldb/unittests/Symbol/TestTypeSystemClang.cpp | 12 +-- 17 files changed, 330 insertions(+), 44 deletions(-) diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 8bb55c95773bc..3991a12997541 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -86,7 +86,8 @@ struct ModuleFunctionSearchOptions { /// /// The module will parse more detailed information as more queries are made. class Module : public std::enable_shared_from_this, - public SymbolContextScope { + public SymbolContextScope, + public UserID { public: class LookupInfo; // Static functions that can track the lifetime of module objects. This is @@ -97,6 +98,7 @@ class Module : public std::enable_shared_from_this, // using the "--global" (-g for short). static size_t GetNumberAllocatedModules(); + static Module *GetAllocatedModuleWithUID(lldb::user_id_t uid); static Module *GetAllocatedModuleAtIndex(size_t idx); static std::recursive_mutex &GetAllocationModuleCollectionMutex(); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 8de9364436ccf..f32878c9bf876 100644 --- a/lldb/include/lldb/Expression/Expression.h +++ b/lldb/include/lldb/Expression/Expression.h @@ -96,6 +96,31 @@ class Expression { ///invalid. }; +/// Holds parsed information about a function call label that +/// LLDB attaches as an AsmLabel to function AST nodes it parses +/// from debug-info. +/// +/// The format being: +/// +/// ::: +/// +/// The label string needs to stay valid for the entire lifetime +/// of this object. +struct FunctionCallLabel { + llvm::StringRef m_lookup_name; + lldb::user_id_t m_module_id; + + /// Mostly for debuggability. + lldb::user_id_t m_die_id; +}; + +/// LLDB attaches this prefix to mangled names of functions that it get called +/// from JITted expressions. +inline constexpr llvm::StringRef FunctionCallLabelPrefix = "$__lldb_func"; + +bool consumeFunctionCallLabelPrefix(llvm::StringRef &name); +bool hasFunctionCallLabelPrefix(llvm::StringRef name); + } // namespace lldb_private #endif // LLDB_EXPRESSION_EXPRESSION_H diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index e95f95553c17c..a681147bb078d 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -18,6 +18,7 @@ #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SourceModule.h" +#include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/TypeSystem.h" @@ -328,6 +329,19 @@ class SymbolFile : public PluginInterface { GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector &mangled_names); + /// Resolves the function DIE identified by \c lookup_name within + /// this SymbolFile. + /// + /// \param[in,out] sc_list The resolved functions will be appended to this + /// list. + /// + /// \param[in] lookup_name The UID of the function DIE to resolve. + /// + virtual llvm::Error FindAndResolveFunction(SymbolContextList &sc_list, + llvm::StringRef lookup_name) { +return llvm::createStringError("Not implemented"); + } + virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list) = 0; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index cb1f0130b548d..742c09251ea2f 100644 ---
[Lldb-commits] [lldb] [DRAFT] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels (PR #148877)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/148877 >From bad568743a00fef16b8af90492cf12ab85b38175 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 15 Nov 2024 01:59:36 + Subject: [PATCH 1/2] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels --- lldb/include/lldb/Core/Module.h | 4 +- lldb/include/lldb/Expression/Expression.h | 25 ++ lldb/include/lldb/Symbol/SymbolFile.h | 14 lldb/include/lldb/Symbol/TypeSystem.h | 16 lldb/source/Core/Module.cpp | 19 - lldb/source/Expression/Expression.cpp | 16 lldb/source/Expression/IRExecutionUnit.cpp| 74 + .../Clang/ClangExpressionDeclMap.cpp | 2 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 43 ++ .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 43 ++ .../SymbolFile/DWARF/SymbolFileDWARF.h| 3 + .../SymbolFile/NativePDB/PdbAstBuilder.cpp| 6 +- .../NativePDB/UdtRecordCompleter.cpp | 5 +- .../Plugins/SymbolFile/PDB/PDBASTParser.cpp | 7 +- .../TypeSystem/Clang/TypeSystemClang.cpp | 81 +-- .../TypeSystem/Clang/TypeSystemClang.h| 11 ++- lldb/unittests/Symbol/TestTypeSystemClang.cpp | 12 +-- 17 files changed, 337 insertions(+), 44 deletions(-) diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 8bb55c95773bc..3991a12997541 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -86,7 +86,8 @@ struct ModuleFunctionSearchOptions { /// /// The module will parse more detailed information as more queries are made. class Module : public std::enable_shared_from_this, - public SymbolContextScope { + public SymbolContextScope, + public UserID { public: class LookupInfo; // Static functions that can track the lifetime of module objects. This is @@ -97,6 +98,7 @@ class Module : public std::enable_shared_from_this, // using the "--global" (-g for short). static size_t GetNumberAllocatedModules(); + static Module *GetAllocatedModuleWithUID(lldb::user_id_t uid); static Module *GetAllocatedModuleAtIndex(size_t idx); static std::recursive_mutex &GetAllocationModuleCollectionMutex(); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 8de9364436ccf..f32878c9bf876 100644 --- a/lldb/include/lldb/Expression/Expression.h +++ b/lldb/include/lldb/Expression/Expression.h @@ -96,6 +96,31 @@ class Expression { ///invalid. }; +/// Holds parsed information about a function call label that +/// LLDB attaches as an AsmLabel to function AST nodes it parses +/// from debug-info. +/// +/// The format being: +/// +/// ::: +/// +/// The label string needs to stay valid for the entire lifetime +/// of this object. +struct FunctionCallLabel { + llvm::StringRef m_lookup_name; + lldb::user_id_t m_module_id; + + /// Mostly for debuggability. + lldb::user_id_t m_die_id; +}; + +/// LLDB attaches this prefix to mangled names of functions that it get called +/// from JITted expressions. +inline constexpr llvm::StringRef FunctionCallLabelPrefix = "$__lldb_func"; + +bool consumeFunctionCallLabelPrefix(llvm::StringRef &name); +bool hasFunctionCallLabelPrefix(llvm::StringRef name); + } // namespace lldb_private #endif // LLDB_EXPRESSION_EXPRESSION_H diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index e95f95553c17c..6aca276fc85b6 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -18,6 +18,7 @@ #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SourceModule.h" +#include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/TypeSystem.h" @@ -328,6 +329,19 @@ class SymbolFile : public PluginInterface { GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector &mangled_names); + /// Resolves the function DIE identified by \c lookup_name within + /// this SymbolFile. + /// + /// \param[in,out] sc_list The resolved functions will be appended to this + /// list. + /// + /// \param[in] lookup_name The UID of the function DIE to resolve. + /// + virtual llvm::Error FindAndResolveFunction(SymbolContextList &sc_list, + llvm::StringRef lookup_name) { +return llvm::createStringError("Not implemented"); + } + virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list) = 0; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index cb1f0130b548d..742c09251ea2f 100644
[Lldb-commits] [lldb] [RISCV-LLDB] RISCV feature attribute support and allows overriding additional(default) feature (PR #147990)
santhoshe447 wrote: Kindly share any inputs or suggestion, if any. https://github.com/llvm/llvm-project/pull/147990 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Process minidump is in memory check command (PR #149401)
https://github.com/Jlalond edited https://github.com/llvm/llvm-project/pull/149401 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libcxx] [lldb] [llvm] [mlir] [docs] Add clang/llvm release notes for mipsel-windows-* targets (PR #147133)
hpoussin wrote: Rebased about branch `origin/release/21.x`, but I'm not sure it is enough. https://github.com/llvm/llvm-project/pull/147133 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libcxxabi] [lldb] [llvm] [DRAFT] [lldb][Expression] Add structor variant to LLDB's function call labels (PR #149827)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/149827 >From fd6b6e8a3168fc233635e783773554ac980edb46 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 15 Nov 2024 01:59:36 + Subject: [PATCH 1/5] [lldb][Expression] Encode Module and DIE UIDs into function AsmLabels --- lldb/include/lldb/Core/Module.h | 4 +- lldb/include/lldb/Expression/Expression.h | 25 ++ lldb/include/lldb/Symbol/SymbolFile.h | 14 lldb/include/lldb/Symbol/TypeSystem.h | 16 lldb/source/Core/Module.cpp | 19 - lldb/source/Expression/Expression.cpp | 16 lldb/source/Expression/IRExecutionUnit.cpp| 74 + .../Clang/ClangExpressionDeclMap.cpp | 2 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 43 ++ .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 41 ++ .../SymbolFile/DWARF/SymbolFileDWARF.h| 3 + .../SymbolFile/NativePDB/PdbAstBuilder.cpp| 6 +- .../NativePDB/UdtRecordCompleter.cpp | 5 +- .../Plugins/SymbolFile/PDB/PDBASTParser.cpp | 7 +- .../TypeSystem/Clang/TypeSystemClang.cpp | 81 +-- .../TypeSystem/Clang/TypeSystemClang.h| 11 ++- lldb/unittests/Symbol/TestTypeSystemClang.cpp | 12 +-- 17 files changed, 335 insertions(+), 44 deletions(-) diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 8bb55c95773bc..3991a12997541 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -86,7 +86,8 @@ struct ModuleFunctionSearchOptions { /// /// The module will parse more detailed information as more queries are made. class Module : public std::enable_shared_from_this, - public SymbolContextScope { + public SymbolContextScope, + public UserID { public: class LookupInfo; // Static functions that can track the lifetime of module objects. This is @@ -97,6 +98,7 @@ class Module : public std::enable_shared_from_this, // using the "--global" (-g for short). static size_t GetNumberAllocatedModules(); + static Module *GetAllocatedModuleWithUID(lldb::user_id_t uid); static Module *GetAllocatedModuleAtIndex(size_t idx); static std::recursive_mutex &GetAllocationModuleCollectionMutex(); diff --git a/lldb/include/lldb/Expression/Expression.h b/lldb/include/lldb/Expression/Expression.h index 8de9364436ccf..f32878c9bf876 100644 --- a/lldb/include/lldb/Expression/Expression.h +++ b/lldb/include/lldb/Expression/Expression.h @@ -96,6 +96,31 @@ class Expression { ///invalid. }; +/// Holds parsed information about a function call label that +/// LLDB attaches as an AsmLabel to function AST nodes it parses +/// from debug-info. +/// +/// The format being: +/// +/// ::: +/// +/// The label string needs to stay valid for the entire lifetime +/// of this object. +struct FunctionCallLabel { + llvm::StringRef m_lookup_name; + lldb::user_id_t m_module_id; + + /// Mostly for debuggability. + lldb::user_id_t m_die_id; +}; + +/// LLDB attaches this prefix to mangled names of functions that it get called +/// from JITted expressions. +inline constexpr llvm::StringRef FunctionCallLabelPrefix = "$__lldb_func"; + +bool consumeFunctionCallLabelPrefix(llvm::StringRef &name); +bool hasFunctionCallLabelPrefix(llvm::StringRef name); + } // namespace lldb_private #endif // LLDB_EXPRESSION_EXPRESSION_H diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index e95f95553c17c..6aca276fc85b6 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -18,6 +18,7 @@ #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SourceModule.h" +#include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/TypeSystem.h" @@ -328,6 +329,19 @@ class SymbolFile : public PluginInterface { GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector &mangled_names); + /// Resolves the function DIE identified by \c lookup_name within + /// this SymbolFile. + /// + /// \param[in,out] sc_list The resolved functions will be appended to this + /// list. + /// + /// \param[in] lookup_name The UID of the function DIE to resolve. + /// + virtual llvm::Error FindAndResolveFunction(SymbolContextList &sc_list, + llvm::StringRef lookup_name) { +return llvm::createStringError("Not implemented"); + } + virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list) = 0; diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index cb1f0130b548d..742c09251ea2f 100644
[Lldb-commits] [lldb] [LLDB] Update SBMemoryRegionInfo doc strings to document len and str (PR #149903)
https://github.com/barsolo2000 updated https://github.com/llvm/llvm-project/pull/149903 >From e9fdc0a001823db1df26158845301aec94cd2b8a Mon Sep 17 00:00:00 2001 From: Bar Soloveychik Date: Mon, 21 Jul 2025 13:29:58 -0700 Subject: [PATCH 1/7] added documenatation on GetDescription --- .../interface/SBMemoryRegionInfoDocstrings.i | 52 --- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i index d7c68baf100e2..dd578f53c828c 100644 --- a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i +++ b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i @@ -1,31 +1,43 @@ -%feature("docstring", -"API clients can get information about memory regions in processes." -) lldb::SBMemoryRegionInfo; +% feature("docstring", + "API clients can get information about memory regions in processes.") +lldb::SBMemoryRegionInfo; %feature("docstring", " Returns whether this memory region has a list of modified (dirty) pages available or not. When calling GetNumDirtyPages(), you will -have 0 returned for both \"dirty page list is not known\" and +have 0 returned for both \"dirty page list is not known\" and \"empty dirty page list\" (that is, no modified pages in this memory region). You must use this method to disambiguate." ) lldb::SBMemoryRegionInfo::HasDirtyMemoryPageList; -%feature("docstring", " -Return the number of dirty (modified) memory pages in this -memory region, if available. You must use the -SBMemoryRegionInfo::HasDirtyMemoryPageList() method to -determine if a dirty memory list is available; it will depend -on the target system can provide this information." -) lldb::SBMemoryRegionInfo::GetNumDirtyPages; +% feature( + "docstring", + " + Return the number of dirty(modified) memory pages in this memory region, + if available.You must use the SBMemoryRegionInfo::HasDirtyMemoryPageList() + method to determine if a dirty memory list is available; + it will depend on the target system can provide this information." + ) lldb::SBMemoryRegionInfo::GetNumDirtyPages; -%feature("docstring", " -Return the address of a modified, or dirty, page of memory. -If the provided index is out of range, or this memory region -does not have dirty page information, LLDB_INVALID_ADDRESS -is returned." -) lldb::SBMemoryRegionInfo::GetDirtyPageAddressAtIndex; +% feature("docstring", + " + Return the address of a modified, + or dirty, page of memory.If the provided index is out of range, + or this memory region does not have dirty page information, + LLDB_INVALID_ADDRESS is returned." + ) lldb::SBMemoryRegionInfo::GetDirtyPageAddressAtIndex; + +% feature("docstring", " + Return the size of pages in this memory region .0 will be + returned if this information was unavailable." + ) lldb::SBMemoryRegionInfo::GetPageSize(); %feature("docstring", " -Return the size of pages in this memory region. 0 will be returned -if this information was unavailable." -) lldb::SBMemoryRegionInfo::GetPageSize(); +takes a SBStream parameter 'description' where it will write the output to. +it formats the memory region information into a string with Memory region info +[Hex start - Hex End) and premission flags R/W/X +returns a boolean value indicating success or failure + +alternative to using this method to find out the size of the memory region +is to use the len() function on the SBMemoryRegionInfo object" +) lldb::SBMemoryRegionInfo::GetDescription; >From 17f46d31903ab451a5944d4097ae1ef62bd631cc Mon Sep 17 00:00:00 2001 From: Bar Soloveychik Date: Mon, 21 Jul 2025 14:08:01 -0700 Subject: [PATCH 2/7] added doc on str/len overwritten functions --- .../interface/SBMemoryRegionInfoDocstrings.i | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i index dd578f53c828c..6b7f4a32ed17e 100644 --- a/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i +++ b/lldb/bindings/interface/SBMemoryRegionInfoDocstrings.i @@ -1,5 +1,8 @@ % feature("docstring", - "API clients can get information about memory regions in processes.") + "API clients can get information about memory regions in processes. + + When printed using str(), the memory region info is formatted as: +'[Hex start - Hex End] RWX' ") lldb::SBMemoryRegionInfo; %feature("docstring", " @@ -34,10 +37,11 @@ %feature("docstring", " takes a SBStream parameter 'description' where it will