[Lldb-commits] [lldb] 9e90788 - [LLDB][NVIDIA] Add Disassembler log channel (#148290)
Author: Andrew Gontarek Date: 2025-07-11T13:49:34-07:00 New Revision: 9e90788a3ea776f6ba8baa2de30fb8845ac1916f URL: https://github.com/llvm/llvm-project/commit/9e90788a3ea776f6ba8baa2de30fb8845ac1916f DIFF: https://github.com/llvm/llvm-project/commit/9e90788a3ea776f6ba8baa2de30fb8845ac1916f.diff LOG: [LLDB][NVIDIA] Add Disassembler log channel (#148290) This commit introduces a new log channel for the disassembler in LLDB, allowing for better logging of disassembler related activities. The `LLDBLOG` enum has been updated to include the `Disassembler` channel, and the relevant logging in the `DisassemblerLLVMC` plugin has been modified to utilize this new channel. This is in preparation for adding additional disassembler implementations. Key Changes: - Added `Disassembler` to the `LLDBLog` enum. - Updated logging in `DisassemblerLLVMC.cpp` to use the new `Disassembler` log channel. Added: Modified: lldb/include/lldb/Utility/LLDBLog.h lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp lldb/source/Utility/LLDBLog.cpp Removed: diff --git a/lldb/include/lldb/Utility/LLDBLog.h b/lldb/include/lldb/Utility/LLDBLog.h index c7de41e74e85b..18e4a3ca73507 100644 --- a/lldb/include/lldb/Utility/LLDBLog.h +++ b/lldb/include/lldb/Utility/LLDBLog.h @@ -49,7 +49,8 @@ enum class LLDBLog : Log::MaskType { Watchpoints = Log::ChannelFlag<30>, OnDemand = Log::ChannelFlag<31>, Source = Log::ChannelFlag<32>, - LLVM_MARK_AS_BITMASK_ENUM(OnDemand), + Disassembler = Log::ChannelFlag<33>, + LLVM_MARK_AS_BITMASK_ENUM(Disassembler), }; LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(); diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index ed6047f8f4ef3..644084ba8d57a 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -1146,7 +1146,7 @@ class InstructionLLVMC : public lldb_private::Instruction { } } -if (Log *log = GetLog(LLDBLog::Process)) { +if (Log *log = GetLog(LLDBLog::Process | LLDBLog::Disassembler)) { StreamString ss; ss.Printf("[%s] expands to %zu operands:\n", operands_string, diff --git a/lldb/source/Utility/LLDBLog.cpp b/lldb/source/Utility/LLDBLog.cpp index b193bd4eb07dc..613dae42064a8 100644 --- a/lldb/source/Utility/LLDBLog.cpp +++ b/lldb/source/Utility/LLDBLog.cpp @@ -64,6 +64,9 @@ static constexpr Log::Category g_categories[] = { {"log symbol on-demand related activities"}, LLDBLog::OnDemand}, {{"source"}, {"log source related activities"}, LLDBLog::Source}, +{{"disassembler"}, + {"log disassembler related activities"}, + LLDBLog::Disassembler}, }; static Log::Channel g_log_channel(g_categories, ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NVIDIA] Add Disassembler log channel (PR #148290)
https://github.com/clayborg closed https://github.com/llvm/llvm-project/pull/148290 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NVIDIA] Add Disassembler log channel (PR #148290)
github-actions[bot] wrote: @agontarek Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail [here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr). If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of [LLVM development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy). You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! https://github.com/llvm/llvm-project/pull/148290 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NVIDIA] Add Disassembler log channel (PR #148290)
https://github.com/agontarek updated https://github.com/llvm/llvm-project/pull/148290 >From a5e8c92d9f07f6465ddf1d71ed92b0394f6e4804 Mon Sep 17 00:00:00 2001 From: Andrew Gontarek Date: Fri, 11 Jul 2025 13:17:56 -0700 Subject: [PATCH 1/2] [LLDB][NVIDIA] Add Disassembler log channel This commit introduces a new log channel for the disassembler in LLDB, allowing for better logging of disassembler related activities. The `LLDBLOG` enum has been updated to include the `Disassembler` channel, and the relevant logging in the `DisassemblerLLVMC` plugin has been modified to utilize this new channel. This is in preparation for adding additional disassembler implementations. Key Changes: - Added `Disassembler` to the `LLDBLog` enum. - Updated logging in `DisassemblerLLVMC.cpp` to use the new `Disassembler` log channel. --- lldb/include/lldb/Utility/LLDBLog.h | 1 + lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp | 2 +- lldb/source/Utility/LLDBLog.cpp | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/include/lldb/Utility/LLDBLog.h b/lldb/include/lldb/Utility/LLDBLog.h index c7de41e74e85b..03190c27986a0 100644 --- a/lldb/include/lldb/Utility/LLDBLog.h +++ b/lldb/include/lldb/Utility/LLDBLog.h @@ -49,6 +49,7 @@ enum class LLDBLog : Log::MaskType { Watchpoints = Log::ChannelFlag<30>, OnDemand = Log::ChannelFlag<31>, Source = Log::ChannelFlag<32>, + Disassembler = Log::ChannelFlag<33>, LLVM_MARK_AS_BITMASK_ENUM(OnDemand), }; diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index ed6047f8f4ef3..c48736ca0dd3b 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -1146,7 +1146,7 @@ class InstructionLLVMC : public lldb_private::Instruction { } } -if (Log *log = GetLog(LLDBLog::Process)) { +if (Log *log = GetLog(LLDBLog::Disassembler)) { StreamString ss; ss.Printf("[%s] expands to %zu operands:\n", operands_string, diff --git a/lldb/source/Utility/LLDBLog.cpp b/lldb/source/Utility/LLDBLog.cpp index b193bd4eb07dc..613dae42064a8 100644 --- a/lldb/source/Utility/LLDBLog.cpp +++ b/lldb/source/Utility/LLDBLog.cpp @@ -64,6 +64,9 @@ static constexpr Log::Category g_categories[] = { {"log symbol on-demand related activities"}, LLDBLog::OnDemand}, {{"source"}, {"log source related activities"}, LLDBLog::Source}, +{{"disassembler"}, + {"log disassembler related activities"}, + LLDBLog::Disassembler}, }; static Log::Channel g_log_channel(g_categories, >From a3c61034ee8962dc85a0e16cacd4163259aff8cf Mon Sep 17 00:00:00 2001 From: Andrew Gontarek Date: Fri, 11 Jul 2025 13:40:10 -0700 Subject: [PATCH 2/2] [LLDB][NVIDIA] Update for review comments --- lldb/include/lldb/Utility/LLDBLog.h | 2 +- lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lldb/include/lldb/Utility/LLDBLog.h b/lldb/include/lldb/Utility/LLDBLog.h index 03190c27986a0..18e4a3ca73507 100644 --- a/lldb/include/lldb/Utility/LLDBLog.h +++ b/lldb/include/lldb/Utility/LLDBLog.h @@ -50,7 +50,7 @@ enum class LLDBLog : Log::MaskType { OnDemand = Log::ChannelFlag<31>, Source = Log::ChannelFlag<32>, Disassembler = Log::ChannelFlag<33>, - LLVM_MARK_AS_BITMASK_ENUM(OnDemand), + LLVM_MARK_AS_BITMASK_ENUM(Disassembler), }; LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(); diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index c48736ca0dd3b..644084ba8d57a 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -1146,7 +1146,7 @@ class InstructionLLVMC : public lldb_private::Instruction { } } -if (Log *log = GetLog(LLDBLog::Disassembler)) { +if (Log *log = GetLog(LLDBLog::Process | LLDBLog::Disassembler)) { StreamString ss; ss.Printf("[%s] expands to %zu operands:\n", operands_string, ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NVIDIA] Add Disassembler log channel (PR #148290)
https://github.com/JDevlieghere approved this pull request. https://github.com/llvm/llvm-project/pull/148290 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NVIDIA] Add Disassembler log channel (PR #148290)
https://github.com/clayborg approved this pull request. https://github.com/llvm/llvm-project/pull/148290 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [mlir] Fix typos 'seperate' -> 'separate' (NFC) (PR #144368)
https://github.com/GameRoMan edited https://github.com/llvm/llvm-project/pull/144368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxx] [lldb] [libcxx] adds size-based `__split_buffer` representation to unstable ABI (PR #139632)
@@ -184,67 +172,299 @@ public: _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(__split_buffer& __x) _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<__alloc_rr>); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const; + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const { +if (__data_.first() == nullptr) { + if (__data_.begin() != nullptr) +return false; + + if (!__data_.empty()) +return false; + + if (__data_.capacity() != 0) +return false; + + return true; +} else { + if (__data_.begin() < __data_.first()) +return false; + + if (__data_.capacity() < __data_.size()) +return false; + + if (__data_.end() < __data_.begin()) +return false; + + return true; +} + } private: _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__split_buffer& __c, true_type) _NOEXCEPT_(is_nothrow_move_assignable::value) { -__alloc_ = std::move(__c.__alloc_); +__data_.__alloc_ = std::move(__c.__data_.__alloc_); } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT {} struct _ConstructTransaction { _LIBCPP_CONSTEXPR_SINCE_CXX20 -_LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(pointer* __p, size_type __n) _NOEXCEPT -: __pos_(*__p), - __end_(*__p + __n), - __dest_(__p) {} +_LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(__split_buffer* __parent, pointer __p, size_type __n) _NOEXCEPT +: __pos_(__p), + __end_(__p + __n), + __parent_(__parent) {} -_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { *__dest_ = __pos_; } +_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { + __parent_->__data_.__update_sentinel(__pos_); +} pointer __pos_; const pointer __end_; private: -pointer* __dest_; +__split_buffer* __parent_; }; }; +#ifdef _LIBCPP_ABI_SIZE_BASED_VECTOR +template +struct __split_buffer<_Tp, _Allocator>::__layout { + // private: + pointer __first_ = nullptr; + pointer __begin_ = nullptr; + size_type __size_ = 0; + size_type __cap_ = 0; + _LIBCPP_NO_UNIQUE_ADDRESS allocator_type __alloc_; + +public: + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __layout() = default; + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __layout(const allocator_type& __alloc) + : __alloc_(__alloc) {} + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer first() _NOEXCEPT; + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_pointer first() const _NOEXCEPT; + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer begin() _NOEXCEPT; + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_pointer begin() const _NOEXCEPT; + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer end() _NOEXCEPT { return __begin_ + __size_; } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer end() const _NOEXCEPT { return __begin_ + __size_; } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __size_; } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __size_ == 0; } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const _NOEXCEPT { return __cap_; } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __update_first(pointer __new_first) _NOEXCEPT; + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __update_begin(pointer __new_begin) _NOEXCEPT { +// Size-based __split_buffers track their size directly: we need to explicitly update the size +// when the front is adjusted. +__size_ -= __new_begin - __begin_; +__begin_ = __new_begin; + } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __front_spare() const _NOEXCEPT; + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __update_sentinel(pointer __new_end) _NOEXCEPT { +_LIBCPP_ASSERT_INTERNAL(__first_ <= __new_end, "__new_end cannot precede __first_"); +__size_ += __new_end - end(); + } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __update_sentinel(size_type __new_size) _NOEXCEPT { +__size_ = __new_size; + } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __update_capacity(size_type __new_capacity) _NOEXCEPT { +__cap_ = __new_capacity; + } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __back_spare() const _NOEXCEPT { +// `__cap_ - __end_` tells us the total number of spares when in size-mode. We need to remove +// the __front_spare from the count. +return __cap_ - __size_ - __front_spare(); + } + + _LIBCPP_CONST
[Lldb-commits] [libcxx] [lldb] [libcxx] adds size-based `__split_buffer` representation to unstable ABI (PR #139632)
cjdb wrote: Done. https://github.com/llvm/llvm-project/pull/139632 ___ 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::unique_ptr (PR #148248)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: nerix (Nerixyz) Changes This PR adds a summary and synthetic children for `std::unique_ptr` from MSVC's STL ([NatVis](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/debugger/STL.natvis#L285-L303)). As with libc++, the deleter is only shown if it's non-empty. Tested both the shared_ptr and unique_ptr tests on Windows. Towards #24834. --- Full diff: https://github.com/llvm/llvm-project/pull/148248.diff 4 Files Affected: - (modified) lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp (+27-4) - (modified) lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h (+8) - (modified) lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp (+115) - (modified) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unique_ptr/TestDataFormatterStdUniquePtr.py (+11) ``diff diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 2db3e6f0ca315..9a869f3ea0289 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1566,10 +1566,6 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { "std::optional synthetic child", "^std::optional<.+>(( )?&)?$", stl_deref_flags, true); - AddCXXSummary(cpp_category_sp, - lldb_private::formatters::LibStdcppUniquePointerSummaryProvider, -"libstdc++ std::unique_ptr summary provider", -"^std::unique_ptr<.+>(( )?&)?$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::StdlibCoroutineHandleSummaryProvider, "libstdc++ std::coroutine_handle summary provider", @@ -1599,6 +1595,24 @@ GenericSmartPointerSummaryProvider(ValueObject &valobj, Stream &stream, return LibStdcppSmartPointerSummaryProvider(valobj, stream, options); } +static lldb_private::SyntheticChildrenFrontEnd * +GenericUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren *children, + lldb::ValueObjectSP valobj_sp) { + if (!valobj_sp) +return nullptr; + + if (IsMsvcStlUniquePtr(*valobj_sp)) +return MsvcStlUniquePtrSyntheticFrontEndCreator(valobj_sp); + return LibStdcppUniquePtrSyntheticFrontEndCreator(children, valobj_sp); +} + +static bool GenericUniquePtrSummaryProvider(ValueObject &valobj, Stream &stream, +const TypeSummaryOptions &options) { + if (IsMsvcStlUniquePtr(valobj)) +return MsvcStlUniquePtrSummaryProvider(valobj, stream, options); + return LibStdcppUniquePointerSummaryProvider(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) @@ -1642,12 +1656,18 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { }, "MSVC STL/libstdc++ std::wstring summary provider")); + stl_summary_flags.SetDontShowChildren(false); + stl_summary_flags.SetSkipPointers(false); + AddCXXSynthetic(cpp_category_sp, GenericSmartPointerSyntheticFrontEndCreator, "std::shared_ptr synthetic children", "^std::shared_ptr<.+>(( )?&)?$", stl_synth_flags, true); AddCXXSynthetic(cpp_category_sp, GenericSmartPointerSyntheticFrontEndCreator, "std::weak_ptr synthetic children", "^std::weak_ptr<.+>(( )?&)?$", stl_synth_flags, true); + AddCXXSynthetic(cpp_category_sp, GenericUniquePtrSyntheticFrontEndCreator, + "std::unique_ptr synthetic children", + "^std::unique_ptr<.+>(( )?&)?$", stl_synth_flags, true); AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider, "MSVC STL/libstdc++ std::shared_ptr summary provider", @@ -1655,6 +1675,9 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider, "MSVC STL/libstdc++ std::weak_ptr summary provider", "^std::weak_ptr<.+>(( )?&)?$", stl_summary_flags, true); + AddCXXSummary(cpp_category_sp, GenericUniquePtrSummaryProvider, +"MSVC STL/libstdc++ std::unique_ptr summary provider", +"^std::unique_ptr<.+>(( )?&)?$", 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 edf3f4e8a5387..fe75bf275f8e2 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h @@ -37,6 +37,14 @@ bool MsvcStlSmartPointerSummaryPro
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::unique_ptr (PR #148248)
https://github.com/Nerixyz edited https://github.com/llvm/llvm-project/pull/148248 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [Clang][AST][NFC] (`RecordDecl` -> `CXXRecordDecl`)`::isInjectedClassName` (PR #148195)
zwuis wrote: > > I'm not sure if I should update > > `llvm/include/llvm/Testing/Demangle/DemangleTestCases.inc` and > > `libcxxabi/test/DemangleTestCases.inc`. > > Why would you need to? There are no changes to mangling/demangling here AFAICT These files test demangling `RecordDecl::isInjectedClassName`, which will be out-of-date (I think) after merging this PR. https://github.com/llvm/llvm-project/pull/148195 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose debuggers and target as resources through MCP (PR #148075)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/148075 >From 74cc4598eccdb43b3a36e3276d16de84a901f095 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 10 Jul 2025 15:51:44 -0700 Subject: [PATCH 1/3] [lldb] Expose debuggers and target as resources through MCP Expose debuggers and target as resources through MCP. This has two advantages: 1. Enables returning data in a structured way. Although tools can return structured data with the latest revision of the protocol, we might not be able to update before the majority of clients has adopted it. 2. Enables the user to specify a resource themselves, rather than letting the model guess which debugger instance it should use. This PR exposes a resource for debuggers and targets. The following URI returns information about a given debugger instance: ``` lldb://debugger/ ``` For example: ``` { uri: "lldb://debugger/0" mimeType: "application/json" text: "{"debugger_id":0,"num_targets":2}" } ``` The following URI returns information about a given target: ``` lldb://debugger//target/ ``` For example: ``` { uri: "lldb://debugger/0/target/0" mimeType: "application/json" text: "{"arch":"arm64-apple-macosx26.0.0","debugger_id":0,"path":"/Users/jonas/llvm/build-ra/bin/count","target_id":0}" } ``` --- .../Plugins/Protocol/MCP/CMakeLists.txt | 1 + lldb/source/Plugins/Protocol/MCP/MCPError.cpp | 11 ++ lldb/source/Plugins/Protocol/MCP/MCPError.h | 14 ++ lldb/source/Plugins/Protocol/MCP/Protocol.cpp | 54 +- lldb/source/Plugins/Protocol/MCP/Protocol.h | 60 ++- .../Protocol/MCP/ProtocolServerMCP.cpp| 82 - .../Plugins/Protocol/MCP/ProtocolServerMCP.h | 10 ++ lldb/source/Plugins/Protocol/MCP/Resource.cpp | 166 ++ lldb/source/Plugins/Protocol/MCP/Resource.h | 51 ++ lldb/source/Plugins/Protocol/MCP/Tool.cpp | 47 - lldb/source/Plugins/Protocol/MCP/Tool.h | 9 - .../Protocol/ProtocolMCPServerTest.cpp| 41 - lldb/unittests/Protocol/ProtocolMCPTest.cpp | 98 +++ 13 files changed, 581 insertions(+), 63 deletions(-) create mode 100644 lldb/source/Plugins/Protocol/MCP/Resource.cpp create mode 100644 lldb/source/Plugins/Protocol/MCP/Resource.h diff --git a/lldb/source/Plugins/Protocol/MCP/CMakeLists.txt b/lldb/source/Plugins/Protocol/MCP/CMakeLists.txt index db31a7a69cb33..e104fb527e57a 100644 --- a/lldb/source/Plugins/Protocol/MCP/CMakeLists.txt +++ b/lldb/source/Plugins/Protocol/MCP/CMakeLists.txt @@ -2,6 +2,7 @@ add_lldb_library(lldbPluginProtocolServerMCP PLUGIN MCPError.cpp Protocol.cpp ProtocolServerMCP.cpp + Resource.cpp Tool.cpp LINK_COMPONENTS diff --git a/lldb/source/Plugins/Protocol/MCP/MCPError.cpp b/lldb/source/Plugins/Protocol/MCP/MCPError.cpp index 5ed850066b659..659b53a14fe23 100644 --- a/lldb/source/Plugins/Protocol/MCP/MCPError.cpp +++ b/lldb/source/Plugins/Protocol/MCP/MCPError.cpp @@ -14,6 +14,7 @@ namespace lldb_private::mcp { char MCPError::ID; +char UnsupportedURI::ID; MCPError::MCPError(std::string message, int64_t error_code) : m_message(message), m_error_code(error_code) {} @@ -31,4 +32,14 @@ protocol::Error MCPError::toProtcolError() const { return error; } +UnsupportedURI::UnsupportedURI(std::string uri) : m_uri(uri) {} + +void UnsupportedURI::log(llvm::raw_ostream &OS) const { + OS << "unsupported uri: " << m_uri; +} + +std::error_code UnsupportedURI::convertToErrorCode() const { + return llvm::inconvertibleErrorCode(); +} + } // namespace lldb_private::mcp diff --git a/lldb/source/Plugins/Protocol/MCP/MCPError.h b/lldb/source/Plugins/Protocol/MCP/MCPError.h index 2a76a7b087e20..05a047ec881a9 100644 --- a/lldb/source/Plugins/Protocol/MCP/MCPError.h +++ b/lldb/source/Plugins/Protocol/MCP/MCPError.h @@ -8,6 +8,7 @@ #include "Protocol.h" #include "llvm/Support/Error.h" +#include "llvm/Support/FormatVariadic.h" #include namespace lldb_private::mcp { @@ -30,4 +31,17 @@ class MCPError : public llvm::ErrorInfo { int64_t m_error_code; }; +class UnsupportedURI : public llvm::ErrorInfo { +public: + static char ID; + + UnsupportedURI(std::string uri); + + void log(llvm::raw_ostream &OS) const override; + std::error_code convertToErrorCode() const override; + +private: + std::string m_uri; +}; + } // namespace lldb_private::mcp diff --git a/lldb/source/Plugins/Protocol/MCP/Protocol.cpp b/lldb/source/Plugins/Protocol/MCP/Protocol.cpp index d66c931a0b284..e42e1bf1118cf 100644 --- a/lldb/source/Plugins/Protocol/MCP/Protocol.cpp +++ b/lldb/source/Plugins/Protocol/MCP/Protocol.cpp @@ -107,8 +107,36 @@ bool fromJSON(const llvm::json::Value &V, ToolCapability &TC, return O && O.map("listChanged", TC.listChanged); } +llvm::json::Value toJSON(const ResourceCapability &RC) { + return llvm::json::Object{{"listChanged", RC.listChanged}, +{"subscribe", RC.subscribe}}; +} + +bool fro
[Lldb-commits] [lldb] [lldb] Expose debuggers and target as resources through MCP (PR #148075)
JDevlieghere wrote: I didn't because, unlike for the debugger, you can do `target select`. https://github.com/llvm/llvm-project/pull/148075 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NVIDIA] Add Disassembler log channel (PR #148290)
agontarek wrote: Tagging @clayborg @walter-erquinigo for review. https://github.com/llvm/llvm-project/pull/148290 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NVIDIA] Add Disassembler log channel (PR #148290)
https://github.com/agontarek created https://github.com/llvm/llvm-project/pull/148290 This commit introduces a new log channel for the disassembler in LLDB, allowing for better logging of disassembler related activities. The `LLDBLOG` enum has been updated to include the `Disassembler` channel, and the relevant logging in the `DisassemblerLLVMC` plugin has been modified to utilize this new channel. This is in preparation for adding additional disassembler implementations. Key Changes: - Added `Disassembler` to the `LLDBLog` enum. - Updated logging in `DisassemblerLLVMC.cpp` to use the new `Disassembler` log channel. >From a5e8c92d9f07f6465ddf1d71ed92b0394f6e4804 Mon Sep 17 00:00:00 2001 From: Andrew Gontarek Date: Fri, 11 Jul 2025 13:17:56 -0700 Subject: [PATCH] [LLDB][NVIDIA] Add Disassembler log channel This commit introduces a new log channel for the disassembler in LLDB, allowing for better logging of disassembler related activities. The `LLDBLOG` enum has been updated to include the `Disassembler` channel, and the relevant logging in the `DisassemblerLLVMC` plugin has been modified to utilize this new channel. This is in preparation for adding additional disassembler implementations. Key Changes: - Added `Disassembler` to the `LLDBLog` enum. - Updated logging in `DisassemblerLLVMC.cpp` to use the new `Disassembler` log channel. --- lldb/include/lldb/Utility/LLDBLog.h | 1 + lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp | 2 +- lldb/source/Utility/LLDBLog.cpp | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/include/lldb/Utility/LLDBLog.h b/lldb/include/lldb/Utility/LLDBLog.h index c7de41e74e85b..03190c27986a0 100644 --- a/lldb/include/lldb/Utility/LLDBLog.h +++ b/lldb/include/lldb/Utility/LLDBLog.h @@ -49,6 +49,7 @@ enum class LLDBLog : Log::MaskType { Watchpoints = Log::ChannelFlag<30>, OnDemand = Log::ChannelFlag<31>, Source = Log::ChannelFlag<32>, + Disassembler = Log::ChannelFlag<33>, LLVM_MARK_AS_BITMASK_ENUM(OnDemand), }; diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index ed6047f8f4ef3..c48736ca0dd3b 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -1146,7 +1146,7 @@ class InstructionLLVMC : public lldb_private::Instruction { } } -if (Log *log = GetLog(LLDBLog::Process)) { +if (Log *log = GetLog(LLDBLog::Disassembler)) { StreamString ss; ss.Printf("[%s] expands to %zu operands:\n", operands_string, diff --git a/lldb/source/Utility/LLDBLog.cpp b/lldb/source/Utility/LLDBLog.cpp index b193bd4eb07dc..613dae42064a8 100644 --- a/lldb/source/Utility/LLDBLog.cpp +++ b/lldb/source/Utility/LLDBLog.cpp @@ -64,6 +64,9 @@ static constexpr Log::Category g_categories[] = { {"log symbol on-demand related activities"}, LLDBLog::OnDemand}, {{"source"}, {"log source related activities"}, LLDBLog::Source}, +{{"disassembler"}, + {"log disassembler related activities"}, + LLDBLog::Disassembler}, }; static Log::Channel g_log_channel(g_categories, ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NVIDIA] Add Disassembler log channel (PR #148290)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Andrew Gontarek (agontarek) Changes This commit introduces a new log channel for the disassembler in LLDB, allowing for better logging of disassembler related activities. The `LLDBLOG` enum has been updated to include the `Disassembler` channel, and the relevant logging in the `DisassemblerLLVMC` plugin has been modified to utilize this new channel. This is in preparation for adding additional disassembler implementations. Key Changes: - Added `Disassembler` to the `LLDBLog` enum. - Updated logging in `DisassemblerLLVMC.cpp` to use the new `Disassembler` log channel. --- Full diff: https://github.com/llvm/llvm-project/pull/148290.diff 3 Files Affected: - (modified) lldb/include/lldb/Utility/LLDBLog.h (+1) - (modified) lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp (+1-1) - (modified) lldb/source/Utility/LLDBLog.cpp (+3) ``diff diff --git a/lldb/include/lldb/Utility/LLDBLog.h b/lldb/include/lldb/Utility/LLDBLog.h index c7de41e74e85b..03190c27986a0 100644 --- a/lldb/include/lldb/Utility/LLDBLog.h +++ b/lldb/include/lldb/Utility/LLDBLog.h @@ -49,6 +49,7 @@ enum class LLDBLog : Log::MaskType { Watchpoints = Log::ChannelFlag<30>, OnDemand = Log::ChannelFlag<31>, Source = Log::ChannelFlag<32>, + Disassembler = Log::ChannelFlag<33>, LLVM_MARK_AS_BITMASK_ENUM(OnDemand), }; diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index ed6047f8f4ef3..c48736ca0dd3b 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -1146,7 +1146,7 @@ class InstructionLLVMC : public lldb_private::Instruction { } } -if (Log *log = GetLog(LLDBLog::Process)) { +if (Log *log = GetLog(LLDBLog::Disassembler)) { StreamString ss; ss.Printf("[%s] expands to %zu operands:\n", operands_string, diff --git a/lldb/source/Utility/LLDBLog.cpp b/lldb/source/Utility/LLDBLog.cpp index b193bd4eb07dc..613dae42064a8 100644 --- a/lldb/source/Utility/LLDBLog.cpp +++ b/lldb/source/Utility/LLDBLog.cpp @@ -64,6 +64,9 @@ static constexpr Log::Category g_categories[] = { {"log symbol on-demand related activities"}, LLDBLog::OnDemand}, {{"source"}, {"log source related activities"}, LLDBLog::Source}, +{{"disassembler"}, + {"log disassembler related activities"}, + LLDBLog::Disassembler}, }; static Log::Channel g_log_channel(g_categories, `` https://github.com/llvm/llvm-project/pull/148290 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NVIDIA] Add Disassembler log channel (PR #148290)
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using `@` followed by their GitHub username. If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment โPingโ. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html). You can also ask questions in a comment on this PR, on the [LLVM Discord](https://discord.com/invite/xS7Z362) or on the [forums](https://discourse.llvm.org/). https://github.com/llvm/llvm-project/pull/148290 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NVIDIA] Add Disassembler log channel (PR #148290)
@@ -49,6 +49,7 @@ enum class LLDBLog : Log::MaskType { Watchpoints = Log::ChannelFlag<30>, OnDemand = Log::ChannelFlag<31>, Source = Log::ChannelFlag<32>, + Disassembler = Log::ChannelFlag<33>, LLVM_MARK_AS_BITMASK_ENUM(OnDemand), clayborg wrote: I think we need to update this with the last enum. Someone forgot to do it when they added the `Source` enum. So this line should be: ``` LLVM_MARK_AS_BITMASK_ENUM(Disassembler), ``` https://github.com/llvm/llvm-project/pull/148290 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NVIDIA] Add Disassembler log channel (PR #148290)
https://github.com/clayborg requested changes to this pull request. https://github.com/llvm/llvm-project/pull/148290 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NVIDIA] Add Disassembler log channel (PR #148290)
@@ -1146,7 +1146,7 @@ class InstructionLLVMC : public lldb_private::Instruction { } } -if (Log *log = GetLog(LLDBLog::Process)) { +if (Log *log = GetLog(LLDBLog::Disassembler)) { clayborg wrote: We do have the option to specify multiple flag bits: ``` if (Log *log = GetLog(LLDBLog::Process | LLDBLog::Disassembler)) { ``` We might want to add this to ensure that the logging behavior doesn't change. https://github.com/llvm/llvm-project/pull/148290 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Document the SBDebugger public interface (PR #147621)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/147621 >From 337a7e43efcab08061ca6a5a0bd05547d783c63c Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 11 Jul 2025 13:33:53 -0700 Subject: [PATCH] [lldb] Document the SBDebugger public interface Despite our best efforts, improved documentation of the public API remains a common request amongst its users. We have the Docstrings files in the bindings directory, but coverage and quality varies greatly by class. I've noticed that we a bunch of Doxygen comments throughout LLDB, but relatively few in the SB API, which might be explained by the aforementioned Docstrings files. With #147617, we can leverage the Doxygen documentation to automatically generate Pydoc documentation for the Python bindings using SWIG. Going forward, I'd like to invest in the Doxygen documentation for the public API. This PR is a first step in that direction. The Doxygen comments will benefit both C++ and Python clients. Additionally, the compiler (through the -Wdocumentation flag) can help catch quality and correctness issues. --- lldb/include/lldb/API/SBDebugger.h | 252 +++-- 1 file changed, 200 insertions(+), 52 deletions(-) diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 192fbee9c0c6d..f77b0c1d7f0ee 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -44,6 +44,7 @@ class LLDB_API SBInputReader { class LLDB_API SBDebugger { public: + /// Broadcast bit definitions for the SBDebugger. FLAGS_ANONYMOUS_ENUM() { eBroadcastBitProgress = lldb::DebuggerBroadcastBit::eBroadcastBitProgress, eBroadcastBitWarning = lldb::DebuggerBroadcastBit::eBroadcastBitWarning, @@ -55,16 +56,22 @@ class LLDB_API SBDebugger { eBroadcastBitExternalProgressCategory = lldb::DebuggerBroadcastBit::eBroadcastBitExternalProgressCategory, }; + + /// Default constructor creates an invalid SBDebugger instance. SBDebugger(); SBDebugger(const lldb::SBDebugger &rhs); ~SBDebugger(); + /// Get the broadcaster class name. static const char *GetBroadcasterClass(); + /// Check if a specific language is supported by LLDB. static bool SupportsLanguage(lldb::LanguageType language); + /// Get the broadcaster that allows subscribing to events from this + /// debugger. lldb::SBBroadcaster GetBroadcaster(); /// Get progress data from a SBEvent whose type is eBroadcastBitProgress. @@ -106,44 +113,80 @@ class LLDB_API SBDebugger { bool &is_debugger_specific); #endif + /// Get progress data from an event. static lldb::SBStructuredData GetProgressDataFromEvent(const lldb::SBEvent &event); + /// Get diagnostic information from an event. static lldb::SBStructuredData GetDiagnosticFromEvent(const lldb::SBEvent &event); + /// Assignment operator. lldb::SBDebugger &operator=(const lldb::SBDebugger &rhs); + /// Initialize LLDB and its subsystems. + /// + /// This function should be called before any other LLDB functions. It + /// initializes all required subsystems for proper LLDB functionality. static void Initialize(); + /// Initialize the LLDB debugger subsystem with error handling. + /// + /// Similar to Initialize(), but returns an error if initialization fails. static lldb::SBError InitializeWithErrorHandling(); + /// Configure LLDB to print a stack trace when it crashes. static void PrintStackTraceOnError(); + /// Configure LLDB to print diagnostic information when it crashes. static void PrintDiagnosticsOnError(); + /// Terminate LLDB and its subsystems. + /// + /// This should be called when LLDB is no longer needed. static void Terminate(); + /// Create a new debugger instance (deprecated). LLDB_DEPRECATED_FIXME("Use one of the other Create variants", "Create(bool)") static lldb::SBDebugger Create(); + /// Create a new debugger instance. + /// + /// If source_init_files is true, the debugger will source .lldbinit files + /// from the home directory and current directory. static lldb::SBDebugger Create(bool source_init_files); + /// Create a new debugger instance with a custom log handler and user data + /// passed to the log callback. + /// + /// If source_init_files is true, the debugger will source .lldbinit files + /// from the home directory and current directory. static lldb::SBDebugger Create(bool source_init_files, lldb::LogOutputCallback log_callback, void *baton); + /// Destroy a debugger instance. static void Destroy(lldb::SBDebugger &debugger); + /// Notify the debugger that system memory pressure has been detected. + /// + /// This can be used to free up memory resources by clearing caches. static void MemoryPressureDetected(); + /// Check if this is a valid SBDebugger object.
[Lldb-commits] [lldb] [lldb] Document the SBDebugger public interface (PR #147621)
JDevlieghere wrote: I think both are true. When using an IDE with LSP support, the doxygen comments can be quite helpful and they're easier to keep up to date compared to a separate design document. I've reduced the verbosity further and now almost all comments are a single line. https://github.com/llvm/llvm-project/pull/147621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] f1cee58 - [lldb][test] Combine libstdc++ and libc++ iterator tests into generic test (#147175)
Author: Michael Buch Date: 2025-07-11T09:35:16+01:00 New Revision: f1cee58789ef49cf0a7cc081e539190edf15b92a URL: https://github.com/llvm/llvm-project/commit/f1cee58789ef49cf0a7cc081e539190edf15b92a DIFF: https://github.com/llvm/llvm-project/commit/f1cee58789ef49cf0a7cc081e539190edf15b92a.diff LOG: [lldb][test] Combine libstdc++ and libc++ iterator tests into generic test (#147175) This combines the libc++ and libstdc++ test cases. The libstdcpp tests were a subset of the libc++ test, so this patch moves the libcxx test into generic and removes the libstdcpp test entirely. There are currently no formatters for libstdcpp std::unorderd_map::iterator. So I removed those test-cases. We already test them for libc++ in `libcxx/unordered_map-iterator`. And we test `std::unordered_map` in `generic/unorderd`. So these test-cases would be redundant. Split out from https://github.com/llvm/llvm-project/pull/146740 Added: lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/Makefile lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/TestDataFormatterStdIterator.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/main.cpp Modified: Removed: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/Makefile lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/Makefile similarity index 54% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/Makefile index 564cbada74e08..8b20bcb05 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/Makefile +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/Makefile @@ -1,6 +1,3 @@ CXX_SOURCES := main.cpp -USE_LIBCPP := 1 - -CXXFLAGS_EXTRAS := -O0 include Makefile.rules diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/TestDataFormatterStdIterator.py similarity index 69% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/TestDataFormatterStdIterator.py index c43ee46fb658a..373b1c9a2c8e8 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/TestDataFormatterStdIterator.py @@ -2,14 +2,13 @@ Test lldb data formatter subsystem. """ - import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil -class LibcxxIteratorDataFormatterTestCase(TestBase): +class StdIteratorDataFormatterTestCase(TestBase): def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -17,10 +16,8 @@ def setUp(self): self.line = line_number("main.cpp", "// Set break point at this line.") self.namespace = "std" -@add_test_categories(["libc++"]) -def test_with_run_command(self): -"""Test that libc++ iterators format properly.""" -self.build() +def do_test(self): +"""Test that iterators format properly.""" self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( @@ -69,18 +66,12 @@ def cleanup(): self.expect("frame variable svI", substrs=['item = "hello"']) self.expect("expr svI", substrs=['item = "hello"']) -self.expect("frame variable iiumI", substrs=["first = 61453", "second = 51966"]) -self.expect("expr iiumI", substrs=["first = 61453", "second = 51966"]) - -self.expect("frame variable siumI", substrs=['first = "hello"', "second = 137"]) -self.expect("expr siumI", substrs=['first = "hello"', "second = 137"]) - -self.expect("frame va
[Lldb-commits] [lldb] [lldb][test] Combine libstdc++ and libc++ iterator tests into generic test (PR #147175)
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/147175 ___ 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::shared_ptr (PR #147575)
https://github.com/Michael137 approved this pull request. thank you! https://github.com/llvm/llvm-project/pull/147575 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [Clang][AST][NFC] (`RecordDecl` -> `CXXRecordDecl`)`::isInjectedClassName` (PR #148195)
https://github.com/zwuis edited https://github.com/llvm/llvm-project/pull/148195 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Use non synthetic value for MSVC smart ptr check (PR #148176)
https://github.com/Nerixyz updated https://github.com/llvm/llvm-project/pull/148176 >From 0e6da6450866758c2b8a0bca7ecc5b43f4ade268 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Fri, 11 Jul 2025 11:51:51 +0200 Subject: [PATCH 1/2] [LLDB] Use non synthetic value for MSVC smart ptr check --- lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp index 4a51879863f17..b5a85ab5deb8b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp @@ -15,7 +15,8 @@ using namespace lldb; bool lldb_private::formatters::IsMsvcStlSmartPointer(ValueObject &valobj) { - return valobj.GetChildMemberWithName("_Ptr") != nullptr; + ValueObjectSP valobj_sp = valobj.GetNonSyntheticValue(); + return valobj_sp->GetChildMemberWithName("_Ptr") != nullptr; } bool lldb_private::formatters::MsvcStlSmartPointerSummaryProvider( >From 7bf41353db8fc3d1d02df602ca20a30edf53b860 Mon Sep 17 00:00:00 2001 From: nerix Date: Fri, 11 Jul 2025 12:32:41 +0200 Subject: [PATCH 2/2] fix: check if non-synthetic exists Co-authored-by: Michael Buch --- .../Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp index b5a85ab5deb8b..b1aecc4b6611a 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp @@ -15,8 +15,10 @@ using namespace lldb; bool lldb_private::formatters::IsMsvcStlSmartPointer(ValueObject &valobj) { - ValueObjectSP valobj_sp = valobj.GetNonSyntheticValue(); - return valobj_sp->GetChildMemberWithName("_Ptr") != nullptr; + if (auto valobj_sp = valobj.GetNonSyntheticValue()) +return valobj_sp->GetChildMemberWithName("_Ptr") != nullptr; + + return false; } bool lldb_private::formatters::MsvcStlSmartPointerSummaryProvider( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Use non synthetic value for MSVC smart ptr check (PR #148176)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: nerix (Nerixyz) Changes I forgot to use the non-synthetic value to check for the `_Ptr` member. Fixes the test failure from #147575. --- Full diff: https://github.com/llvm/llvm-project/pull/148176.diff 1 Files Affected: - (modified) lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp (+2-1) ``diff diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp index 4a51879863f17..b5a85ab5deb8b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp @@ -15,7 +15,8 @@ using namespace lldb; bool lldb_private::formatters::IsMsvcStlSmartPointer(ValueObject &valobj) { - return valobj.GetChildMemberWithName("_Ptr") != nullptr; + ValueObjectSP valobj_sp = valobj.GetNonSyntheticValue(); + return valobj_sp->GetChildMemberWithName("_Ptr") != nullptr; } bool lldb_private::formatters::MsvcStlSmartPointerSummaryProvider( `` https://github.com/llvm/llvm-project/pull/148176 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Use non synthetic value for MSVC smart ptr check (PR #148176)
Nerixyz wrote: @Michael137 Sorry for the failure, I only built LLDB before but didn't run the tests after fixing the suggestions ๐คฆ https://github.com/llvm/llvm-project/pull/148176 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Use non synthetic value for MSVC smart ptr check (PR #148176)
https://github.com/Nerixyz created https://github.com/llvm/llvm-project/pull/148176 I forgot to use the non-synthetic value to check for the `_Ptr` member. Fixes the test failure from #147575. >From 0e6da6450866758c2b8a0bca7ecc5b43f4ade268 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Fri, 11 Jul 2025 11:51:51 +0200 Subject: [PATCH] [LLDB] Use non synthetic value for MSVC smart ptr check --- lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp index 4a51879863f17..b5a85ab5deb8b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp @@ -15,7 +15,8 @@ using namespace lldb; bool lldb_private::formatters::IsMsvcStlSmartPointer(ValueObject &valobj) { - return valobj.GetChildMemberWithName("_Ptr") != nullptr; + ValueObjectSP valobj_sp = valobj.GetNonSyntheticValue(); + return valobj_sp->GetChildMemberWithName("_Ptr") != nullptr; } bool lldb_private::formatters::MsvcStlSmartPointerSummaryProvider( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Use non synthetic value for MSVC smart ptr check (PR #148176)
https://github.com/Michael137 approved this pull request. no worries! LGTM https://github.com/llvm/llvm-project/pull/148176 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Use non synthetic value for MSVC smart ptr check (PR #148176)
@@ -15,7 +15,8 @@ using namespace lldb; bool lldb_private::formatters::IsMsvcStlSmartPointer(ValueObject &valobj) { - return valobj.GetChildMemberWithName("_Ptr") != nullptr; + ValueObjectSP valobj_sp = valobj.GetNonSyntheticValue(); + return valobj_sp->GetChildMemberWithName("_Ptr") != nullptr; Michael137 wrote: ```suggestion if (auto valobj_sp = valobj.GetNonSyntheticValue()) return valobj_sp->GetChildMemberWithName("_Ptr") != nullptr; return false; ``` https://github.com/llvm/llvm-project/pull/148176 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 9098bff - [lldb-dap] Add external terminal support (#146950)
Author: Druzhkov Sergei Date: 2025-07-11T11:14:59+01:00 New Revision: 9098bffb0370273e67c76ab996eb4559dcc71f34 URL: https://github.com/llvm/llvm-project/commit/9098bffb0370273e67c76ab996eb4559dcc71f34 DIFF: https://github.com/llvm/llvm-project/commit/9098bffb0370273e67c76ab996eb4559dcc71f34.diff LOG: [lldb-dap] Add external terminal support (#146950) This patch deprecates the `runInTerminal` option in favour of `console` which allow the user the specify an integrated or external option. Added: lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_console.py Modified: lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py lldb/test/API/tools/lldb-dap/runInTerminal/TestDAP_runInTerminal.py lldb/tools/lldb-dap/Handler/LaunchRequestHandler.cpp lldb/tools/lldb-dap/Handler/RequestHandler.cpp lldb/tools/lldb-dap/JSONUtils.cpp lldb/tools/lldb-dap/JSONUtils.h lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp lldb/tools/lldb-dap/Protocol/ProtocolRequests.h lldb/tools/lldb-dap/README.md lldb/tools/lldb-dap/package.json Removed: lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 68f58bf1349a7..d9516670e3a89 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -908,7 +908,7 @@ def request_launch( disableASLR=False, disableSTDIO=False, shellExpandArguments=False, -runInTerminal=False, +console: Optional[str] = None, enableAutoVariableSummaries=False, displayExtendedBacktrace=False, enableSyntheticChildDebugging=False, @@ -958,8 +958,8 @@ def request_launch( args_dict["launchCommands"] = launchCommands if sourceMap: args_dict["sourceMap"] = sourceMap -if runInTerminal: -args_dict["runInTerminal"] = runInTerminal +if console: +args_dict["console"] = console if postRunCommands: args_dict["postRunCommands"] = postRunCommands if customFrameFormat: diff --git a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py index ae8142ae4f484..a611cc30c1897 100644 --- a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py +++ b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py @@ -44,22 +44,39 @@ def test_failing_launch_program(self): "'{0}' does not exist".format(program), response["body"]["error"]["format"] ) -def test_failing_launch_commands_and_run_in_terminal(self): +def test_failing_launch_commands_and_console(self): """ -Tests launching with an invalid program. +Tests launching with launch commands in an integrated terminal. """ program = self.getBuildArtifact("a.out") self.create_debug_adapter() response = self.launch( -program, launchCommands=["a b c"], runInTerminal=True, expectFailure=True +program, +launchCommands=["a b c"], +console="integratedTerminal", +expectFailure=True, ) self.assertFalse(response["success"]) self.assertTrue(self.get_dict_value(response, ["body", "error", "showUser"])) self.assertEqual( -"'launchCommands' and 'runInTerminal' are mutually exclusive", +"'launchCommands' and non-internal 'console' are mutually exclusive", self.get_dict_value(response, ["body", "error", "format"]), ) +def test_failing_console(self): +""" +Tests launching in console with an invalid terminal type. +""" +program = self.getBuildArtifact("a.out") +self.create_debug_adapter() +response = self.launch(program, console="invalid", expectFailure=True) +self.assertFalse(response["success"]) +self.assertTrue(self.get_dict_value(response, ["body", "error", "showUser"])) +self.assertRegex( +response["body"]["error"]["format"], +r"unexpected value, expected 'internalConsole\', 'integratedTerminal\' or 'externalTerminal\' at arguments.console", +) + @skipIfWindows def test_termination(self): """ diff --git a/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py b/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_console.py similarity index 92% rename from lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py rename to lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_console.py index 35810feb48366..67483798f2265 100644 --- a/
[Lldb-commits] [lldb] [lldb-dap] Add external terminal support (PR #146950)
https://github.com/da-viper closed https://github.com/llvm/llvm-project/pull/146950 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] persistent assembly breakpoints (PR #148061)
https://github.com/eronnen updated https://github.com/llvm/llvm-project/pull/148061 >From c9fc191e93381b90b67d72799bab1b9ea19b8c42 Mon Sep 17 00:00:00 2001 From: Ely Ronnen Date: Sat, 17 May 2025 23:49:10 +0200 Subject: [PATCH 01/19] [lldb-dap] Support persistent assembly breakpoints --- lldb/tools/lldb-dap/CMakeLists.txt| 3 +- .../Handler/SetBreakpointsRequestHandler.cpp | 1 - lldb/tools/lldb-dap/Protocol/DAPTypes.cpp | 39 ++ lldb/tools/lldb-dap/Protocol/DAPTypes.h | 54 +++ .../tools/lldb-dap/Protocol/ProtocolTypes.cpp | 5 +- lldb/tools/lldb-dap/Protocol/ProtocolTypes.h | 8 ++- 6 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 lldb/tools/lldb-dap/Protocol/DAPTypes.cpp create mode 100644 lldb/tools/lldb-dap/Protocol/DAPTypes.h diff --git a/lldb/tools/lldb-dap/CMakeLists.txt b/lldb/tools/lldb-dap/CMakeLists.txt index 4cddfb1bea1c2..5e0ad53b82f89 100644 --- a/lldb/tools/lldb-dap/CMakeLists.txt +++ b/lldb/tools/lldb-dap/CMakeLists.txt @@ -66,7 +66,8 @@ add_lldb_library(lldbDAP Handler/ThreadsRequestHandler.cpp Handler/VariablesRequestHandler.cpp Handler/WriteMemoryRequestHandler.cpp - + + Protocol/DAPTypes.cpp Protocol/ProtocolBase.cpp Protocol/ProtocolEvents.cpp Protocol/ProtocolTypes.cpp diff --git a/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp index 5d336af740c99..142351fd62179 100644 --- a/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp @@ -9,7 +9,6 @@ #include "DAP.h" #include "Protocol/ProtocolRequests.h" #include "RequestHandler.h" -#include namespace lldb_dap { diff --git a/lldb/tools/lldb-dap/Protocol/DAPTypes.cpp b/lldb/tools/lldb-dap/Protocol/DAPTypes.cpp new file mode 100644 index 0..7fc77a5de2202 --- /dev/null +++ b/lldb/tools/lldb-dap/Protocol/DAPTypes.cpp @@ -0,0 +1,39 @@ +#include "Protocol/DAPTypes.h" +// #include "llvm/Support/JSON.h" + +using namespace llvm; + +namespace lldb_dap::protocol { + +bool fromJSON(const llvm::json::Value &Params, AssemblyBreakpointData &ABD, + llvm::json::Path P) { + json::ObjectMapper O(Params, P); + return O && O.mapOptional("module", ABD.module) && + O.mapOptional("symbol_mangled_name", ABD.symbol_mangled_name) && + O.mapOptional("offset", ABD.offset); +} + +llvm::json::Value toJSON(const AssemblyBreakpointData &ABD) { + json::Object result{ + {"module", ABD.module}, + {"symbol_mangled_name", ABD.symbol_mangled_name}, + {"offset", ABD.offset}, + }; + + return result; +} + +bool fromJSON(const llvm::json::Value &Params, SourceLLDBData &SLD, + llvm::json::Path P) { + json::ObjectMapper O(Params, P); + return O && O.mapOptional("assembly_breakpoint", SLD.assembly_breakpoint); +} + +llvm::json::Value toJSON(const SourceLLDBData &SLD) { + json::Object result; + if (SLD.assembly_breakpoint) +result.insert({"assembly_breakpoint", SLD.assembly_breakpoint}); + return result; +} + +} // namespace lldb_dap::protocol \ No newline at end of file diff --git a/lldb/tools/lldb-dap/Protocol/DAPTypes.h b/lldb/tools/lldb-dap/Protocol/DAPTypes.h new file mode 100644 index 0..ff88deebc84bf --- /dev/null +++ b/lldb/tools/lldb-dap/Protocol/DAPTypes.h @@ -0,0 +1,54 @@ +//===-- ProtocolTypes.h ---===// +// +// 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 +// +//===--===// +// +// This file contains private DAP types used in the protocol. +// +// Each struct has a toJSON and fromJSON function, that converts between +// the struct and a JSON representation. (See JSON.h) +// +//===--===// + +#ifndef LLDB_TOOLS_LLDB_DAP_PROTOCOL_DAP_TYPES_H +#define LLDB_TOOLS_LLDB_DAP_PROTOCOL_DAP_TYPES_H + +#include "lldb/lldb-types.h" +#include "llvm/Support/JSON.h" +#include +#include + +namespace lldb_dap::protocol { + +/// Data used to help lldb-dap resolve assembly breakpoints across different +/// sessions. +struct AssemblyBreakpointData { + /// The source module path. + std::string module; + + /// The symbol unique name. + std::string symbol_mangled_name; + + /// The breakpoint offset from the symbol resolved address. + lldb::addr_t offset; +}; +bool fromJSON(const llvm::json::Value &, AssemblyBreakpointData &, + llvm::json::Path); +llvm::json::Value toJSON(const AssemblyBreakpointData &); + +/// Custom source data used by lldb-dap. +/// This data should help lldb-dap identify sources correctly across different +/// sessions. +struct SourceLLDBData { + /// Assembly bre
[Lldb-commits] [lldb] [LLDB] Use non synthetic value for MSVC smart ptr check (PR #148176)
https://github.com/Nerixyz updated https://github.com/llvm/llvm-project/pull/148176 >From 0e6da6450866758c2b8a0bca7ecc5b43f4ade268 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Fri, 11 Jul 2025 11:51:51 +0200 Subject: [PATCH 1/2] [LLDB] Use non synthetic value for MSVC smart ptr check --- lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp index 4a51879863f17..b5a85ab5deb8b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp @@ -15,7 +15,8 @@ using namespace lldb; bool lldb_private::formatters::IsMsvcStlSmartPointer(ValueObject &valobj) { - return valobj.GetChildMemberWithName("_Ptr") != nullptr; + ValueObjectSP valobj_sp = valobj.GetNonSyntheticValue(); + return valobj_sp->GetChildMemberWithName("_Ptr") != nullptr; } bool lldb_private::formatters::MsvcStlSmartPointerSummaryProvider( >From 1e03a7b12e89c1909939528039c7a7116c0a1eca Mon Sep 17 00:00:00 2001 From: nerix Date: Fri, 11 Jul 2025 12:32:41 +0200 Subject: [PATCH 2/2] fix: check if non-synthetic exists Co-authored-by: Michael Buch --- .../Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp index b5a85ab5deb8b..11eaaced65eac 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp @@ -15,8 +15,10 @@ using namespace lldb; bool lldb_private::formatters::IsMsvcStlSmartPointer(ValueObject &valobj) { - ValueObjectSP valobj_sp = valobj.GetNonSyntheticValue(); - return valobj_sp->GetChildMemberWithName("_Ptr") != nullptr; + if (auto valobj_sp = valobj.GetNonSyntheticValue()) +return valobj_sp->GetChildMemberWithName("_Ptr") != nullptr; + + return false; } bool lldb_private::formatters::MsvcStlSmartPointerSummaryProvider( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [Clang][AST][NFC] (`RecordDecl` -> `CXXRecordDecl`)`::isInjectedClassName` (PR #148195)
llvmbot wrote: @llvm/pr-subscribers-clang-tools-extra @llvm/pr-subscribers-clangd Author: Yanzuo Liu (zwuis) Changes Co-authored-by: Matheus Izvekov--- Full diff: https://github.com/llvm/llvm-project/pull/148195.diff 10 Files Affected: - (modified) clang-tools-extra/clangd/CodeComplete.cpp (+1-1) - (modified) clang-tools-extra/clangd/Quality.cpp (+1-1) - (modified) clang-tools-extra/clangd/SemanticHighlighting.cpp (+1-1) - (modified) clang/include/clang/AST/Decl.h (-15) - (modified) clang/include/clang/AST/DeclCXX.h (+16-2) - (modified) clang/lib/AST/Decl.cpp (-5) - (modified) clang/lib/AST/DeclCXX.cpp (+10) - (modified) clang/lib/Sema/SemaAccess.cpp (+2-1) - (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp (+1-1) - (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+4-1) ``diff diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp index 14679fea6ac8a..d5907e3143bf6 100644 --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -870,7 +870,7 @@ bool contextAllowsIndex(enum CodeCompletionContext::Kind K) { } static bool isInjectedClass(const NamedDecl &D) { - if (auto *R = dyn_cast_or_null(&D)) + if (auto *R = dyn_cast_or_null(&D)) if (R->isInjectedClassName()) return true; return false; diff --git a/clang-tools-extra/clangd/Quality.cpp b/clang-tools-extra/clangd/Quality.cpp index c1ab63fb22f61..3f630b05c654b 100644 --- a/clang-tools-extra/clangd/Quality.cpp +++ b/clang-tools-extra/clangd/Quality.cpp @@ -258,7 +258,7 @@ static SymbolRelevanceSignals::AccessibleScope computeScope(const NamedDecl *D) { // Injected "Foo" within the class "Foo" has file scope, not class scope. const DeclContext *DC = D->getDeclContext(); - if (auto *R = dyn_cast_or_null(D)) + if (auto *R = dyn_cast_or_null(D)) if (R->isInjectedClassName()) DC = DC->getParent(); // Class constructor should have the same scope as the class. diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp b/clang-tools-extra/clangd/SemanticHighlighting.cpp index dc574dcd11703..e6d5cf7053694 100644 --- a/clang-tools-extra/clangd/SemanticHighlighting.cpp +++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -597,7 +597,7 @@ class HighlightingsBuilder { std::optional scopeModifier(const NamedDecl *D) { const DeclContext *DC = D->getDeclContext(); // Injected "Foo" within the class "Foo" has file scope, not class scope. - if (auto *R = dyn_cast_or_null(D)) + if (auto *R = dyn_cast_or_null(D)) if (R->isInjectedClassName()) DC = DC->getParent(); // Lambda captures are considered function scope, not class scope. diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index de79a9df29a5b..3d7969cca83fd 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -4420,21 +4420,6 @@ class RecordDecl : public TagDecl { void reorderDecls(const SmallVectorImpl &Decls); - /// Determines whether this declaration represents the - /// injected class name. - /// - /// The injected class name in C++ is the name of the class that - /// appears inside the class itself. For example: - /// - /// \code - /// struct C { - /// // C is implicitly declared here as a synonym for the class name. - /// }; - /// - /// C::C c; // same as "C c;" - /// \endcode - bool isInjectedClassName() const; - /// Determine whether this record is a class describing a lambda /// function object. bool isLambda() const; diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index 05cddd024d7cf..77bc3cad72ed9 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -546,8 +546,7 @@ class CXXRecordDecl : public RecordDecl { } CXXRecordDecl *getMostRecentNonInjectedDecl() { -CXXRecordDecl *Recent = -static_cast(this)->getMostRecentDecl(); +CXXRecordDecl *Recent = getMostRecentDecl(); while (Recent->isInjectedClassName()) { // FIXME: Does injected class name need to be in the redeclarations chain? assert(Recent->getPreviousDecl()); @@ -1889,6 +1888,21 @@ class CXXRecordDecl : public RecordDecl { DL.IsGenericLambda = IsGeneric; } + /// Determines whether this declaration represents the + /// injected class name. + /// + /// The injected class name in C++ is the name of the class that + /// appears inside the class itself. For example: + /// + /// \code + /// struct C { + /// // C is implicitly declared here as a synonym for the class name. + /// }; + /// + /// C::C c; // same as "C c;" + /// \endcode + bool isInjectedClassName() const; + // Determine whether this type is an Interface Like type for // __interface inheritance purposes. bool isInterfaceLike() const; diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [Clang][AST][NFC] (`RecordDecl` -> `CXXRecordDecl`)`::isInjectedClassName` (PR #148195)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Yanzuo Liu (zwuis) Changes Co-authored-by: Matheus Izvekov--- Full diff: https://github.com/llvm/llvm-project/pull/148195.diff 10 Files Affected: - (modified) clang-tools-extra/clangd/CodeComplete.cpp (+1-1) - (modified) clang-tools-extra/clangd/Quality.cpp (+1-1) - (modified) clang-tools-extra/clangd/SemanticHighlighting.cpp (+1-1) - (modified) clang/include/clang/AST/Decl.h (-15) - (modified) clang/include/clang/AST/DeclCXX.h (+16-2) - (modified) clang/lib/AST/Decl.cpp (-5) - (modified) clang/lib/AST/DeclCXX.cpp (+10) - (modified) clang/lib/Sema/SemaAccess.cpp (+2-1) - (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp (+1-1) - (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+4-1) ``diff diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp index 14679fea6ac8a..d5907e3143bf6 100644 --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -870,7 +870,7 @@ bool contextAllowsIndex(enum CodeCompletionContext::Kind K) { } static bool isInjectedClass(const NamedDecl &D) { - if (auto *R = dyn_cast_or_null(&D)) + if (auto *R = dyn_cast_or_null(&D)) if (R->isInjectedClassName()) return true; return false; diff --git a/clang-tools-extra/clangd/Quality.cpp b/clang-tools-extra/clangd/Quality.cpp index c1ab63fb22f61..3f630b05c654b 100644 --- a/clang-tools-extra/clangd/Quality.cpp +++ b/clang-tools-extra/clangd/Quality.cpp @@ -258,7 +258,7 @@ static SymbolRelevanceSignals::AccessibleScope computeScope(const NamedDecl *D) { // Injected "Foo" within the class "Foo" has file scope, not class scope. const DeclContext *DC = D->getDeclContext(); - if (auto *R = dyn_cast_or_null(D)) + if (auto *R = dyn_cast_or_null(D)) if (R->isInjectedClassName()) DC = DC->getParent(); // Class constructor should have the same scope as the class. diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp b/clang-tools-extra/clangd/SemanticHighlighting.cpp index dc574dcd11703..e6d5cf7053694 100644 --- a/clang-tools-extra/clangd/SemanticHighlighting.cpp +++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -597,7 +597,7 @@ class HighlightingsBuilder { std::optional scopeModifier(const NamedDecl *D) { const DeclContext *DC = D->getDeclContext(); // Injected "Foo" within the class "Foo" has file scope, not class scope. - if (auto *R = dyn_cast_or_null(D)) + if (auto *R = dyn_cast_or_null(D)) if (R->isInjectedClassName()) DC = DC->getParent(); // Lambda captures are considered function scope, not class scope. diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index de79a9df29a5b..3d7969cca83fd 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -4420,21 +4420,6 @@ class RecordDecl : public TagDecl { void reorderDecls(const SmallVectorImpl &Decls); - /// Determines whether this declaration represents the - /// injected class name. - /// - /// The injected class name in C++ is the name of the class that - /// appears inside the class itself. For example: - /// - /// \code - /// struct C { - /// // C is implicitly declared here as a synonym for the class name. - /// }; - /// - /// C::C c; // same as "C c;" - /// \endcode - bool isInjectedClassName() const; - /// Determine whether this record is a class describing a lambda /// function object. bool isLambda() const; diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index 05cddd024d7cf..77bc3cad72ed9 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -546,8 +546,7 @@ class CXXRecordDecl : public RecordDecl { } CXXRecordDecl *getMostRecentNonInjectedDecl() { -CXXRecordDecl *Recent = -static_cast(this)->getMostRecentDecl(); +CXXRecordDecl *Recent = getMostRecentDecl(); while (Recent->isInjectedClassName()) { // FIXME: Does injected class name need to be in the redeclarations chain? assert(Recent->getPreviousDecl()); @@ -1889,6 +1888,21 @@ class CXXRecordDecl : public RecordDecl { DL.IsGenericLambda = IsGeneric; } + /// Determines whether this declaration represents the + /// injected class name. + /// + /// The injected class name in C++ is the name of the class that + /// appears inside the class itself. For example: + /// + /// \code + /// struct C { + /// // C is implicitly declared here as a synonym for the class name. + /// }; + /// + /// C::C c; // same as "C c;" + /// \endcode + bool isInjectedClassName() const; + // Determine whether this type is an Interface Like type for // __interface inheritance purposes. bool isInterfaceLike() const; diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 8855d0107daca..bd1b5950d30a6 100644 ---
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [Clang][AST][NFC] (`RecordDecl` -> `CXXRecordDecl`)`::isInjectedClassName` (PR #148195)
https://github.com/zwuis created https://github.com/llvm/llvm-project/pull/148195 Co-authored-by: Matheus Izvekov >From 306049aa7dd17f6683935d631b3ad222b268a3f2 Mon Sep 17 00:00:00 2001 From: Yanzuo Liu Date: Fri, 11 Jul 2025 18:17:05 +0800 Subject: [PATCH] (`RecordDecl` -> `CXXRecordDecl`)`::isInjectedClassName` --- clang-tools-extra/clangd/CodeComplete.cpp | 2 +- clang-tools-extra/clangd/Quality.cpp | 2 +- .../clangd/SemanticHighlighting.cpp| 2 +- clang/include/clang/AST/Decl.h | 15 --- clang/include/clang/AST/DeclCXX.h | 18 -- clang/lib/AST/Decl.cpp | 5 - clang/lib/AST/DeclCXX.cpp | 10 ++ clang/lib/Sema/SemaAccess.cpp | 3 ++- .../Clang/ClangASTImporter.cpp | 2 +- .../TypeSystem/Clang/TypeSystemClang.cpp | 5 - 10 files changed, 36 insertions(+), 28 deletions(-) diff --git a/clang-tools-extra/clangd/CodeComplete.cpp b/clang-tools-extra/clangd/CodeComplete.cpp index 14679fea6ac8a..d5907e3143bf6 100644 --- a/clang-tools-extra/clangd/CodeComplete.cpp +++ b/clang-tools-extra/clangd/CodeComplete.cpp @@ -870,7 +870,7 @@ bool contextAllowsIndex(enum CodeCompletionContext::Kind K) { } static bool isInjectedClass(const NamedDecl &D) { - if (auto *R = dyn_cast_or_null(&D)) + if (auto *R = dyn_cast_or_null(&D)) if (R->isInjectedClassName()) return true; return false; diff --git a/clang-tools-extra/clangd/Quality.cpp b/clang-tools-extra/clangd/Quality.cpp index c1ab63fb22f61..3f630b05c654b 100644 --- a/clang-tools-extra/clangd/Quality.cpp +++ b/clang-tools-extra/clangd/Quality.cpp @@ -258,7 +258,7 @@ static SymbolRelevanceSignals::AccessibleScope computeScope(const NamedDecl *D) { // Injected "Foo" within the class "Foo" has file scope, not class scope. const DeclContext *DC = D->getDeclContext(); - if (auto *R = dyn_cast_or_null(D)) + if (auto *R = dyn_cast_or_null(D)) if (R->isInjectedClassName()) DC = DC->getParent(); // Class constructor should have the same scope as the class. diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp b/clang-tools-extra/clangd/SemanticHighlighting.cpp index dc574dcd11703..e6d5cf7053694 100644 --- a/clang-tools-extra/clangd/SemanticHighlighting.cpp +++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp @@ -597,7 +597,7 @@ class HighlightingsBuilder { std::optional scopeModifier(const NamedDecl *D) { const DeclContext *DC = D->getDeclContext(); // Injected "Foo" within the class "Foo" has file scope, not class scope. - if (auto *R = dyn_cast_or_null(D)) + if (auto *R = dyn_cast_or_null(D)) if (R->isInjectedClassName()) DC = DC->getParent(); // Lambda captures are considered function scope, not class scope. diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index de79a9df29a5b..3d7969cca83fd 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -4420,21 +4420,6 @@ class RecordDecl : public TagDecl { void reorderDecls(const SmallVectorImpl &Decls); - /// Determines whether this declaration represents the - /// injected class name. - /// - /// The injected class name in C++ is the name of the class that - /// appears inside the class itself. For example: - /// - /// \code - /// struct C { - /// // C is implicitly declared here as a synonym for the class name. - /// }; - /// - /// C::C c; // same as "C c;" - /// \endcode - bool isInjectedClassName() const; - /// Determine whether this record is a class describing a lambda /// function object. bool isLambda() const; diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index 05cddd024d7cf..77bc3cad72ed9 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -546,8 +546,7 @@ class CXXRecordDecl : public RecordDecl { } CXXRecordDecl *getMostRecentNonInjectedDecl() { -CXXRecordDecl *Recent = -static_cast(this)->getMostRecentDecl(); +CXXRecordDecl *Recent = getMostRecentDecl(); while (Recent->isInjectedClassName()) { // FIXME: Does injected class name need to be in the redeclarations chain? assert(Recent->getPreviousDecl()); @@ -1889,6 +1888,21 @@ class CXXRecordDecl : public RecordDecl { DL.IsGenericLambda = IsGeneric; } + /// Determines whether this declaration represents the + /// injected class name. + /// + /// The injected class name in C++ is the name of the class that + /// appears inside the class itself. For example: + /// + /// \code + /// struct C { + /// // C is implicitly declared here as a synonym for the class name. + /// }; + /// + /// C::C c; // same as "C c;" + /// \endcode + bool isInjectedClassName() const; + // Determine whether this type is an Interface Like type for // __interface inheritance purposes. bo
[Lldb-commits] [lldb] [LLDB] Use non synthetic value for MSVC smart ptr check (PR #148176)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions cpp -- lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp index 11eaaced6..b1aecc4b6 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp @@ -18,7 +18,7 @@ bool lldb_private::formatters::IsMsvcStlSmartPointer(ValueObject &valobj) { if (auto valobj_sp = valobj.GetNonSyntheticValue()) return valobj_sp->GetChildMemberWithName("_Ptr") != nullptr; - return false; + return false; } bool lldb_private::formatters::MsvcStlSmartPointerSummaryProvider( `` https://github.com/llvm/llvm-project/pull/148176 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [Clang][AST][NFC] (`RecordDecl` -> `CXXRecordDecl`)`::isInjectedClassName` (PR #148195)
zwuis wrote: I'm not sure if I should update `llvm/include/llvm/Testing/Demangle/DemangleTestCases.inc` and `libcxxabi/test/DemangleTestCases.inc`. https://github.com/llvm/llvm-project/pull/148195 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [Clang][AST][NFC] (`RecordDecl` -> `CXXRecordDecl`)`::isInjectedClassName` (PR #148195)
cor3ntin wrote: Can you provide a more detailed description? Thanks! https://github.com/llvm/llvm-project/pull/148195 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Document the SBDebugger public interface (PR #147621)
@@ -106,44 +124,116 @@ class LLDB_API SBDebugger { bool &is_debugger_specific); #endif + /// Get progress data from an event. + /// + /// \param [in] event + /// The event to extract the progress information from. + /// + /// \return + /// A structured data object containing progress information, or an invalid + /// SBStructuredData if the event was not a progress event. labath wrote: ```suggestion /// Get progress data from an event, or an invalid /// SBStructuredData if the event was not a progress event. ``` https://github.com/llvm/llvm-project/pull/147621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Document the SBDebugger public interface (PR #147621)
@@ -55,16 +56,33 @@ class LLDB_API SBDebugger { eBroadcastBitExternalProgressCategory = lldb::DebuggerBroadcastBit::eBroadcastBitExternalProgressCategory, }; + + /// Default constructor creates an invalid SBDebugger instance. SBDebugger(); SBDebugger(const lldb::SBDebugger &rhs); ~SBDebugger(); + /// Get the broadcaster class name. + /// + /// \return The name of the broadcaster class. static const char *GetBroadcasterClass(); + /// Check if a specific language is supported by LLDB. + /// + /// \param [in] language + /// The language to check. + /// + /// \return + /// True if the language is supported, false otherwise. static bool SupportsLanguage(lldb::LanguageType language); + /// Get the broadcaster associated with this debugger. + /// + /// \return + /// A broadcaster object that allows subscribing to events from this + /// debugger. labath wrote: ```suggestion /// Get the broadcaster that allows subscribing to events from this /// debugger. ``` https://github.com/llvm/llvm-project/pull/147621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Document the SBDebugger public interface (PR #147621)
@@ -55,16 +56,33 @@ class LLDB_API SBDebugger { eBroadcastBitExternalProgressCategory = lldb::DebuggerBroadcastBit::eBroadcastBitExternalProgressCategory, }; + + /// Default constructor creates an invalid SBDebugger instance. SBDebugger(); SBDebugger(const lldb::SBDebugger &rhs); ~SBDebugger(); + /// Get the broadcaster class name. + /// + /// \return The name of the broadcaster class. static const char *GetBroadcasterClass(); + /// Check if a specific language is supported by LLDB. + /// + /// \param [in] language + /// The language to check. + /// + /// \return + /// True if the language is supported, false otherwise. labath wrote: ```suggestion ``` https://github.com/llvm/llvm-project/pull/147621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Document the SBDebugger public interface (PR #147621)
@@ -55,16 +56,33 @@ class LLDB_API SBDebugger { eBroadcastBitExternalProgressCategory = lldb::DebuggerBroadcastBit::eBroadcastBitExternalProgressCategory, }; + + /// Default constructor creates an invalid SBDebugger instance. SBDebugger(); SBDebugger(const lldb::SBDebugger &rhs); ~SBDebugger(); + /// Get the broadcaster class name. + /// + /// \return The name of the broadcaster class. labath wrote: ```suggestion /// Get the broadcaster class name. ``` https://github.com/llvm/llvm-project/pull/147621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Document the SBDebugger public interface (PR #147621)
@@ -106,44 +124,122 @@ class LLDB_API SBDebugger { bool &is_debugger_specific); #endif + /// Get structured progress data from an event. + /// + /// \param [in] event + /// The event to extract the progress information from. + /// + /// \return + /// A structured data object containing progress information, or an invalid + /// SBStructuredData if the event was not a progress event. static lldb::SBStructuredData GetProgressDataFromEvent(const lldb::SBEvent &event); + /// Get diagnostic information from an event. + /// + /// \param [in] event + /// The event to extract the diagnostic information from. + /// + /// \return + /// A structured data object containing diagnostic information, or an + /// invalid SBStructuredData if the event was not a diagnostic event. static lldb::SBStructuredData GetDiagnosticFromEvent(const lldb::SBEvent &event); + /// Assignment operator. lldb::SBDebugger &operator=(const lldb::SBDebugger &rhs); + /// Initialize LLDB and its subsystems. + /// + /// This function should be called before any other LLDB functions. It + /// initializes all required subsystems for proper LLDB functionality. static void Initialize(); labath wrote: I think that, at least in theory, socket subsystem initialization can fail (on windows). https://github.com/llvm/llvm-project/pull/147621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Document the SBDebugger public interface (PR #147621)
https://github.com/labath approved this pull request. I don't want to hold this up. Made some suggestions on how I would condense the descriptions. I stopped after I realized I'd be rewriting most of these. I also haven't checked how would the formatted version of this look like. I'll leave it up to you whether you want to apply them or not. I have a feeling that when the users ask for documentation, they're ask for more high-level things like "what is a CompileUnit" or "what's the difference between a load and a file address", and not "what does Debugger::Create do" https://github.com/llvm/llvm-project/pull/147621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Document the SBDebugger public interface (PR #147621)
https://github.com/labath edited https://github.com/llvm/llvm-project/pull/147621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [mlir] A couple of grammar fixes (PR #144368)
llvmbot wrote: @llvm/pr-subscribers-mlir-core Author: Roman (GameRoMan) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/144368.diff 10 Files Affected: - (modified) clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp (+1-1) - (modified) clang/test/AST/HLSL/RootSignatures-AST.hlsl (+1-1) - (modified) clang/test/Modules/safe_buffers_optout.cpp (+2-2) - (modified) lldb/include/lldb/Target/CoreFileMemoryRanges.h (+1-1) - (modified) llvm/include/llvm/Analysis/VectorUtils.h (+1-1) - (modified) llvm/lib/IR/DebugInfo.cpp (+1-1) - (modified) llvm/lib/Transforms/Utils/IRNormalizer.cpp (+1-1) - (modified) mlir/lib/Bindings/Python/IRAttributes.cpp (+1-1) - (modified) mlir/test/Dialect/Vector/vector-reduce-to-contract.mlir (+1-1) - (modified) mlir/tools/mlir-tblgen/EnumsGen.cpp (+1-1) ``diff diff --git a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp index 936a906651f16..e5deeb0e96158 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp @@ -152,7 +152,7 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { StringRef ExtraReference = ""; if (MainTypeEndLoc.isValid() && TypeRange.fullyContains(MainTypeEndLoc)) { // Each type introduced in a typedef can specify being a reference or - // pointer type seperately, so we need to sigure out if the new using-decl + // pointer type separately, so we need to sigure out if the new using-decl // needs to be to a reference or pointer as well. const SourceLocation Tok = utils::lexer::findPreviousAnyTokenKind( MatchedDecl->getLocation(), SM, LO, tok::TokenKind::star, diff --git a/clang/test/AST/HLSL/RootSignatures-AST.hlsl b/clang/test/AST/HLSL/RootSignatures-AST.hlsl index 27c40430c9d0a..0a933a76dd989 100644 --- a/clang/test/AST/HLSL/RootSignatures-AST.hlsl +++ b/clang/test/AST/HLSL/RootSignatures-AST.hlsl @@ -115,7 +115,7 @@ void same_rs_string_main() {} "DescriptorTable(Sampler(s0, numDescriptors = 4, space = 1))" // Ensure that when we define a different type root signature that it creates -// a seperate decl and identifier to reference +// a separate decl and identifier to reference // CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[DIFF_RS_DECL:__hlsl_rootsig_decl_\d*]] // CHECK-V1_0: version: 1.0, diff --git a/clang/test/Modules/safe_buffers_optout.cpp b/clang/test/Modules/safe_buffers_optout.cpp index 8c3d6a235d399..39020a48925e1 100644 --- a/clang/test/Modules/safe_buffers_optout.cpp +++ b/clang/test/Modules/safe_buffers_optout.cpp @@ -96,7 +96,7 @@ int textual(int *p) { // `safe_buffers_test_base`. (So the module dependencies form a DAG.) // No expected warnings from base.h, test_sub1, or test_sub2 because they are -// in seperate modules, and the explicit commands that builds them have no +// in separate modules, and the explicit commands that builds them have no // `-Wunsafe-buffer-usage`. int foo(int * p) { @@ -122,7 +122,7 @@ int foo(int * p) { // `safe_buffers_test_base`. (So the module dependencies form a DAG.) // No expected warnings from base.h, test_sub1, or test_sub2 because they are -// in seperate modules, and the explicit commands that builds them have no +// in separate modules, and the explicit commands that builds them have no // `-Wunsafe-buffer-usage`. int foo(int * p) { diff --git a/lldb/include/lldb/Target/CoreFileMemoryRanges.h b/lldb/include/lldb/Target/CoreFileMemoryRanges.h index 78d01acca324e..ef56a02ddee27 100644 --- a/lldb/include/lldb/Target/CoreFileMemoryRanges.h +++ b/lldb/include/lldb/Target/CoreFileMemoryRanges.h @@ -50,7 +50,7 @@ class CoreFileMemoryRanges CoreFileMemoryRange> { public: /// Finalize and merge all overlapping ranges in this collection. Ranges - /// will be seperated based on permissions. + /// will be separated based on permissions. Status FinalizeCoreFileSaveRanges(); }; } // namespace lldb_private diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h index 53ba1e8f77791..4ef2ace34856a 100644 --- a/llvm/include/llvm/Analysis/VectorUtils.h +++ b/llvm/include/llvm/Analysis/VectorUtils.h @@ -144,7 +144,7 @@ LLVM_ABI bool isTriviallyVectorizable(Intrinsic::ID ID); /// Note: There are intrinsics where implementing vectorization for the /// intrinsic is redundant, but we want to implement scalarization of the /// vector. To prevent the requirement that an intrinsic also implements -/// vectorization we provide this seperate function. +/// vectorization we provide this separate function. LLVM_ABI bool isTriviallyScalarizable(Intrinsic::ID ID, const TargetTransformInfo *TTI); diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 4e09f847627af..b3a557dc3a31d 100644
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [mlir] A couple of grammar fixes (PR #144368)
https://github.com/GameRoMan updated https://github.com/llvm/llvm-project/pull/144368 >From 2b50682f230efa03c3b9a1f5c5e48e708734bf4d Mon Sep 17 00:00:00 2001 From: Roman A <121314722+gamero...@users.noreply.github.com> Date: Mon, 16 Jun 2025 15:59:01 +0100 Subject: [PATCH] A couple of grammar fixes --- clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp | 2 +- clang/test/AST/HLSL/RootSignatures-AST.hlsl | 2 +- clang/test/Modules/safe_buffers_optout.cpp | 4 ++-- lldb/include/lldb/Target/CoreFileMemoryRanges.h | 2 +- llvm/include/llvm/Analysis/VectorUtils.h | 2 +- llvm/lib/IR/DebugInfo.cpp| 2 +- llvm/lib/Transforms/Utils/IRNormalizer.cpp | 2 +- mlir/lib/Bindings/Python/IRAttributes.cpp| 2 +- mlir/test/Dialect/Vector/vector-reduce-to-contract.mlir | 2 +- mlir/tools/mlir-tblgen/EnumsGen.cpp | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp index 30fcba367db67..85dc9eb71ab7e 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp @@ -151,7 +151,7 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { StringRef ExtraReference = ""; if (MainTypeEndLoc.isValid() && TypeRange.fullyContains(MainTypeEndLoc)) { // Each type introduced in a typedef can specify being a reference or - // pointer type seperately, so we need to sigure out if the new using-decl + // pointer type separately, so we need to sigure out if the new using-decl // needs to be to a reference or pointer as well. const SourceLocation Tok = utils::lexer::findPreviousAnyTokenKind( MatchedDecl->getLocation(), SM, LO, tok::TokenKind::star, diff --git a/clang/test/AST/HLSL/RootSignatures-AST.hlsl b/clang/test/AST/HLSL/RootSignatures-AST.hlsl index c700174da764d..1a0f17757796c 100644 --- a/clang/test/AST/HLSL/RootSignatures-AST.hlsl +++ b/clang/test/AST/HLSL/RootSignatures-AST.hlsl @@ -61,7 +61,7 @@ void same_rs_string_main() {} "DescriptorTable(Sampler(s0, numDescriptors = 4, space = 1))" // Ensure that when we define a different type root signature that it creates -// a seperate decl and identifier to reference +// a separate decl and identifier to reference // CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[DIFF_RS_DECL:__hlsl_rootsig_decl_\d*]] // CHECK-SAME: RootElements{ diff --git a/clang/test/Modules/safe_buffers_optout.cpp b/clang/test/Modules/safe_buffers_optout.cpp index 8c3d6a235d399..39020a48925e1 100644 --- a/clang/test/Modules/safe_buffers_optout.cpp +++ b/clang/test/Modules/safe_buffers_optout.cpp @@ -96,7 +96,7 @@ int textual(int *p) { // `safe_buffers_test_base`. (So the module dependencies form a DAG.) // No expected warnings from base.h, test_sub1, or test_sub2 because they are -// in seperate modules, and the explicit commands that builds them have no +// in separate modules, and the explicit commands that builds them have no // `-Wunsafe-buffer-usage`. int foo(int * p) { @@ -122,7 +122,7 @@ int foo(int * p) { // `safe_buffers_test_base`. (So the module dependencies form a DAG.) // No expected warnings from base.h, test_sub1, or test_sub2 because they are -// in seperate modules, and the explicit commands that builds them have no +// in separate modules, and the explicit commands that builds them have no // `-Wunsafe-buffer-usage`. int foo(int * p) { diff --git a/lldb/include/lldb/Target/CoreFileMemoryRanges.h b/lldb/include/lldb/Target/CoreFileMemoryRanges.h index 78d01acca324e..ef56a02ddee27 100644 --- a/lldb/include/lldb/Target/CoreFileMemoryRanges.h +++ b/lldb/include/lldb/Target/CoreFileMemoryRanges.h @@ -50,7 +50,7 @@ class CoreFileMemoryRanges CoreFileMemoryRange> { public: /// Finalize and merge all overlapping ranges in this collection. Ranges - /// will be seperated based on permissions. + /// will be separated based on permissions. Status FinalizeCoreFileSaveRanges(); }; } // namespace lldb_private diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h index 53ba1e8f77791..4ef2ace34856a 100644 --- a/llvm/include/llvm/Analysis/VectorUtils.h +++ b/llvm/include/llvm/Analysis/VectorUtils.h @@ -144,7 +144,7 @@ LLVM_ABI bool isTriviallyVectorizable(Intrinsic::ID ID); /// Note: There are intrinsics where implementing vectorization for the /// intrinsic is redundant, but we want to implement scalarization of the /// vector. To prevent the requirement that an intrinsic also implements -/// vectorization we provide this seperate function. +/// vectorization we provide this separate function. LLVM_ABI bool isTriviallyScalarizable(Intrinsic::ID ID,
[Lldb-commits] [lldb] [lldb][Format] Fall back to old function.name-with-args if language frame format is emtpy (PR #148235)
https://github.com/charles-zablit approved this pull request. https://github.com/llvm/llvm-project/pull/148235 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Use non synthetic value for MSVC smart ptr check (PR #148176)
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/148176 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 539991e - [LLDB] Use non synthetic value for MSVC smart ptr check (#148176)
Author: nerix Date: 2025-07-11T13:06:17+01:00 New Revision: 539991e33f1df194b6ca00039a1bab04b045f47b URL: https://github.com/llvm/llvm-project/commit/539991e33f1df194b6ca00039a1bab04b045f47b DIFF: https://github.com/llvm/llvm-project/commit/539991e33f1df194b6ca00039a1bab04b045f47b.diff LOG: [LLDB] Use non synthetic value for MSVC smart ptr check (#148176) I forgot to use the non-synthetic value to check for the `_Ptr` member. Fixes the test failure from #147575. - Co-authored-by: Michael Buch Added: Modified: lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp Removed: diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp index 4a51879863f17..b1aecc4b6611a 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlSmartPointer.cpp @@ -15,7 +15,10 @@ using namespace lldb; bool lldb_private::formatters::IsMsvcStlSmartPointer(ValueObject &valobj) { - return valobj.GetChildMemberWithName("_Ptr") != nullptr; + if (auto valobj_sp = valobj.GetNonSyntheticValue()) +return valobj_sp->GetChildMemberWithName("_Ptr") != nullptr; + + return false; } bool lldb_private::formatters::MsvcStlSmartPointerSummaryProvider( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Format] Fall back to old function-name-with args if language frame format is emtpy (PR #148235)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/148235 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Format] Fall back to old function.name-with-args if language frame format is emtpy (PR #148235)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/148235 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Update the String table offset based on the DWARF format (PR #147054)
HemangGadhavi wrote: Hi @labath @DavidSpickett I have addressed your comments, and added separate test case to test DW_AT_str_offsets_base for DWARF5 & 64 format. Please review once and give your inputs. https://github.com/llvm/llvm-project/pull/147054 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [mlir] A couple of grammar fixes (PR #144368)
vbvictor wrote: Please write PR description more specific and add (NFC) at the end. Could be: "Fix typos 'seperate' -> 'separate' (NFC)" https://github.com/llvm/llvm-project/pull/144368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Update the String table offset based on the DWARF format (PR #147054)
@@ -1077,7 +1077,8 @@ uint32_t DWARFUnit::GetHeaderByteSize() const { return m_header.getSize(); } std::optional DWARFUnit::GetStringOffsetSectionItem(uint32_t index) const { - lldb::offset_t offset = GetStrOffsetsBase() + index * 4; + lldb::offset_t offset = + GetStrOffsetsBase() + index * m_header.getDwarfOffsetByteSize(); return m_dwarf.GetDWARFContext().getOrLoadStrOffsetsData().GetU32(&offset); HemangGadhavi wrote: Addressed https://github.com/llvm/llvm-project/pull/147054 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [Clang][AST][NFC] (`RecordDecl` -> `CXXRecordDecl`)`::isInjectedClassName` (PR #148195)
Michael137 wrote: > I'm not sure if I should update > `llvm/include/llvm/Testing/Demangle/DemangleTestCases.inc` and > `libcxxabi/test/DemangleTestCases.inc`. Why would you need to? There are no changes to mangling/demangling here AFAICT https://github.com/llvm/llvm-project/pull/148195 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] deactivate some tests on older SDKs (PR #147768)
https://github.com/Michael137 approved this pull request. https://github.com/llvm/llvm-project/pull/147768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Format] Fallback to old function-name-with args if language frame format is emtpy (PR #148235)
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/148235 There is currently no way to prevent `${function.name-with-args}` from using the `plugin.cplusplus.display.function-name-format` setting. Even if the setting is set to an empty string. As a way to disable formatting by language plugin, this patch makes it so `plugin.cplusplus.display.function-name-format` falls back to the old way of printing `${function.name-with-args}`. Even if we didn't want to add a fallback, making the setting an empty string shouldn't really "succeed". >From daee483d183d9c8d248ed7e0ae534cb708c0aa22 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 11 Jul 2025 12:57:56 +0100 Subject: [PATCH] [lldb][Format] Fallback to old function-name-with args if language frame format is emtpy There is currently no way to prevent `${function.name-with-args}` from using the `plugin.cplusplus.display.function-name-format` setting. Even if the setting is set to an empty string. As a way to disable formatting by language plugin, this patch makes it so `plugin.cplusplus.display.function-name-format` falls back to the old way of printing `${function.name-with-args}`. Even if we didn't want to add a fallback, making the setting an empty string shouldn't really "succeed". --- lldb/source/Core/FormatEntity.cpp | 4 ++- .../Settings/TestCxxFrameFormatEmpty.test | 32 +++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 lldb/test/Shell/Settings/TestCxxFrameFormatEmpty.test diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index ca389bc88cf79..370b51e726ec2 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -1280,7 +1280,9 @@ static bool FormatFunctionNameForLanguage(Stream &s, return false; FormatEntity::Entry format = language_plugin->GetFunctionNameFormat(); - if (!format) + + // Bail on invalid or empty format. + if (!format || format == FormatEntity::Entry(Entry::Type::Root)) return false; StreamString name_stream; diff --git a/lldb/test/Shell/Settings/TestCxxFrameFormatEmpty.test b/lldb/test/Shell/Settings/TestCxxFrameFormatEmpty.test new file mode 100644 index 0..0a6d2723ded34 --- /dev/null +++ b/lldb/test/Shell/Settings/TestCxxFrameFormatEmpty.test @@ -0,0 +1,32 @@ +# XFAIL: target-windows + +# Test that setting plugin.cplusplus.display.function-name-format +# to an empty string disables the "format by language" part of +# ${function.name-with-args}. + +# RUN: split-file %s %t +# RUN: %clang_host -g -gdwarf %t/main.cpp -o %t.out +# RUN: %lldb -x -b -s %t/commands.input %t.out -o exit 2>&1 \ +# RUN: | FileCheck %s + +#--- main.cpp +namespace ns::ns2 { +void custom(int x) {} +void bar() { custom(5); } +} + +int main(int argc, char const *argv[]) { +ns::ns2::bar(); +return 0; +} + +#--- commands.input +settings set plugin.cplusplus.display.function-name-format "" +settings set -f frame-format "custom-frame '${function.name-with-args}'\n" +break set -l 2 -f main.cpp + +run +bt + +# CHECK: custom-frame 'ns::ns2::custom(x=5)' +# CHECK: custom-frame 'ns::ns2::bar()' ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Use non synthetic value for MSVC smart ptr check (PR #148176)
Michael137 wrote: > Windows premerge checks would be great for this. I opened #146236, but there > are still some LLDB tests failing. Not really sure why. That's awesome! I think @Endilll looked at Windows pre-merge testing in the past (at least for Clang, but IIRC maybe also LLDB?), but it was disabled due to bandwidth issues. I'll CC him on #146236 https://github.com/llvm/llvm-project/pull/148176 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Use non synthetic value for MSVC smart ptr check (PR #148176)
Nerixyz wrote: Windows premerge checks would be great for this. I opened https://github.com/llvm/llvm-project/pull/146236, but there are still some LLDB tests failing. Not really sure why. https://github.com/llvm/llvm-project/pull/148176 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Format] Fallback to old function-name-with args if language frame format is emtpy (PR #148235)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Michael Buch (Michael137) Changes There is currently no way to prevent `${function.name-with-args}` from using the `plugin.cplusplus.display.function-name-format` setting. Even if the setting is set to an empty string. As a way to disable formatting by language plugin, this patch makes it so `plugin.cplusplus.display.function-name-format` falls back to the old way of printing `${function.name-with-args}`. Even if we didn't want to add a fallback, making the setting an empty string shouldn't really "succeed". --- Full diff: https://github.com/llvm/llvm-project/pull/148235.diff 2 Files Affected: - (modified) lldb/source/Core/FormatEntity.cpp (+3-1) - (added) lldb/test/Shell/Settings/TestCxxFrameFormatEmpty.test (+32) ``diff diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index ca389bc88cf79..370b51e726ec2 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -1280,7 +1280,9 @@ static bool FormatFunctionNameForLanguage(Stream &s, return false; FormatEntity::Entry format = language_plugin->GetFunctionNameFormat(); - if (!format) + + // Bail on invalid or empty format. + if (!format || format == FormatEntity::Entry(Entry::Type::Root)) return false; StreamString name_stream; diff --git a/lldb/test/Shell/Settings/TestCxxFrameFormatEmpty.test b/lldb/test/Shell/Settings/TestCxxFrameFormatEmpty.test new file mode 100644 index 0..0a6d2723ded34 --- /dev/null +++ b/lldb/test/Shell/Settings/TestCxxFrameFormatEmpty.test @@ -0,0 +1,32 @@ +# XFAIL: target-windows + +# Test that setting plugin.cplusplus.display.function-name-format +# to an empty string disables the "format by language" part of +# ${function.name-with-args}. + +# RUN: split-file %s %t +# RUN: %clang_host -g -gdwarf %t/main.cpp -o %t.out +# RUN: %lldb -x -b -s %t/commands.input %t.out -o exit 2>&1 \ +# RUN: | FileCheck %s + +#--- main.cpp +namespace ns::ns2 { +void custom(int x) {} +void bar() { custom(5); } +} + +int main(int argc, char const *argv[]) { +ns::ns2::bar(); +return 0; +} + +#--- commands.input +settings set plugin.cplusplus.display.function-name-format "" +settings set -f frame-format "custom-frame '${function.name-with-args}'\n" +break set -l 2 -f main.cpp + +run +bt + +# CHECK: custom-frame 'ns::ns2::custom(x=5)' +# CHECK: custom-frame 'ns::ns2::bar()' `` https://github.com/llvm/llvm-project/pull/148235 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Format] Fall back to old function.name-with-args if language frame format is emtpy (PR #148235)
charles-zablit wrote: Is it a reasonable use case to want to not print anything? If not, then I think this is a valid way of deactivating the plugin formatting. https://github.com/llvm/llvm-project/pull/148235 ___ 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::vector (PR #147538)
https://github.com/Nerixyz updated https://github.com/llvm/llvm-project/pull/147538 >From a5b22c74a6457ea6d546ff03c09fe93bd2829c4e Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Sat, 21 Jun 2025 17:35:23 +0200 Subject: [PATCH] [LLDB] Add formatters for MSVC STL std::vector --- .../Plugins/Language/CPlusPlus/CMakeLists.txt | 1 + .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 35 ++- .../Plugins/Language/CPlusPlus/MsvcStl.h | 4 + .../Language/CPlusPlus/MsvcStlVector.cpp | 297 ++ .../vbool/TestDataFormatterStdVBool.py| 24 +- .../data-formatter-stl/generic/vbool/main.cpp | 39 ++- .../vector/TestDataFormatterStdVector.py | 11 + 7 files changed, 403 insertions(+), 8 deletions(-) create mode 100644 lldb/source/Plugins/Language/CPlusPlus/MsvcStlVector.cpp diff --git a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt index 296159ea28407..21f55700e834d 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt +++ b/lldb/source/Plugins/Language/CPlusPlus/CMakeLists.txt @@ -35,6 +35,7 @@ add_lldb_library(lldbPluginCPlusPlusLanguage PLUGIN LibStdcppUniquePointer.cpp MsvcStl.cpp MsvcStlSmartPointer.cpp + MsvcStlVector.cpp MSVCUndecoratedNameParser.cpp LINK_COMPONENTS diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 2db3e6f0ca315..beeccc98d0c23 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1404,7 +1404,7 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { stl_deref_flags.SetFrontEndWantsDereference(); cpp_category_sp->AddTypeSynthetic( - "^std::(__debug::)?vector<.+>(( )?&)?$", eFormatterMatchRegex, + "^std::__debug::vector<.+>(( )?&)?$", eFormatterMatchRegex, SyntheticChildrenSP(new ScriptedSyntheticChildren( stl_synth_flags, "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider"))); @@ -1465,10 +1465,10 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { "libstdc++ std::bitset summary provider", "^std::(__debug::)?bitset<.+>(( )?&)?$", stl_summary_flags, true); - AddCXXSummary( - cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider, - "libstdc++ std::vector summary provider", - "^std::(__debug::)?vector<.+>(( )?&)?$", stl_summary_flags, true); + AddCXXSummary(cpp_category_sp, +lldb_private::formatters::ContainerSizeSummaryProvider, +"libstdc++ std::__debug::vector summary provider", +"^std::__debug::vector<.+>(( )?&)?$", stl_summary_flags, true); AddCXXSummary( cpp_category_sp, lldb_private::formatters::ContainerSizeSummaryProvider, @@ -1599,6 +1599,20 @@ GenericSmartPointerSummaryProvider(ValueObject &valobj, Stream &stream, return LibStdcppSmartPointerSummaryProvider(valobj, stream, options); } +static lldb_private::SyntheticChildrenFrontEnd * +GenericVectorSyntheticFrontEndCreator(CXXSyntheticChildren *children, + lldb::ValueObjectSP valobj_sp) { + if (!valobj_sp) +return nullptr; + + // checks for vector and vector + if (auto *msvc = MsvcStlVectorSyntheticFrontEndCreator(valobj_sp)) +return msvc; + + return new ScriptedSyntheticChildren::FrontEnd( + "lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider", *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) @@ -1655,6 +1669,17 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider, "MSVC STL/libstdc++ std::weak_ptr summary provider", "^std::weak_ptr<.+>(( )?&)?$", stl_summary_flags, true); + + stl_summary_flags.SetDontShowChildren(false); + stl_summary_flags.SetSkipPointers(false); + + AddCXXSummary(cpp_category_sp, +lldb_private::formatters::ContainerSizeSummaryProvider, +"MSVC/libstdc++ std::vector summary provider", +"^std::vector<.+>(( )?&)?$", stl_summary_flags, true); + AddCXXSynthetic(cpp_category_sp, GenericVectorSyntheticFrontEndCreator, + "MSVC/libstdc++ std::vector synthetic provider", + "^std::vector<.+>(( )?&)?$", stl_synth_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 edf3f4e8a5387..50854a19b4924 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl
[Lldb-commits] [lldb] [LLDB] Add formatters for MSVC STL std::vector (PR #147538)
@@ -1599,6 +1599,20 @@ GenericSmartPointerSummaryProvider(ValueObject &valobj, Stream &stream, return LibStdcppSmartPointerSummaryProvider(valobj, stream, options); } +static lldb_private::SyntheticChildrenFrontEnd * +GenericVectorSyntheticFrontEndCreator(CXXSyntheticChildren *children, + lldb::ValueObjectSP valobj_sp) { + if (!valobj_sp) +return nullptr; + + // checks for vector and vector + if (auto *msvc = MsvcStlVectorSyntheticFrontEndCreator(valobj_sp)) +return msvc; Nerixyz wrote: I kept this because that function has to for the correct type regardless. Inserting a `IsMsvcStlVector` would duplicate that check. https://github.com/llvm/llvm-project/pull/147538 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Format] Fall back to old function.name-with-args if language frame format is emtpy (PR #148235)
Michael137 wrote: > Is it a reasonable use case to want to not print anything? If not, then I > think this is a valid way of deactivating the plugin formatting. There are better ways of not printing a function name in the frame. E.g., overriding the `frame-format` setting https://github.com/llvm/llvm-project/pull/148235 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [mlir] A couple of grammar fixes (PR #144368)
https://github.com/GameRoMan updated https://github.com/llvm/llvm-project/pull/144368 >From 2b50682f230efa03c3b9a1f5c5e48e708734bf4d Mon Sep 17 00:00:00 2001 From: Roman A <121314722+gamero...@users.noreply.github.com> Date: Mon, 16 Jun 2025 15:59:01 +0100 Subject: [PATCH] A couple of grammar fixes --- clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp | 2 +- clang/test/AST/HLSL/RootSignatures-AST.hlsl | 2 +- clang/test/Modules/safe_buffers_optout.cpp | 4 ++-- lldb/include/lldb/Target/CoreFileMemoryRanges.h | 2 +- llvm/include/llvm/Analysis/VectorUtils.h | 2 +- llvm/lib/IR/DebugInfo.cpp| 2 +- llvm/lib/Transforms/Utils/IRNormalizer.cpp | 2 +- mlir/lib/Bindings/Python/IRAttributes.cpp| 2 +- mlir/test/Dialect/Vector/vector-reduce-to-contract.mlir | 2 +- mlir/tools/mlir-tblgen/EnumsGen.cpp | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp index 30fcba367db67..85dc9eb71ab7e 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp @@ -151,7 +151,7 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { StringRef ExtraReference = ""; if (MainTypeEndLoc.isValid() && TypeRange.fullyContains(MainTypeEndLoc)) { // Each type introduced in a typedef can specify being a reference or - // pointer type seperately, so we need to sigure out if the new using-decl + // pointer type separately, so we need to sigure out if the new using-decl // needs to be to a reference or pointer as well. const SourceLocation Tok = utils::lexer::findPreviousAnyTokenKind( MatchedDecl->getLocation(), SM, LO, tok::TokenKind::star, diff --git a/clang/test/AST/HLSL/RootSignatures-AST.hlsl b/clang/test/AST/HLSL/RootSignatures-AST.hlsl index c700174da764d..1a0f17757796c 100644 --- a/clang/test/AST/HLSL/RootSignatures-AST.hlsl +++ b/clang/test/AST/HLSL/RootSignatures-AST.hlsl @@ -61,7 +61,7 @@ void same_rs_string_main() {} "DescriptorTable(Sampler(s0, numDescriptors = 4, space = 1))" // Ensure that when we define a different type root signature that it creates -// a seperate decl and identifier to reference +// a separate decl and identifier to reference // CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[DIFF_RS_DECL:__hlsl_rootsig_decl_\d*]] // CHECK-SAME: RootElements{ diff --git a/clang/test/Modules/safe_buffers_optout.cpp b/clang/test/Modules/safe_buffers_optout.cpp index 8c3d6a235d399..39020a48925e1 100644 --- a/clang/test/Modules/safe_buffers_optout.cpp +++ b/clang/test/Modules/safe_buffers_optout.cpp @@ -96,7 +96,7 @@ int textual(int *p) { // `safe_buffers_test_base`. (So the module dependencies form a DAG.) // No expected warnings from base.h, test_sub1, or test_sub2 because they are -// in seperate modules, and the explicit commands that builds them have no +// in separate modules, and the explicit commands that builds them have no // `-Wunsafe-buffer-usage`. int foo(int * p) { @@ -122,7 +122,7 @@ int foo(int * p) { // `safe_buffers_test_base`. (So the module dependencies form a DAG.) // No expected warnings from base.h, test_sub1, or test_sub2 because they are -// in seperate modules, and the explicit commands that builds them have no +// in separate modules, and the explicit commands that builds them have no // `-Wunsafe-buffer-usage`. int foo(int * p) { diff --git a/lldb/include/lldb/Target/CoreFileMemoryRanges.h b/lldb/include/lldb/Target/CoreFileMemoryRanges.h index 78d01acca324e..ef56a02ddee27 100644 --- a/lldb/include/lldb/Target/CoreFileMemoryRanges.h +++ b/lldb/include/lldb/Target/CoreFileMemoryRanges.h @@ -50,7 +50,7 @@ class CoreFileMemoryRanges CoreFileMemoryRange> { public: /// Finalize and merge all overlapping ranges in this collection. Ranges - /// will be seperated based on permissions. + /// will be separated based on permissions. Status FinalizeCoreFileSaveRanges(); }; } // namespace lldb_private diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h index 53ba1e8f77791..4ef2ace34856a 100644 --- a/llvm/include/llvm/Analysis/VectorUtils.h +++ b/llvm/include/llvm/Analysis/VectorUtils.h @@ -144,7 +144,7 @@ LLVM_ABI bool isTriviallyVectorizable(Intrinsic::ID ID); /// Note: There are intrinsics where implementing vectorization for the /// intrinsic is redundant, but we want to implement scalarization of the /// vector. To prevent the requirement that an intrinsic also implements -/// vectorization we provide this seperate function. +/// vectorization we provide this separate function. LLVM_ABI bool isTriviallyScalarizable(Intrinsic::ID ID,
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [mlir] A couple of grammar fixes (PR #144368)
https://github.com/GameRoMan ready_for_review https://github.com/llvm/llvm-project/pull/144368 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [mlir] A couple of grammar fixes (PR #144368)
llvmbot wrote: @llvm/pr-subscribers-debuginfo Author: Roman (GameRoMan) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/144368.diff 10 Files Affected: - (modified) clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp (+1-1) - (modified) clang/test/AST/HLSL/RootSignatures-AST.hlsl (+1-1) - (modified) clang/test/Modules/safe_buffers_optout.cpp (+2-2) - (modified) lldb/include/lldb/Target/CoreFileMemoryRanges.h (+1-1) - (modified) llvm/include/llvm/Analysis/VectorUtils.h (+1-1) - (modified) llvm/lib/IR/DebugInfo.cpp (+1-1) - (modified) llvm/lib/Transforms/Utils/IRNormalizer.cpp (+1-1) - (modified) mlir/lib/Bindings/Python/IRAttributes.cpp (+1-1) - (modified) mlir/test/Dialect/Vector/vector-reduce-to-contract.mlir (+1-1) - (modified) mlir/tools/mlir-tblgen/EnumsGen.cpp (+1-1) ``diff diff --git a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp index 936a906651f16..e5deeb0e96158 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp @@ -152,7 +152,7 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { StringRef ExtraReference = ""; if (MainTypeEndLoc.isValid() && TypeRange.fullyContains(MainTypeEndLoc)) { // Each type introduced in a typedef can specify being a reference or - // pointer type seperately, so we need to sigure out if the new using-decl + // pointer type separately, so we need to sigure out if the new using-decl // needs to be to a reference or pointer as well. const SourceLocation Tok = utils::lexer::findPreviousAnyTokenKind( MatchedDecl->getLocation(), SM, LO, tok::TokenKind::star, diff --git a/clang/test/AST/HLSL/RootSignatures-AST.hlsl b/clang/test/AST/HLSL/RootSignatures-AST.hlsl index 27c40430c9d0a..0a933a76dd989 100644 --- a/clang/test/AST/HLSL/RootSignatures-AST.hlsl +++ b/clang/test/AST/HLSL/RootSignatures-AST.hlsl @@ -115,7 +115,7 @@ void same_rs_string_main() {} "DescriptorTable(Sampler(s0, numDescriptors = 4, space = 1))" // Ensure that when we define a different type root signature that it creates -// a seperate decl and identifier to reference +// a separate decl and identifier to reference // CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[DIFF_RS_DECL:__hlsl_rootsig_decl_\d*]] // CHECK-V1_0: version: 1.0, diff --git a/clang/test/Modules/safe_buffers_optout.cpp b/clang/test/Modules/safe_buffers_optout.cpp index 8c3d6a235d399..39020a48925e1 100644 --- a/clang/test/Modules/safe_buffers_optout.cpp +++ b/clang/test/Modules/safe_buffers_optout.cpp @@ -96,7 +96,7 @@ int textual(int *p) { // `safe_buffers_test_base`. (So the module dependencies form a DAG.) // No expected warnings from base.h, test_sub1, or test_sub2 because they are -// in seperate modules, and the explicit commands that builds them have no +// in separate modules, and the explicit commands that builds them have no // `-Wunsafe-buffer-usage`. int foo(int * p) { @@ -122,7 +122,7 @@ int foo(int * p) { // `safe_buffers_test_base`. (So the module dependencies form a DAG.) // No expected warnings from base.h, test_sub1, or test_sub2 because they are -// in seperate modules, and the explicit commands that builds them have no +// in separate modules, and the explicit commands that builds them have no // `-Wunsafe-buffer-usage`. int foo(int * p) { diff --git a/lldb/include/lldb/Target/CoreFileMemoryRanges.h b/lldb/include/lldb/Target/CoreFileMemoryRanges.h index 78d01acca324e..ef56a02ddee27 100644 --- a/lldb/include/lldb/Target/CoreFileMemoryRanges.h +++ b/lldb/include/lldb/Target/CoreFileMemoryRanges.h @@ -50,7 +50,7 @@ class CoreFileMemoryRanges CoreFileMemoryRange> { public: /// Finalize and merge all overlapping ranges in this collection. Ranges - /// will be seperated based on permissions. + /// will be separated based on permissions. Status FinalizeCoreFileSaveRanges(); }; } // namespace lldb_private diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h index 53ba1e8f77791..4ef2ace34856a 100644 --- a/llvm/include/llvm/Analysis/VectorUtils.h +++ b/llvm/include/llvm/Analysis/VectorUtils.h @@ -144,7 +144,7 @@ LLVM_ABI bool isTriviallyVectorizable(Intrinsic::ID ID); /// Note: There are intrinsics where implementing vectorization for the /// intrinsic is redundant, but we want to implement scalarization of the /// vector. To prevent the requirement that an intrinsic also implements -/// vectorization we provide this seperate function. +/// vectorization we provide this separate function. LLVM_ABI bool isTriviallyScalarizable(Intrinsic::ID ID, const TargetTransformInfo *TTI); diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 4e09f847627af..b3a557dc3a31d 100644
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [mlir] A couple of grammar fixes (PR #144368)
llvmbot wrote: @llvm/pr-subscribers-llvm-analysis Author: Roman (GameRoMan) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/144368.diff 10 Files Affected: - (modified) clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp (+1-1) - (modified) clang/test/AST/HLSL/RootSignatures-AST.hlsl (+1-1) - (modified) clang/test/Modules/safe_buffers_optout.cpp (+2-2) - (modified) lldb/include/lldb/Target/CoreFileMemoryRanges.h (+1-1) - (modified) llvm/include/llvm/Analysis/VectorUtils.h (+1-1) - (modified) llvm/lib/IR/DebugInfo.cpp (+1-1) - (modified) llvm/lib/Transforms/Utils/IRNormalizer.cpp (+1-1) - (modified) mlir/lib/Bindings/Python/IRAttributes.cpp (+1-1) - (modified) mlir/test/Dialect/Vector/vector-reduce-to-contract.mlir (+1-1) - (modified) mlir/tools/mlir-tblgen/EnumsGen.cpp (+1-1) ``diff diff --git a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp index 936a906651f16..e5deeb0e96158 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp @@ -152,7 +152,7 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { StringRef ExtraReference = ""; if (MainTypeEndLoc.isValid() && TypeRange.fullyContains(MainTypeEndLoc)) { // Each type introduced in a typedef can specify being a reference or - // pointer type seperately, so we need to sigure out if the new using-decl + // pointer type separately, so we need to sigure out if the new using-decl // needs to be to a reference or pointer as well. const SourceLocation Tok = utils::lexer::findPreviousAnyTokenKind( MatchedDecl->getLocation(), SM, LO, tok::TokenKind::star, diff --git a/clang/test/AST/HLSL/RootSignatures-AST.hlsl b/clang/test/AST/HLSL/RootSignatures-AST.hlsl index 27c40430c9d0a..0a933a76dd989 100644 --- a/clang/test/AST/HLSL/RootSignatures-AST.hlsl +++ b/clang/test/AST/HLSL/RootSignatures-AST.hlsl @@ -115,7 +115,7 @@ void same_rs_string_main() {} "DescriptorTable(Sampler(s0, numDescriptors = 4, space = 1))" // Ensure that when we define a different type root signature that it creates -// a seperate decl and identifier to reference +// a separate decl and identifier to reference // CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[DIFF_RS_DECL:__hlsl_rootsig_decl_\d*]] // CHECK-V1_0: version: 1.0, diff --git a/clang/test/Modules/safe_buffers_optout.cpp b/clang/test/Modules/safe_buffers_optout.cpp index 8c3d6a235d399..39020a48925e1 100644 --- a/clang/test/Modules/safe_buffers_optout.cpp +++ b/clang/test/Modules/safe_buffers_optout.cpp @@ -96,7 +96,7 @@ int textual(int *p) { // `safe_buffers_test_base`. (So the module dependencies form a DAG.) // No expected warnings from base.h, test_sub1, or test_sub2 because they are -// in seperate modules, and the explicit commands that builds them have no +// in separate modules, and the explicit commands that builds them have no // `-Wunsafe-buffer-usage`. int foo(int * p) { @@ -122,7 +122,7 @@ int foo(int * p) { // `safe_buffers_test_base`. (So the module dependencies form a DAG.) // No expected warnings from base.h, test_sub1, or test_sub2 because they are -// in seperate modules, and the explicit commands that builds them have no +// in separate modules, and the explicit commands that builds them have no // `-Wunsafe-buffer-usage`. int foo(int * p) { diff --git a/lldb/include/lldb/Target/CoreFileMemoryRanges.h b/lldb/include/lldb/Target/CoreFileMemoryRanges.h index 78d01acca324e..ef56a02ddee27 100644 --- a/lldb/include/lldb/Target/CoreFileMemoryRanges.h +++ b/lldb/include/lldb/Target/CoreFileMemoryRanges.h @@ -50,7 +50,7 @@ class CoreFileMemoryRanges CoreFileMemoryRange> { public: /// Finalize and merge all overlapping ranges in this collection. Ranges - /// will be seperated based on permissions. + /// will be separated based on permissions. Status FinalizeCoreFileSaveRanges(); }; } // namespace lldb_private diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h index 53ba1e8f77791..4ef2ace34856a 100644 --- a/llvm/include/llvm/Analysis/VectorUtils.h +++ b/llvm/include/llvm/Analysis/VectorUtils.h @@ -144,7 +144,7 @@ LLVM_ABI bool isTriviallyVectorizable(Intrinsic::ID ID); /// Note: There are intrinsics where implementing vectorization for the /// intrinsic is redundant, but we want to implement scalarization of the /// vector. To prevent the requirement that an intrinsic also implements -/// vectorization we provide this seperate function. +/// vectorization we provide this separate function. LLVM_ABI bool isTriviallyScalarizable(Intrinsic::ID ID, const TargetTransformInfo *TTI); diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 4e09f847627af..b3a557dc3a31d 10
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [mlir] A couple of grammar fixes (PR #144368)
https://github.com/GameRoMan updated https://github.com/llvm/llvm-project/pull/144368 >From 2b50682f230efa03c3b9a1f5c5e48e708734bf4d Mon Sep 17 00:00:00 2001 From: Roman A <121314722+gamero...@users.noreply.github.com> Date: Mon, 16 Jun 2025 15:59:01 +0100 Subject: [PATCH] A couple of grammar fixes --- clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp | 2 +- clang/test/AST/HLSL/RootSignatures-AST.hlsl | 2 +- clang/test/Modules/safe_buffers_optout.cpp | 4 ++-- lldb/include/lldb/Target/CoreFileMemoryRanges.h | 2 +- llvm/include/llvm/Analysis/VectorUtils.h | 2 +- llvm/lib/IR/DebugInfo.cpp| 2 +- llvm/lib/Transforms/Utils/IRNormalizer.cpp | 2 +- mlir/lib/Bindings/Python/IRAttributes.cpp| 2 +- mlir/test/Dialect/Vector/vector-reduce-to-contract.mlir | 2 +- mlir/tools/mlir-tblgen/EnumsGen.cpp | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp index 30fcba367db67..85dc9eb71ab7e 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp @@ -151,7 +151,7 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { StringRef ExtraReference = ""; if (MainTypeEndLoc.isValid() && TypeRange.fullyContains(MainTypeEndLoc)) { // Each type introduced in a typedef can specify being a reference or - // pointer type seperately, so we need to sigure out if the new using-decl + // pointer type separately, so we need to sigure out if the new using-decl // needs to be to a reference or pointer as well. const SourceLocation Tok = utils::lexer::findPreviousAnyTokenKind( MatchedDecl->getLocation(), SM, LO, tok::TokenKind::star, diff --git a/clang/test/AST/HLSL/RootSignatures-AST.hlsl b/clang/test/AST/HLSL/RootSignatures-AST.hlsl index c700174da764d..1a0f17757796c 100644 --- a/clang/test/AST/HLSL/RootSignatures-AST.hlsl +++ b/clang/test/AST/HLSL/RootSignatures-AST.hlsl @@ -61,7 +61,7 @@ void same_rs_string_main() {} "DescriptorTable(Sampler(s0, numDescriptors = 4, space = 1))" // Ensure that when we define a different type root signature that it creates -// a seperate decl and identifier to reference +// a separate decl and identifier to reference // CHECK: -HLSLRootSignatureDecl 0x{{.*}} {{.*}} implicit [[DIFF_RS_DECL:__hlsl_rootsig_decl_\d*]] // CHECK-SAME: RootElements{ diff --git a/clang/test/Modules/safe_buffers_optout.cpp b/clang/test/Modules/safe_buffers_optout.cpp index 8c3d6a235d399..39020a48925e1 100644 --- a/clang/test/Modules/safe_buffers_optout.cpp +++ b/clang/test/Modules/safe_buffers_optout.cpp @@ -96,7 +96,7 @@ int textual(int *p) { // `safe_buffers_test_base`. (So the module dependencies form a DAG.) // No expected warnings from base.h, test_sub1, or test_sub2 because they are -// in seperate modules, and the explicit commands that builds them have no +// in separate modules, and the explicit commands that builds them have no // `-Wunsafe-buffer-usage`. int foo(int * p) { @@ -122,7 +122,7 @@ int foo(int * p) { // `safe_buffers_test_base`. (So the module dependencies form a DAG.) // No expected warnings from base.h, test_sub1, or test_sub2 because they are -// in seperate modules, and the explicit commands that builds them have no +// in separate modules, and the explicit commands that builds them have no // `-Wunsafe-buffer-usage`. int foo(int * p) { diff --git a/lldb/include/lldb/Target/CoreFileMemoryRanges.h b/lldb/include/lldb/Target/CoreFileMemoryRanges.h index 78d01acca324e..ef56a02ddee27 100644 --- a/lldb/include/lldb/Target/CoreFileMemoryRanges.h +++ b/lldb/include/lldb/Target/CoreFileMemoryRanges.h @@ -50,7 +50,7 @@ class CoreFileMemoryRanges CoreFileMemoryRange> { public: /// Finalize and merge all overlapping ranges in this collection. Ranges - /// will be seperated based on permissions. + /// will be separated based on permissions. Status FinalizeCoreFileSaveRanges(); }; } // namespace lldb_private diff --git a/llvm/include/llvm/Analysis/VectorUtils.h b/llvm/include/llvm/Analysis/VectorUtils.h index 53ba1e8f77791..4ef2ace34856a 100644 --- a/llvm/include/llvm/Analysis/VectorUtils.h +++ b/llvm/include/llvm/Analysis/VectorUtils.h @@ -144,7 +144,7 @@ LLVM_ABI bool isTriviallyVectorizable(Intrinsic::ID ID); /// Note: There are intrinsics where implementing vectorization for the /// intrinsic is redundant, but we want to implement scalarization of the /// vector. To prevent the requirement that an intrinsic also implements -/// vectorization we provide this seperate function. +/// vectorization we provide this separate function. LLVM_ABI bool isTriviallyScalarizable(Intrinsic::ID ID,
[Lldb-commits] [lldb] [lldb] Update the String table offset based on the DWARF format (PR #147054)
https://github.com/HemangGadhavi updated https://github.com/llvm/llvm-project/pull/147054 >From 4ae4d0ab6ba44317e00dced8f247341ec9930c2c Mon Sep 17 00:00:00 2001 From: HemangGadhavi Date: Fri, 4 Jul 2025 09:28:30 -0400 Subject: [PATCH 1/2] [lldb] Updated the String table offset based on the DWARF format --- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index f216ab13e8936..daaa4eca6f198 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -1077,7 +1077,8 @@ uint32_t DWARFUnit::GetHeaderByteSize() const { return m_header.getSize(); } std::optional DWARFUnit::GetStringOffsetSectionItem(uint32_t index) const { - lldb::offset_t offset = GetStrOffsetsBase() + index * 4; + lldb::offset_t offset = + GetStrOffsetsBase() + index * m_header.getDwarfOffsetByteSize(); return m_dwarf.GetDWARFContext().getOrLoadStrOffsetsData().GetU32(&offset); } >From 6620ef231817e5247bd4141da9528fc961ccbfed Mon Sep 17 00:00:00 2001 From: HemangGadhavi Date: Fri, 11 Jul 2025 09:43:46 -0400 Subject: [PATCH 2/2] Added testcase --- .../Plugins/SymbolFile/DWARF/DWARFUnit.cpp| 3 +- .../SymbolFile/DWARF/DWARF64UnitTest.cpp | 97 +++ 2 files changed, 99 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index daaa4eca6f198..8b0fade86f177 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -1079,7 +1079,8 @@ std::optional DWARFUnit::GetStringOffsetSectionItem(uint32_t index) const { lldb::offset_t offset = GetStrOffsetsBase() + index * m_header.getDwarfOffsetByteSize(); - return m_dwarf.GetDWARFContext().getOrLoadStrOffsetsData().GetU32(&offset); + return m_dwarf.GetDWARFContext().getOrLoadStrOffsetsData().GetMaxU64( + &offset, m_header.getDwarfOffsetByteSize()); } llvm::Expected diff --git a/lldb/unittests/SymbolFile/DWARF/DWARF64UnitTest.cpp b/lldb/unittests/SymbolFile/DWARF/DWARF64UnitTest.cpp index 2303f68674e4c..de584d2b1433c 100644 --- a/lldb/unittests/SymbolFile/DWARF/DWARF64UnitTest.cpp +++ b/lldb/unittests/SymbolFile/DWARF/DWARF64UnitTest.cpp @@ -84,3 +84,100 @@ TEST(DWARF64UnitTest, DWARF64DebugInfoAndCU) { ASSERT_TRUE(declaration.IsValid()); ASSERT_EQ(declaration.Tag(), DW_TAG_subprogram); } + +TEST(DWARF64UnitTest, DWARF5StrTable) { + const char *yamldata = R"( +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data:ELFDATA2LSB + Type:ET_EXEC + Machine: EM_PPC64 +DWARF: + debug_str: +- 'clang version 18.1.8 (clang-18.1.8-1)' +- 'main.c' +- 'foo' +- 'main' + debug_abbrev: +- Table: +- Code:0x1 + Tag: DW_TAG_compile_unit + Children:DW_CHILDREN_yes + Attributes: +- Attribute: DW_AT_producer + Form:DW_FORM_strx1 +- Attribute: DW_AT_language + Form:DW_FORM_data2 +- Attribute: DW_AT_name + Form:DW_FORM_strx1 +- Attribute: DW_AT_str_offsets_base + Form:DW_FORM_sec_offset +- Code:0x2 + Tag: DW_TAG_subprogram + Children:DW_CHILDREN_no + Attributes: +- Attribute: DW_AT_name + Form:DW_FORM_strx1 + debug_info: +- Format: DWARF64 + Version: 0x05 + UnitType:DW_UT_compile + AbbrOffset: 0x0 + AddrSize:0x08 + Entries: +- AbbrCode:0x1 + Values: +- Value: 0x0 +- Value: 0x04 +- Value: 0x1 +- Value: 0x0010 +- AbbrCode:0x2 + Values: +- Value: 0x2 +- AbbrCode:0x2 + Values: +- Value: 0x3 +- AbbrCode: 0x0 + + debug_str_offsets: +- Format: DWARF64 + Version: "0x05" + Offsets: + - 0x + - 0x0026 + - 0x002d + - 0x0031 +)"; + + YAMLModuleTester t(yamldata); + auto *symbol_file = + llvm::cast(t.GetModule()->GetSymbolFile()); + DWARFUnit *unit = symbol_file->DebugInfo().GetUnitAtIndex(0); + ASSERT_TRUE(unit); + ASSERT_EQ(unit->GetFormParams().Format, DwarfFormat::DWARF64); + ASSERT_EQ(unit->GetVersion(), 5); + ASSERT_EQ(unit->GetAddressByteSize(), 8); + + DWARFFormValue form_value; + const DWARFDebugInfoEntry *cu_entry = unit->DIE().GetDIE(); + ASSERT_EQ(cu_entry->Tag(), DW_TAG_compile_unit); + ASSERT_E
[Lldb-commits] [lldb] [lldb] Document the SBDebugger public interface (PR #147621)
jimingham wrote: > I don't want to hold this up. Made some suggestions on how I would condense > the descriptions. I stopped after I realized I'd be rewriting most of these. > I also haven't checked how would the formatted version of this look like. > I'll leave it up to you whether you want to apply them or not. > > I have a feeling that when the users ask for documentation, they're ask for > more high-level things like "what is a CompileUnit" or "what's the difference > between a load and a file address", and not "what does Debugger::Create do" I agree, we need more conceptual documentation on the concepts the SB API's expose. But I think that would be better done in a unified document (either part of the Python Reference or another Document) rather than individual high-level comments at the top of each class. That way when something requires you to explain a couple of classes in concert, you don't have to try to figure out which class to put that information in. https://github.com/llvm/llvm-project/pull/147621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Update JSONTransport to use MainLoop for reading. (PR #148300)
@@ -949,75 +952,76 @@ static std::optional getArgumentsIfRequest(const Message &pm, return args; } -llvm::Error DAP::Loop() { - // Can't use \a std::future because it doesn't compile on - // Windows. - std::future queue_reader = - std::async(std::launch::async, [&]() -> lldb::SBError { -llvm::set_thread_name(transport.GetClientName() + ".transport_handler"); -auto cleanup = llvm::make_scope_exit([&]() { - // Ensure we're marked as disconnecting when the reader exits. - disconnecting = true; - m_queue_cv.notify_all(); -}); - -while (!disconnecting) { - llvm::Expected next = - transport.Read(std::chrono::seconds(1)); - if (next.errorIsA()) { -consumeError(next.takeError()); -break; - } +Status DAP::TransportHandler() { ashgti wrote: We ran into issues when building with MSVC 2019 and using an std::future (on line 1023), see #137388 https://github.com/llvm/llvm-project/pull/148300 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 3c4c2fa - [lldb] Expose debuggers and target as resources through MCP (#148075)
Author: Jonas Devlieghere Date: 2025-07-11T15:49:27-07:00 New Revision: 3c4c2fada26f479be7c2f9744f5b7364f7612446 URL: https://github.com/llvm/llvm-project/commit/3c4c2fada26f479be7c2f9744f5b7364f7612446 DIFF: https://github.com/llvm/llvm-project/commit/3c4c2fada26f479be7c2f9744f5b7364f7612446.diff LOG: [lldb] Expose debuggers and target as resources through MCP (#148075) Expose debuggers and target as resources through MCP. This has two advantages: 1. Enables returning data in a structured way. Although tools can return structured data with the latest revision of the protocol, we might not be able to update before the majority of clients has adopted it. 2. Enables the user to specify a resource themselves, rather than letting the model guess which debugger instance it should use. This PR exposes a resource for debuggers and targets. The following URI returns information about a given debugger instance: ``` lldb://debugger/ ``` For example: ``` { uri: "lldb://debugger/0" mimeType: "application/json" text: "{"debugger_id":0,"num_targets":2}" } ``` The following URI returns information about a given target: ``` lldb://debugger//target/ ``` For example: ``` { uri: "lldb://debugger/0/target/0" mimeType: "application/json" text: "{"arch":"arm64-apple-macosx26.0.0","debugger_id":0,"path":"/Users/jonas/llvm/build-ra/bin/count","target_id":0}" } ``` Added: lldb/source/Plugins/Protocol/MCP/Resource.cpp lldb/source/Plugins/Protocol/MCP/Resource.h Modified: lldb/include/lldb/Core/Debugger.h lldb/include/lldb/Target/Target.h lldb/source/Plugins/Protocol/MCP/CMakeLists.txt lldb/source/Plugins/Protocol/MCP/MCPError.cpp lldb/source/Plugins/Protocol/MCP/MCPError.h lldb/source/Plugins/Protocol/MCP/Protocol.cpp lldb/source/Plugins/Protocol/MCP/Protocol.h lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.h lldb/source/Plugins/Protocol/MCP/Tool.cpp lldb/source/Plugins/Protocol/MCP/Tool.h lldb/unittests/Protocol/ProtocolMCPServerTest.cpp lldb/unittests/Protocol/ProtocolMCPTest.cpp Removed: diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index 504f936fe317a..250ad64b76d9a 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -367,7 +367,7 @@ class Debugger : public std::enable_shared_from_this, bool GetNotifyVoid() const; - const std::string &GetInstanceName() { return m_instance_name; } + const std::string &GetInstanceName() const { return m_instance_name; } bool GetShowInlineDiagnostics() const; diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index 0d4e11b65339e..a1d881375b08b 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -1093,7 +1093,7 @@ class Target : public std::enable_shared_from_this, Architecture *GetArchitecturePlugin() const { return m_arch.GetPlugin(); } - Debugger &GetDebugger() { return m_debugger; } + Debugger &GetDebugger() const { return m_debugger; } size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len, Status &error); diff --git a/lldb/source/Plugins/Protocol/MCP/CMakeLists.txt b/lldb/source/Plugins/Protocol/MCP/CMakeLists.txt index db31a7a69cb33..e104fb527e57a 100644 --- a/lldb/source/Plugins/Protocol/MCP/CMakeLists.txt +++ b/lldb/source/Plugins/Protocol/MCP/CMakeLists.txt @@ -2,6 +2,7 @@ add_lldb_library(lldbPluginProtocolServerMCP PLUGIN MCPError.cpp Protocol.cpp ProtocolServerMCP.cpp + Resource.cpp Tool.cpp LINK_COMPONENTS diff --git a/lldb/source/Plugins/Protocol/MCP/MCPError.cpp b/lldb/source/Plugins/Protocol/MCP/MCPError.cpp index 5ed850066b659..659b53a14fe23 100644 --- a/lldb/source/Plugins/Protocol/MCP/MCPError.cpp +++ b/lldb/source/Plugins/Protocol/MCP/MCPError.cpp @@ -14,6 +14,7 @@ namespace lldb_private::mcp { char MCPError::ID; +char UnsupportedURI::ID; MCPError::MCPError(std::string message, int64_t error_code) : m_message(message), m_error_code(error_code) {} @@ -31,4 +32,14 @@ protocol::Error MCPError::toProtcolError() const { return error; } +UnsupportedURI::UnsupportedURI(std::string uri) : m_uri(uri) {} + +void UnsupportedURI::log(llvm::raw_ostream &OS) const { + OS << "unsupported uri: " << m_uri; +} + +std::error_code UnsupportedURI::convertToErrorCode() const { + return llvm::inconvertibleErrorCode(); +} + } // namespace lldb_private::mcp diff --git a/lldb/source/Plugins/Protocol/MCP/MCPError.h b/lldb/source/Plugins/Protocol/MCP/MCPError.h index 2a76a7b087e20..f4db13d6deade 100644 --- a/lldb/source/Plugins/Protocol/MCP/MCPError.h +++ b/lldb/source/Plugins/Protocol/MCP/MCPError.h @@ -8,6 +8,7 @@ #include "Protocol.h" #include "llvm/Support/Error.h" +#include "l
[Lldb-commits] [lldb] [lldb] Expose debuggers and target as resources through MCP (PR #148075)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/148075 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Update JSONTransport to use MainLoop for reading. (PR #148300)
https://github.com/ashgti edited https://github.com/llvm/llvm-project/pull/148300 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [LLDB] Switch to using DIL as default implementation for 'frame var'. (PR #147887)
https://github.com/cmtice updated https://github.com/llvm/llvm-project/pull/147887 >From 3dbe09deb36a44eb056fa2d3d7dacd341e391697 Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Wed, 9 Jul 2025 20:42:03 -0700 Subject: [PATCH 1/3] [LLDB] Switch to using DIL as default implementation for 'frame var'. --- lldb/source/Target/TargetProperties.td | 4 ++-- llvm/docs/ReleaseNotes.md | 8 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td index 4aa9e046d6077..656503bb8d228 100644 --- a/lldb/source/Target/TargetProperties.td +++ b/lldb/source/Target/TargetProperties.td @@ -5,8 +5,8 @@ let Definition = "target_experimental" in { Global, DefaultTrue, Desc<"If true, inject local variables explicitly into the expression text. This will fix symbol resolution when there are name collisions between ivars and local variables. But it can make expressions run much more slowly.">; def UseDIL : Property<"use-DIL", "Boolean">, -Global, DefaultFalse, -Desc<"If true, use the alternative DIL implementation for frame variable evaluation.">; +Global, DefaultTrue, +Desc<"If true, use the DIL implementation for frame variable evaluation.">; } let Definition = "target" in { diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md index daf822388a2ff..5d2146b7f2f75 100644 --- a/llvm/docs/ReleaseNotes.md +++ b/llvm/docs/ReleaseNotes.md @@ -306,6 +306,14 @@ Changes to LLDB stop reason = SIGSEGV: sent by tkill system call (sender pid=649752, uid=2667987) ``` * ELF Cores can now have their siginfo structures inspected using `thread siginfo`. +* LLDB now uses + [DIL](https://discourse.llvm.org/t/rfc-data-inspection-language/69893) as the + default implementation for 'frame variable'. This should not change the + behavior of 'frame variable' at all, at this time. To revert to using the + old implementation use + ``` + settings set target.experimental.use-DIL false + ``` ### Changes to lldb-dap >From c3d1940ddb086bda4dffe03737754a57f62a5507 Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Fri, 11 Jul 2025 16:35:24 -0700 Subject: [PATCH 2/3] Small fixes: - Remove not-always-valid field-name check when evaluating field members. - Fix unexpected passes in TestDAP_evaluate (test owner said it was ok). - Add more anonymous namespace tests. --- lldb/source/ValueObject/DILEval.cpp | 2 +- .../QualifiedId/TestFrameVarDILQualifiedId.py | 14 + .../frame/var-dil/basics/QualifiedId/main.cpp | 21 ++- .../lldb-dap/evaluate/TestDAP_evaluate.py | 6 +++--- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/lldb/source/ValueObject/DILEval.cpp b/lldb/source/ValueObject/DILEval.cpp index fd3f9f8724608..6f28434c646cd 100644 --- a/lldb/source/ValueObject/DILEval.cpp +++ b/lldb/source/ValueObject/DILEval.cpp @@ -303,7 +303,7 @@ Interpreter::Visit(const MemberOfNode *node) { } } - if (field_obj && field_obj->GetName() == node->GetFieldName()) { + if (field_obj) { if (m_use_dynamic != lldb::eNoDynamicValues) { lldb::ValueObjectSP dynamic_val_sp = field_obj->GetDynamicValue(m_use_dynamic); diff --git a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py index b2ce9602e6a50..8c009aa182d07 100644 --- a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py +++ b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py @@ -29,3 +29,17 @@ def test_frame_var(self): self.expect_var_path("ns::i", value="1") self.expect_var_path("::ns::ns::i", value="2") self.expect_var_path("ns::ns::i", value="2") + +self.expect_var_path("foo", value="1") +self.expect_var_path("::(anonymous namespace)::foo", value="13") +self.expect_var_path("(anonymous namespace)::foo", value="13") +self.expect_var_path("ns1::(anonymous namespace)::foo", value="5") +self.expect_var_path( +"(anonymous namespace)::ns2::(anonymous namespace)::foo", +value="7", +) +self.expect_var_path("::ns1::(anonymous namespace)::foo", value="5") +self.expect_var_path( +"::(anonymous namespace)::ns2::(anonymous namespace)::foo", +value="7", +) diff --git a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp index 8a5c47a6f364c..8c7e01a6f40af 100644 --- a/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp +++ b/lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp @@ -10,7 +10,26 @@ int i = 2; } // namespace ns +namespace { +int foo = 13; +} + +namespace ns1 { +namespace { +
[Lldb-commits] [lldb] When running OS Plugins from dSYM's, make sure start state is correct (PR #146441)
https://github.com/jimingham updated https://github.com/llvm/llvm-project/pull/146441 >From 8a8e86d72e9d130f513d91fbf75d7631077bf930 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Thu, 12 Jun 2025 11:16:36 -0700 Subject: [PATCH 1/4] When running OS Plugins from dSYM's, make sure the OS plugin callbacks see the correct process state. --- lldb/include/lldb/Host/HostThread.h | 6 + lldb/include/lldb/Target/Process.h| 2 + lldb/source/Target/Process.cpp| 29 ++-- lldb/source/Target/StackFrameList.cpp | 2 +- .../python_os_plugin/operating_system.py | 4 + .../os_plugin_in_dsym/Makefile| 4 + .../os_plugin_in_dsym/TestOSIndSYM.py | 145 ++ .../python_os_plugin/os_plugin_in_dsym/main.c | 10 ++ .../os_plugin_in_dsym/operating_system.py | 78 ++ 9 files changed, 269 insertions(+), 11 deletions(-) create mode 100644 lldb/test/API/functionalities/plugins/python_os_plugin/os_plugin_in_dsym/Makefile create mode 100644 lldb/test/API/functionalities/plugins/python_os_plugin/os_plugin_in_dsym/TestOSIndSYM.py create mode 100644 lldb/test/API/functionalities/plugins/python_os_plugin/os_plugin_in_dsym/main.c create mode 100644 lldb/test/API/functionalities/plugins/python_os_plugin/os_plugin_in_dsym/operating_system.py diff --git a/lldb/include/lldb/Host/HostThread.h b/lldb/include/lldb/Host/HostThread.h index d3477e115e2d8..d8b3610210aac 100644 --- a/lldb/include/lldb/Host/HostThread.h +++ b/lldb/include/lldb/Host/HostThread.h @@ -10,6 +10,7 @@ #define LLDB_HOST_HOSTTHREAD_H #include "lldb/Host/HostNativeThreadForward.h" +#include "lldb/Host/HostNativeThreadBase.h" #include "lldb/Utility/Status.h" #include "lldb/lldb-types.h" @@ -42,6 +43,11 @@ class HostThread { lldb::thread_result_t GetResult() const; bool EqualsThread(lldb::thread_t thread) const; + + bool HasThread() const { +if (!m_native_thread) + return false; +return m_native_thread->GetSystemHandle() != LLDB_INVALID_HOST_THREAD ; } private: std::shared_ptr m_native_thread; diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index a8892e9c43225..1329abba9b17b 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -2546,6 +2546,8 @@ void PruneThreadPlans(); ProcessRunLock &GetRunLock(); bool CurrentThreadIsPrivateStateThread(); + + bool CurrentThreadPosesAsPrivateStateThread(); virtual Status SendEventData(const char *data) { return Status::FromErrorString( diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index bba1230c79920..9cdef7ef524fc 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -1271,7 +1271,7 @@ uint32_t Process::AssignIndexIDToThread(uint64_t thread_id) { } StateType Process::GetState() { - if (CurrentThreadIsPrivateStateThread()) + if (CurrentThreadPosesAsPrivateStateThread()) return m_private_state.GetValue(); else return m_public_state.GetValue(); @@ -3144,16 +3144,17 @@ void Process::CompleteAttach() { } } - if (!m_os_up) { -LoadOperatingSystemPlugin(false); -if (m_os_up) { - // Somebody might have gotten threads before now, but we need to force the - // update after we've loaded the OperatingSystem plugin or it won't get a - // chance to process the threads. - m_thread_list.Clear(); - UpdateThreadListIfNeeded(); -} + if (!m_os_up) + LoadOperatingSystemPlugin(false); + + if (m_os_up) { +// Somebody might have gotten threads before now, but we need to force the +// update after we've loaded the OperatingSystem plugin or it won't get a +// chance to process the threads. +m_thread_list.Clear(); +UpdateThreadListIfNeeded(); } + // Figure out which one is the executable, and set that in our target: ModuleSP new_executable_module_sp; for (ModuleSP module_sp : GetTarget().GetImages().Modules()) { @@ -5856,6 +5857,14 @@ bool Process::CurrentThreadIsPrivateStateThread() return m_private_state_thread.EqualsThread(Host::GetCurrentThread()); } +bool Process::CurrentThreadPosesAsPrivateStateThread() +{ + // If we haven't started up the private state thread yet, then whatever thread + // is fetching this event should be temporarily the private state thread. + if (!m_private_state_thread.HasThread()) +return true; + return m_private_state_thread.EqualsThread(Host::GetCurrentThread()); +} void Process::Flush() { m_thread_list.Flush(); diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp index 9c6208e9e0a65..16cd2548c2784 100644 --- a/lldb/source/Target/StackFrameList.cpp +++ b/lldb/source/Target/StackFrameList.cpp @@ -723,7 +723,7 @@ void StackFrameList::SelectMostRelevantFrame() { // Don't call into the frame recognizers on the private state thread as // they can cause code
[Lldb-commits] [lldb] When running OS Plugins from dSYM's, make sure start state is correct (PR #146441)
@@ -3144,16 +3144,17 @@ void Process::CompleteAttach() { } } - if (!m_os_up) { + if (!m_os_up) LoadOperatingSystemPlugin(false); -if (m_os_up) { - // Somebody might have gotten threads before now, but we need to force the - // update after we've loaded the OperatingSystem plugin or it won't get a - // chance to process the threads. - m_thread_list.Clear(); - UpdateThreadListIfNeeded(); -} + + if (m_os_up) { jimingham wrote: I added a comment to make this clear. https://github.com/llvm/llvm-project/pull/146441 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][WIP] dump riscv opcode bytes as blocks of 2/4 bytes (PR #148105)
https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/148105 >From 74995e8f1a982a82bafaa150fb407187fa4b95e4 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Thu, 10 Jul 2025 22:31:54 -0700 Subject: [PATCH 1/5] [lldb][WIP] dump riscv opcode bytes as blocks of 2/4 bytes Part of the changes by Ted Woodward et al in https://github.com/llvm/llvm-project/pull/145793 to change the riscv disassemble --bytes mode output to match llvm-objdump prints the instruction bytes as sequences of 2/4 bytes for instructions that may be 2/4/6/8/etc bytes long, instead of printing them as an array of UInt8's like x86 as is done today. This PR is doing it by adding a special Dump method to Opcode, but I believe the correct way to accomplish this is to have an Opcode::Type that implies this formatting, and not adding a DumpRISCV() method. I put up this PR to show what I meant by this. The unit test I added fails on the 64-bit example instruction, MCInst seems to be decoding this as a 2-byte instruction. I'm not sure if I copied this hypothetical instruction from the original PR incorrectly, or if they might be working on a downstream branch that can decode this, it seems to work in their test cases. --- lldb/include/lldb/Core/Opcode.h | 39 ++--- lldb/source/Core/Opcode.cpp | 38 +++- .../Disassembler/LLVMC/DisassemblerLLVMC.cpp | 58 +++ lldb/source/Utility/ArchSpec.cpp | 4 +- .../RISCV/TestMCDisasmInstanceRISCV.cpp | 46 +++ 5 files changed, 152 insertions(+), 33 deletions(-) diff --git a/lldb/include/lldb/Core/Opcode.h b/lldb/include/lldb/Core/Opcode.h index f72f2687b54fe..91af15c62e6ab 100644 --- a/lldb/include/lldb/Core/Opcode.h +++ b/lldb/include/lldb/Core/Opcode.h @@ -32,7 +32,10 @@ class Opcode { eTypeInvalid, eType8, eType16, -eType16_2, // a 32-bit Thumb instruction, made up of two words +eType16_2,// a 32-bit Thumb instruction, made up of two words +eType16_32Tuples, // RISC-V that can have 2, 4, 6, 8 etc byte long + // instructions which will be printed in combinations of + // 16 & 32-bit words. eType32, eType64, eTypeBytes @@ -60,9 +63,9 @@ class Opcode { m_data.inst64 = inst; } - Opcode(uint8_t *bytes, size_t length) - : m_byte_order(lldb::eByteOrderInvalid) { -SetOpcodeBytes(bytes, length); + Opcode(uint8_t *bytes, size_t length, Opcode::Type type, + lldb::ByteOrder order) { +DoSetOpcodeBytes(bytes, length, type, order); } void Clear() { @@ -82,6 +85,8 @@ class Opcode { break; case Opcode::eType16_2: break; +case Opcode::eType16_32Tuples: + break; case Opcode::eType32: break; case Opcode::eType64: @@ -103,6 +108,8 @@ class Opcode { : m_data.inst16; case Opcode::eType16_2: break; +case Opcode::eType16_32Tuples: + break; case Opcode::eType32: break; case Opcode::eType64: @@ -122,6 +129,8 @@ class Opcode { case Opcode::eType16: return GetEndianSwap() ? llvm::byteswap(m_data.inst16) : m_data.inst16; +case Opcode::eType16_32Tuples: + break; case Opcode::eType16_2: // passthrough case Opcode::eType32: return GetEndianSwap() ? llvm::byteswap(m_data.inst32) @@ -143,6 +152,8 @@ class Opcode { case Opcode::eType16: return GetEndianSwap() ? llvm::byteswap(m_data.inst16) : m_data.inst16; +case Opcode::eType16_32Tuples: + break; case Opcode::eType16_2: // passthrough case Opcode::eType32: return GetEndianSwap() ? llvm::byteswap(m_data.inst32) @@ -186,20 +197,30 @@ class Opcode { m_byte_order = order; } + void SetOpcode16_32TupleBytes(const void *bytes, size_t length, +lldb::ByteOrder order) { +DoSetOpcodeBytes(bytes, length, eType16_32Tuples, order); + } + void SetOpcodeBytes(const void *bytes, size_t length) { +DoSetOpcodeBytes(bytes, length, eTypeBytes, lldb::eByteOrderInvalid); + } + + void DoSetOpcodeBytes(const void *bytes, size_t length, Opcode::Type type, +lldb::ByteOrder order) { if (bytes != nullptr && length > 0) { - m_type = eTypeBytes; + m_type = type; m_data.inst.length = length; assert(length < sizeof(m_data.inst.bytes)); memcpy(m_data.inst.bytes, bytes, length); - m_byte_order = lldb::eByteOrderInvalid; + m_byte_order = order; } else { m_type = eTypeInvalid; m_data.inst.length = 0; } } - int Dump(Stream *s, uint32_t min_byte_width); + int Dump(Stream *s, uint32_t min_byte_width) const; const void *GetOpcodeBytes() const { return ((m_type == Opcode::eTypeBytes) ? m_data.inst.bytes : nullptr); @@ -213,6 +234,8 @@ class Opcode { retur
[Lldb-commits] [lldb] [llvm] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)
jasonmolenda wrote: nb: I didn't little-endian swap the bytes for the 48-bit and 64-bit instructions properly in my unit test in https://github.com/llvm/llvm-project/pull/148105 , which is why those tests were failing. Fixed. https://github.com/llvm/llvm-project/pull/145793 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][WIP] dump riscv opcode bytes as blocks of 2/4 bytes (PR #148105)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- lldb/include/lldb/Core/Opcode.h lldb/source/Core/Opcode.cpp lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp lldb/source/Utility/ArchSpec.cpp lldb/unittests/Disassembler/RISCV/TestMCDisasmInstanceRISCV.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/unittests/Disassembler/RISCV/TestMCDisasmInstanceRISCV.cpp b/lldb/unittests/Disassembler/RISCV/TestMCDisasmInstanceRISCV.cpp index 781c33f22..b3a4eaf25 100644 --- a/lldb/unittests/Disassembler/RISCV/TestMCDisasmInstanceRISCV.cpp +++ b/lldb/unittests/Disassembler/RISCV/TestMCDisasmInstanceRISCV.cpp @@ -123,7 +123,8 @@ TEST_F(TestMCDisasmInstanceRISCV, TestOpcodeBytePrinter) { "021f 1000" }; // clang-format on - const unsigned num_of_expected_outputs = sizeof(expected_outputs) / sizeof(char *); + const unsigned num_of_expected_outputs = + sizeof(expected_outputs) / sizeof(char *); EXPECT_EQ(num_of_instructions, num_of_expected_outputs); `` https://github.com/llvm/llvm-project/pull/148105 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][WIP] dump riscv opcode bytes as blocks of 2/4 bytes (PR #148105)
jasonmolenda wrote: I didn't little-endian swap the bytes for the 48-bit and 64-bit instructions properly in my unit test, which is why those two were failing. Fixed now. https://github.com/llvm/llvm-project/pull/148105 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][WIP] dump riscv opcode bytes as blocks of 2/4 bytes (PR #148105)
https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/148105 >From 74995e8f1a982a82bafaa150fb407187fa4b95e4 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Thu, 10 Jul 2025 22:31:54 -0700 Subject: [PATCH 1/6] [lldb][WIP] dump riscv opcode bytes as blocks of 2/4 bytes Part of the changes by Ted Woodward et al in https://github.com/llvm/llvm-project/pull/145793 to change the riscv disassemble --bytes mode output to match llvm-objdump prints the instruction bytes as sequences of 2/4 bytes for instructions that may be 2/4/6/8/etc bytes long, instead of printing them as an array of UInt8's like x86 as is done today. This PR is doing it by adding a special Dump method to Opcode, but I believe the correct way to accomplish this is to have an Opcode::Type that implies this formatting, and not adding a DumpRISCV() method. I put up this PR to show what I meant by this. The unit test I added fails on the 64-bit example instruction, MCInst seems to be decoding this as a 2-byte instruction. I'm not sure if I copied this hypothetical instruction from the original PR incorrectly, or if they might be working on a downstream branch that can decode this, it seems to work in their test cases. --- lldb/include/lldb/Core/Opcode.h | 39 ++--- lldb/source/Core/Opcode.cpp | 38 +++- .../Disassembler/LLVMC/DisassemblerLLVMC.cpp | 58 +++ lldb/source/Utility/ArchSpec.cpp | 4 +- .../RISCV/TestMCDisasmInstanceRISCV.cpp | 46 +++ 5 files changed, 152 insertions(+), 33 deletions(-) diff --git a/lldb/include/lldb/Core/Opcode.h b/lldb/include/lldb/Core/Opcode.h index f72f2687b54fe..91af15c62e6ab 100644 --- a/lldb/include/lldb/Core/Opcode.h +++ b/lldb/include/lldb/Core/Opcode.h @@ -32,7 +32,10 @@ class Opcode { eTypeInvalid, eType8, eType16, -eType16_2, // a 32-bit Thumb instruction, made up of two words +eType16_2,// a 32-bit Thumb instruction, made up of two words +eType16_32Tuples, // RISC-V that can have 2, 4, 6, 8 etc byte long + // instructions which will be printed in combinations of + // 16 & 32-bit words. eType32, eType64, eTypeBytes @@ -60,9 +63,9 @@ class Opcode { m_data.inst64 = inst; } - Opcode(uint8_t *bytes, size_t length) - : m_byte_order(lldb::eByteOrderInvalid) { -SetOpcodeBytes(bytes, length); + Opcode(uint8_t *bytes, size_t length, Opcode::Type type, + lldb::ByteOrder order) { +DoSetOpcodeBytes(bytes, length, type, order); } void Clear() { @@ -82,6 +85,8 @@ class Opcode { break; case Opcode::eType16_2: break; +case Opcode::eType16_32Tuples: + break; case Opcode::eType32: break; case Opcode::eType64: @@ -103,6 +108,8 @@ class Opcode { : m_data.inst16; case Opcode::eType16_2: break; +case Opcode::eType16_32Tuples: + break; case Opcode::eType32: break; case Opcode::eType64: @@ -122,6 +129,8 @@ class Opcode { case Opcode::eType16: return GetEndianSwap() ? llvm::byteswap(m_data.inst16) : m_data.inst16; +case Opcode::eType16_32Tuples: + break; case Opcode::eType16_2: // passthrough case Opcode::eType32: return GetEndianSwap() ? llvm::byteswap(m_data.inst32) @@ -143,6 +152,8 @@ class Opcode { case Opcode::eType16: return GetEndianSwap() ? llvm::byteswap(m_data.inst16) : m_data.inst16; +case Opcode::eType16_32Tuples: + break; case Opcode::eType16_2: // passthrough case Opcode::eType32: return GetEndianSwap() ? llvm::byteswap(m_data.inst32) @@ -186,20 +197,30 @@ class Opcode { m_byte_order = order; } + void SetOpcode16_32TupleBytes(const void *bytes, size_t length, +lldb::ByteOrder order) { +DoSetOpcodeBytes(bytes, length, eType16_32Tuples, order); + } + void SetOpcodeBytes(const void *bytes, size_t length) { +DoSetOpcodeBytes(bytes, length, eTypeBytes, lldb::eByteOrderInvalid); + } + + void DoSetOpcodeBytes(const void *bytes, size_t length, Opcode::Type type, +lldb::ByteOrder order) { if (bytes != nullptr && length > 0) { - m_type = eTypeBytes; + m_type = type; m_data.inst.length = length; assert(length < sizeof(m_data.inst.bytes)); memcpy(m_data.inst.bytes, bytes, length); - m_byte_order = lldb::eByteOrderInvalid; + m_byte_order = order; } else { m_type = eTypeInvalid; m_data.inst.length = 0; } } - int Dump(Stream *s, uint32_t min_byte_width); + int Dump(Stream *s, uint32_t min_byte_width) const; const void *GetOpcodeBytes() const { return ((m_type == Opcode::eTypeBytes) ? m_data.inst.bytes : nullptr); @@ -213,6 +234,8 @@ class Opcode { retur
[Lldb-commits] [lldb] [lldb] Expose debuggers and target as resources through MCP (PR #148075)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/148075 >From 74cc4598eccdb43b3a36e3276d16de84a901f095 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 10 Jul 2025 15:51:44 -0700 Subject: [PATCH 1/2] [lldb] Expose debuggers and target as resources through MCP Expose debuggers and target as resources through MCP. This has two advantages: 1. Enables returning data in a structured way. Although tools can return structured data with the latest revision of the protocol, we might not be able to update before the majority of clients has adopted it. 2. Enables the user to specify a resource themselves, rather than letting the model guess which debugger instance it should use. This PR exposes a resource for debuggers and targets. The following URI returns information about a given debugger instance: ``` lldb://debugger/ ``` For example: ``` { uri: "lldb://debugger/0" mimeType: "application/json" text: "{"debugger_id":0,"num_targets":2}" } ``` The following URI returns information about a given target: ``` lldb://debugger//target/ ``` For example: ``` { uri: "lldb://debugger/0/target/0" mimeType: "application/json" text: "{"arch":"arm64-apple-macosx26.0.0","debugger_id":0,"path":"/Users/jonas/llvm/build-ra/bin/count","target_id":0}" } ``` --- .../Plugins/Protocol/MCP/CMakeLists.txt | 1 + lldb/source/Plugins/Protocol/MCP/MCPError.cpp | 11 ++ lldb/source/Plugins/Protocol/MCP/MCPError.h | 14 ++ lldb/source/Plugins/Protocol/MCP/Protocol.cpp | 54 +- lldb/source/Plugins/Protocol/MCP/Protocol.h | 60 ++- .../Protocol/MCP/ProtocolServerMCP.cpp| 82 - .../Plugins/Protocol/MCP/ProtocolServerMCP.h | 10 ++ lldb/source/Plugins/Protocol/MCP/Resource.cpp | 166 ++ lldb/source/Plugins/Protocol/MCP/Resource.h | 51 ++ lldb/source/Plugins/Protocol/MCP/Tool.cpp | 47 - lldb/source/Plugins/Protocol/MCP/Tool.h | 9 - .../Protocol/ProtocolMCPServerTest.cpp| 41 - lldb/unittests/Protocol/ProtocolMCPTest.cpp | 98 +++ 13 files changed, 581 insertions(+), 63 deletions(-) create mode 100644 lldb/source/Plugins/Protocol/MCP/Resource.cpp create mode 100644 lldb/source/Plugins/Protocol/MCP/Resource.h diff --git a/lldb/source/Plugins/Protocol/MCP/CMakeLists.txt b/lldb/source/Plugins/Protocol/MCP/CMakeLists.txt index db31a7a69cb33..e104fb527e57a 100644 --- a/lldb/source/Plugins/Protocol/MCP/CMakeLists.txt +++ b/lldb/source/Plugins/Protocol/MCP/CMakeLists.txt @@ -2,6 +2,7 @@ add_lldb_library(lldbPluginProtocolServerMCP PLUGIN MCPError.cpp Protocol.cpp ProtocolServerMCP.cpp + Resource.cpp Tool.cpp LINK_COMPONENTS diff --git a/lldb/source/Plugins/Protocol/MCP/MCPError.cpp b/lldb/source/Plugins/Protocol/MCP/MCPError.cpp index 5ed850066b659..659b53a14fe23 100644 --- a/lldb/source/Plugins/Protocol/MCP/MCPError.cpp +++ b/lldb/source/Plugins/Protocol/MCP/MCPError.cpp @@ -14,6 +14,7 @@ namespace lldb_private::mcp { char MCPError::ID; +char UnsupportedURI::ID; MCPError::MCPError(std::string message, int64_t error_code) : m_message(message), m_error_code(error_code) {} @@ -31,4 +32,14 @@ protocol::Error MCPError::toProtcolError() const { return error; } +UnsupportedURI::UnsupportedURI(std::string uri) : m_uri(uri) {} + +void UnsupportedURI::log(llvm::raw_ostream &OS) const { + OS << "unsupported uri: " << m_uri; +} + +std::error_code UnsupportedURI::convertToErrorCode() const { + return llvm::inconvertibleErrorCode(); +} + } // namespace lldb_private::mcp diff --git a/lldb/source/Plugins/Protocol/MCP/MCPError.h b/lldb/source/Plugins/Protocol/MCP/MCPError.h index 2a76a7b087e20..05a047ec881a9 100644 --- a/lldb/source/Plugins/Protocol/MCP/MCPError.h +++ b/lldb/source/Plugins/Protocol/MCP/MCPError.h @@ -8,6 +8,7 @@ #include "Protocol.h" #include "llvm/Support/Error.h" +#include "llvm/Support/FormatVariadic.h" #include namespace lldb_private::mcp { @@ -30,4 +31,17 @@ class MCPError : public llvm::ErrorInfo { int64_t m_error_code; }; +class UnsupportedURI : public llvm::ErrorInfo { +public: + static char ID; + + UnsupportedURI(std::string uri); + + void log(llvm::raw_ostream &OS) const override; + std::error_code convertToErrorCode() const override; + +private: + std::string m_uri; +}; + } // namespace lldb_private::mcp diff --git a/lldb/source/Plugins/Protocol/MCP/Protocol.cpp b/lldb/source/Plugins/Protocol/MCP/Protocol.cpp index d66c931a0b284..e42e1bf1118cf 100644 --- a/lldb/source/Plugins/Protocol/MCP/Protocol.cpp +++ b/lldb/source/Plugins/Protocol/MCP/Protocol.cpp @@ -107,8 +107,36 @@ bool fromJSON(const llvm::json::Value &V, ToolCapability &TC, return O && O.map("listChanged", TC.listChanged); } +llvm::json::Value toJSON(const ResourceCapability &RC) { + return llvm::json::Object{{"listChanged", RC.listChanged}, +{"subscribe", RC.subscribe}}; +} + +bool fro
[Lldb-commits] [lldb] [lldb] Expose debuggers and target as resources through MCP (PR #148075)
@@ -76,17 +76,75 @@ struct ToolCapability { llvm::json::Value toJSON(const ToolCapability &); bool fromJSON(const llvm::json::Value &, ToolCapability &, llvm::json::Path); +struct ResourceCapability { + /// Whether this server supports notifications for changes to the resources + /// list. + bool listChanged = false; + + /// Whether subscriptions are supported. + bool subscribe = false; +}; + +llvm::json::Value toJSON(const ResourceCapability &); +bool fromJSON(const llvm::json::Value &, ResourceCapability &, + llvm::json::Path); + /// Capabilities that a server may support. Known capabilities are defined here, /// in this schema, but this is not a closed set: any server can define its own, /// additional capabilities. struct Capabilities { - /// Present if the server offers any tools to call. + /// Tool capabilities of the server. ToolCapability tools; + + /// Resource capabilities of the server. + ResourceCapability resources; }; llvm::json::Value toJSON(const Capabilities &); bool fromJSON(const llvm::json::Value &, Capabilities &, llvm::json::Path); +/// A known resource that the server is capable of reading. +struct Resource { + /// The URI of this resource. + std::string uri; + + /// A human-readable name for this resource. + std::string name; + + /// A description of what this resource represents. + std::optional description; + + /// The MIME type of this resource, if known. + std::optional mimeType; JDevlieghere wrote: Let me do this as a followup for all of MCP ๐ https://github.com/llvm/llvm-project/pull/148075 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 9adc8dd - When running OS Plugins from dSYM's, make sure start state is correct (#146441)
Author: jimingham Date: 2025-07-11T10:02:07-07:00 New Revision: 9adc8ddad02d062e0b395d8079f051e8ae4552b4 URL: https://github.com/llvm/llvm-project/commit/9adc8ddad02d062e0b395d8079f051e8ae4552b4 DIFF: https://github.com/llvm/llvm-project/commit/9adc8ddad02d062e0b395d8079f051e8ae4552b4.diff LOG: When running OS Plugins from dSYM's, make sure start state is correct (#146441) This is an odd corner case of the use of scripts loaded from dSYM's - a macOS only feature, which can load OS Plugins that re-present the thread state of the program we attach to. If we find out about and load the dSYM scripts when we discover a target in the course of attaching to it, we can end up running the OS plugin before we've started up the private state thread. However, the os_plugin in that case will be running before we broadcast the stop event to the public event listener. So it should formally use the private state and not the public state for the Python code environment. This patch says that if we have not yet started up the private state thread, then any thread that is servicing events is doing so on behalf of the private state machinery, and should see the private state, not the public state. Most of the patch is getting a test that will actually reproduce the error. Only the test `test_python_os_plugin_remote` actually reproduced the error. In `test_python_os_plugin` we actually do start up the private state thread before handling the event. `test_python_os_plugin` is there for completeness sake. Added: lldb/test/API/functionalities/plugins/python_os_plugin/os_plugin_in_dsym/Makefile lldb/test/API/functionalities/plugins/python_os_plugin/os_plugin_in_dsym/TestOSIndSYM.py lldb/test/API/functionalities/plugins/python_os_plugin/os_plugin_in_dsym/main.c lldb/test/API/functionalities/plugins/python_os_plugin/os_plugin_in_dsym/operating_system.py Modified: lldb/include/lldb/Host/HostThread.h lldb/include/lldb/Target/Process.h lldb/source/Host/common/HostThread.cpp lldb/source/Target/Process.cpp lldb/source/Target/StackFrameList.cpp lldb/test/API/functionalities/plugins/python_os_plugin/operating_system.py Removed: diff --git a/lldb/include/lldb/Host/HostThread.h b/lldb/include/lldb/Host/HostThread.h index d3477e115e2d8..c969492f5b20a 100644 --- a/lldb/include/lldb/Host/HostThread.h +++ b/lldb/include/lldb/Host/HostThread.h @@ -43,6 +43,8 @@ class HostThread { bool EqualsThread(lldb::thread_t thread) const; + bool HasThread() const; + private: std::shared_ptr m_native_thread; }; diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index a8892e9c43225..637b0774ec7db 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -2547,6 +2547,8 @@ void PruneThreadPlans(); bool CurrentThreadIsPrivateStateThread(); + bool CurrentThreadPosesAsPrivateStateThread(); + virtual Status SendEventData(const char *data) { return Status::FromErrorString( "Sending an event is not supported for this process."); diff --git a/lldb/source/Host/common/HostThread.cpp b/lldb/source/Host/common/HostThread.cpp index eec029be1c091..8822be016b0a1 100644 --- a/lldb/source/Host/common/HostThread.cpp +++ b/lldb/source/Host/common/HostThread.cpp @@ -44,3 +44,9 @@ lldb::thread_result_t HostThread::GetResult() const { bool HostThread::EqualsThread(lldb::thread_t thread) const { return m_native_thread->EqualsThread(thread); } + +bool HostThread::HasThread() const { + if (!m_native_thread) +return false; + return m_native_thread->GetSystemHandle() != LLDB_INVALID_HOST_THREAD; +} diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index bba1230c79920..2aa02fd58335e 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -1271,7 +1271,7 @@ uint32_t Process::AssignIndexIDToThread(uint64_t thread_id) { } StateType Process::GetState() { - if (CurrentThreadIsPrivateStateThread()) + if (CurrentThreadPosesAsPrivateStateThread()) return m_private_state.GetValue(); else return m_public_state.GetValue(); @@ -3144,16 +3144,19 @@ void Process::CompleteAttach() { } } - if (!m_os_up) { + // If we don't have an operating system plugin loaded yet, see if + // LoadOperatingSystemPlugin can find one (and stuff it in m_os_up). + if (!m_os_up) LoadOperatingSystemPlugin(false); -if (m_os_up) { - // Somebody might have gotten threads before now, but we need to force the - // update after we've loaded the OperatingSystem plugin or it won't get a - // chance to process the threads. - m_thread_list.Clear(); - UpdateThreadListIfNeeded(); -} + + if (m_os_up) { +// Somebody might have gotten threads before we loaded the OS Plugin above, +// so we need to force the update now or the newly loaded
[Lldb-commits] [lldb] When running OS Plugins from dSYM's, make sure start state is correct (PR #146441)
https://github.com/jimingham closed https://github.com/llvm/llvm-project/pull/146441 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose debuggers and target as resources through MCP (PR #148075)
@@ -0,0 +1,166 @@ +// 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 "Resource.h" +#include "MCPError.h" +#include "lldb/Core/Debugger.h" +#include "lldb/Core/Module.h" + +using namespace lldb_private::mcp; + +template +static llvm::Error createStringError(const char *format, Args &&...args) { + return llvm::createStringError( + llvm::formatv(format, std::forward(args)...).str()); +} + +static llvm::Error createUnsupportedURIError(llvm::StringRef uri) { + return llvm::make_error(uri.str()); +} + +protocol::Resource +DebuggerResourceProvider::GetDebuggerResource(lldb::user_id_t debugger_id) { + protocol::Resource resource; + resource.uri = llvm::formatv("lldb://debugger/{0}", debugger_id); + resource.name = llvm::formatv("debugger {0}", debugger_id); + resource.description = + llvm::formatv("Information about debugger instance {0}", debugger_id); + resource.mimeType = "application/json"; + return resource; +} + +protocol::Resource +DebuggerResourceProvider::GetTargetResource(lldb::user_id_t debugger_id, +lldb::user_id_t target_id) { + protocol::Resource resource; + resource.uri = + llvm::formatv("lldb://debugger/{0}/target/{1}", debugger_id, target_id); + resource.name = llvm::formatv("target {0}", target_id); + resource.description = + llvm::formatv("Information about target {0} in debugger instance {1}", +target_id, debugger_id); + resource.mimeType = "application/json"; + return resource; +} + +std::vector DebuggerResourceProvider::GetResources() const { + std::vector resources; + + const size_t num_debuggers = Debugger::GetNumDebuggers(); + for (size_t i = 0; i < num_debuggers; ++i) { +lldb::DebuggerSP debugger_sp = Debugger::GetDebuggerAtIndex(i); +if (!debugger_sp) + continue; +resources.emplace_back(GetDebuggerResource(i)); + +TargetList &target_list = debugger_sp->GetTargetList(); +const size_t num_targets = target_list.GetNumTargets(); JDevlieghere wrote: I don't believe we have anything more stable. My hope is to rely on the listChanged notification in the future, so the client knows the resource went away. https://github.com/llvm/llvm-project/pull/148075 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose debuggers and target as resources through MCP (PR #148075)
@@ -0,0 +1,166 @@ +// 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 "Resource.h" +#include "MCPError.h" +#include "lldb/Core/Debugger.h" +#include "lldb/Core/Module.h" + +using namespace lldb_private::mcp; + +template +static llvm::Error createStringError(const char *format, Args &&...args) { + return llvm::createStringError( + llvm::formatv(format, std::forward(args)...).str()); +} + +static llvm::Error createUnsupportedURIError(llvm::StringRef uri) { + return llvm::make_error(uri.str()); +} + +protocol::Resource +DebuggerResourceProvider::GetDebuggerResource(lldb::user_id_t debugger_id) { + protocol::Resource resource; + resource.uri = llvm::formatv("lldb://debugger/{0}", debugger_id); + resource.name = llvm::formatv("debugger {0}", debugger_id); + resource.description = + llvm::formatv("Information about debugger instance {0}", debugger_id); + resource.mimeType = "application/json"; + return resource; +} + +protocol::Resource +DebuggerResourceProvider::GetTargetResource(lldb::user_id_t debugger_id, +lldb::user_id_t target_id) { + protocol::Resource resource; + resource.uri = + llvm::formatv("lldb://debugger/{0}/target/{1}", debugger_id, target_id); + resource.name = llvm::formatv("target {0}", target_id); + resource.description = + llvm::formatv("Information about target {0} in debugger instance {1}", +target_id, debugger_id); + resource.mimeType = "application/json"; + return resource; +} + +std::vector DebuggerResourceProvider::GetResources() const { + std::vector resources; + + const size_t num_debuggers = Debugger::GetNumDebuggers(); + for (size_t i = 0; i < num_debuggers; ++i) { +lldb::DebuggerSP debugger_sp = Debugger::GetDebuggerAtIndex(i); +if (!debugger_sp) + continue; +resources.emplace_back(GetDebuggerResource(i)); + +TargetList &target_list = debugger_sp->GetTargetList(); +const size_t num_targets = target_list.GetNumTargets(); +for (size_t j = 0; j < num_targets; ++j) { + lldb::TargetSP target_sp = target_list.GetTargetAtIndex(j); + if (!target_sp) +continue; + resources.emplace_back(GetTargetResource(i, j)); +} + } + + return resources; +} + +llvm::Expected +DebuggerResourceProvider::ReadResource(llvm::StringRef uri) const { + auto [protocol, path] = uri.split("://"); JDevlieghere wrote: Yeah, it treats the first component as the hostname, which is why I didn't use it. Not sure if there's a good way to distinguish the two. https://github.com/llvm/llvm-project/pull/148075 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [Clang][AST][NFC] (`RecordDecl` -> `CXXRecordDecl`)`::isInjectedClassName` (PR #148195)
https://github.com/mizvekov approved this pull request. LGTM For reference, this takes this change out of https://github.com/llvm/llvm-project/pull/147835, which reduces the size of that PR a little bit. https://github.com/llvm/llvm-project/pull/148195 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [Clang][AST][NFC] (`RecordDecl` -> `CXXRecordDecl`)`::isInjectedClassName` (PR #148195)
mizvekov wrote: > These files test demangling `RecordDecl::isInjectedClassName`, which will be > out-of-date (I think) after merging this PR. This file uses these symbols as test cases, but they are just examples and aren't coupled to the clang implementation at all, the tests are still valid, even if these were originally constructed from clang as an example. https://github.com/llvm/llvm-project/pull/148195 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb] Support disassembling RISC-V proprietary instructions (PR #145793)
lenary wrote: > We don't have any big endian riscv ArchSpec entry today or I'd add a big > endian riscv instruction decoding test too. We're starting to get Big Endian support for RISC-V in LLVM, but I've asked that those patches wait until after the branch as there's a lot of work to make big-endian work, and it would be better if it all came in one release not slowly over several (especially as the big-endian ABI is not yet completed). Once we get big-endian support, testing should be fairly easy, as risc-v instructions are always little-endian. https://github.com/llvm/llvm-project/pull/145793 ___ 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::unique_ptr (PR #148248)
https://github.com/Nerixyz created https://github.com/llvm/llvm-project/pull/148248 This PR adds a summary and synthetic children for `std::unique_ptr` from MSVC's STL ([NatVis](https://github.com/microsoft/STL/blob/313964b78a8fd5a52e7965e13781f735bcce13c5/stl/debugger/STL.natvis#L285-L303)). As with libc++, the deleter is only shown if it's non-empty. Tested both the shared_ptr and unique_ptr tests on Windows. >From 905944e6251c938a799aa881e40ef9a9ce576bab Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Fri, 11 Jul 2025 16:21:21 +0200 Subject: [PATCH] [LLDB] Add formatters for MSVC STL std::unique_ptr --- .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 31 - .../Plugins/Language/CPlusPlus/MsvcStl.h | 8 ++ .../CPlusPlus/MsvcStlSmartPointer.cpp | 115 ++ .../TestDataFormatterStdUniquePtr.py | 11 ++ 4 files changed, 161 insertions(+), 4 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 2db3e6f0ca315..9a869f3ea0289 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1566,10 +1566,6 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { "std::optional synthetic child", "^std::optional<.+>(( )?&)?$", stl_deref_flags, true); - AddCXXSummary(cpp_category_sp, - lldb_private::formatters::LibStdcppUniquePointerSummaryProvider, -"libstdc++ std::unique_ptr summary provider", -"^std::unique_ptr<.+>(( )?&)?$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::StdlibCoroutineHandleSummaryProvider, "libstdc++ std::coroutine_handle summary provider", @@ -1599,6 +1595,24 @@ GenericSmartPointerSummaryProvider(ValueObject &valobj, Stream &stream, return LibStdcppSmartPointerSummaryProvider(valobj, stream, options); } +static lldb_private::SyntheticChildrenFrontEnd * +GenericUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren *children, + lldb::ValueObjectSP valobj_sp) { + if (!valobj_sp) +return nullptr; + + if (IsMsvcStlUniquePtr(*valobj_sp)) +return MsvcStlUniquePtrSyntheticFrontEndCreator(valobj_sp); + return LibStdcppUniquePtrSyntheticFrontEndCreator(children, valobj_sp); +} + +static bool GenericUniquePtrSummaryProvider(ValueObject &valobj, Stream &stream, +const TypeSummaryOptions &options) { + if (IsMsvcStlUniquePtr(valobj)) +return MsvcStlUniquePtrSummaryProvider(valobj, stream, options); + return LibStdcppUniquePointerSummaryProvider(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) @@ -1642,12 +1656,18 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { }, "MSVC STL/libstdc++ std::wstring summary provider")); + stl_summary_flags.SetDontShowChildren(false); + stl_summary_flags.SetSkipPointers(false); + AddCXXSynthetic(cpp_category_sp, GenericSmartPointerSyntheticFrontEndCreator, "std::shared_ptr synthetic children", "^std::shared_ptr<.+>(( )?&)?$", stl_synth_flags, true); AddCXXSynthetic(cpp_category_sp, GenericSmartPointerSyntheticFrontEndCreator, "std::weak_ptr synthetic children", "^std::weak_ptr<.+>(( )?&)?$", stl_synth_flags, true); + AddCXXSynthetic(cpp_category_sp, GenericUniquePtrSyntheticFrontEndCreator, + "std::unique_ptr synthetic children", + "^std::unique_ptr<.+>(( )?&)?$", stl_synth_flags, true); AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider, "MSVC STL/libstdc++ std::shared_ptr summary provider", @@ -1655,6 +1675,9 @@ static void LoadCommonStlFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { AddCXXSummary(cpp_category_sp, GenericSmartPointerSummaryProvider, "MSVC STL/libstdc++ std::weak_ptr summary provider", "^std::weak_ptr<.+>(( )?&)?$", stl_summary_flags, true); + AddCXXSummary(cpp_category_sp, GenericUniquePtrSummaryProvider, +"MSVC STL/libstdc++ std::unique_ptr summary provider", +"^std::unique_ptr<.+>(( )?&)?$", 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 edf3f4e8a5387..fe75bf275f8e2 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h +++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStl.h @@ -37,6 +37,14 @@ bool MsvcStlSmartPointerSummaryPr
[Lldb-commits] [lldb] [lldb] Add completions for plugin list/enable/disable (PR #147775)
@@ -2473,3 +2474,35 @@ bool PluginManager::SetUnwindAssemblyPluginEnabled(llvm::StringRef name, bool enable) { return GetUnwindAssemblyInstances().SetInstanceEnabled(name, enable); } + +void PluginManager::AutoCompletePluginName(llvm::StringRef name, + CompletionRequest &request) { + // Split the name into the namespace and the plugin name. + // If there is no dot then the ns_name will be equal to name and + // plugin_prefix will be empty. + llvm::StringRef ns_name, plugin_prefix; + std::tie(ns_name, plugin_prefix) = name.split('.'); + + for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) { +// If the plugin namespace matches exactly then +// add all the plugins in this namespace as completions if the +// plugin names starts with the plugin_prefix. If the plugin_prefix +// is empty then it will match all the plugins (empty string is a +// prefix of everything). +if (plugin_ns.name == ns_name) { + for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) { +llvm::SmallString<128> buf; +if (plugin.name.starts_with(plugin_prefix)) + request.AddCompletion( + (plugin_ns.name + "." + plugin.name).toStringRef(buf)); JDevlieghere wrote: Thanks, now that I see the code I remember I touched those lines not too long ago. Thanks for confirming. https://github.com/llvm/llvm-project/pull/147775 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits