[Lldb-commits] [lldb] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators (PR #156050)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/156050 >From 35999d8d509864795dd36565d12ddea425a98c22 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 29 Aug 2025 16:57:35 +0100 Subject: [PATCH 1/2] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators This came up in https://github.com/llvm/llvm-project/issues/155691. For `std::basic_string` our formatter matching logic required the allocator template parameter to be a `std::allocator`. There is no compelling reason (that I know of) why this would be required for us to apply the existing formatter to the string. We don't check the `allocator` parameter for other STL containers either. This meant that `std::string` that used custom allocators wouldn't be formatted. This patch relaxes the regex for `basic_string`. --- .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 15 -- .../string/TestDataFormatterStdString.py | 6 .../generic/string/main.cpp | 30 +++ 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index c39b529f7305a..ad3c00a1132d4 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -749,31 +749,27 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxStringSummaryProviderASCII, "std::string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderASCII, "std::string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderUTF16, "std::u16string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderUTF32, "std::u32string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, @@ -784,8 +780,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxWStringSummaryProvider, "std::wstring summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py index fec20bae997ef..6a27b5d2f0780 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py @@ -80,6 +80,8 @@ def cleanup(): '(%s::string) Q = "quite a long std::strin with lots of info inside it"' % ns, "(%s::string *) null_str = nullptr" % ns, +'(CustomString) custom_str = "hello!"', +'(CustomWString) custom_wstr = L"hello!"', ], ) @@ -143,6 +145,10 @@ def do_test_multibyte(self): '(%s::u16string) u16_empty = u""' % ns, '(%s::u32string) u32_string = U"🍄🍅🍆🍌"' % ns, '(%s::u32string) u32_empty = U""' % ns, +'(CustomStringU16) custom_u16 = u"ß水氶"', +'(CustomStringU16) custom_u16_empty = u""', +'(CustomStringU32) custom_u32 = U"🍄🍅🍆🍌"', +'(CustomStringU32) custom_u32_empty = U""', ], ) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter
[Lldb-commits] [lldb] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators (PR #156050)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/156050 >From 35999d8d509864795dd36565d12ddea425a98c22 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 29 Aug 2025 16:57:35 +0100 Subject: [PATCH 1/7] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators This came up in https://github.com/llvm/llvm-project/issues/155691. For `std::basic_string` our formatter matching logic required the allocator template parameter to be a `std::allocator`. There is no compelling reason (that I know of) why this would be required for us to apply the existing formatter to the string. We don't check the `allocator` parameter for other STL containers either. This meant that `std::string` that used custom allocators wouldn't be formatted. This patch relaxes the regex for `basic_string`. --- .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 15 -- .../string/TestDataFormatterStdString.py | 6 .../generic/string/main.cpp | 30 +++ 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index c39b529f7305a..ad3c00a1132d4 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -749,31 +749,27 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxStringSummaryProviderASCII, "std::string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderASCII, "std::string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderUTF16, "std::u16string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderUTF32, "std::u32string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, @@ -784,8 +780,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxWStringSummaryProvider, "std::wstring summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py index fec20bae997ef..6a27b5d2f0780 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py @@ -80,6 +80,8 @@ def cleanup(): '(%s::string) Q = "quite a long std::strin with lots of info inside it"' % ns, "(%s::string *) null_str = nullptr" % ns, +'(CustomString) custom_str = "hello!"', +'(CustomWString) custom_wstr = L"hello!"', ], ) @@ -143,6 +145,10 @@ def do_test_multibyte(self): '(%s::u16string) u16_empty = u""' % ns, '(%s::u32string) u32_string = U"🍄🍅🍆🍌"' % ns, '(%s::u32string) u32_empty = U""' % ns, +'(CustomStringU16) custom_u16 = u"ß水氶"', +'(CustomStringU16) custom_u16_empty = u""', +'(CustomStringU32) custom_u32 = U"🍄🍅🍆🍌"', +'(CustomStringU32) custom_u32_empty = U""', ], ) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter
[Lldb-commits] [lldb] [lldb][Instrumentation] Set selected frame to outside sanitizer libraries (PR #133079)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/133079 >From 2314f9e584d736ce2093cc196c7c57c2087cde42 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 26 Mar 2025 12:54:36 + Subject: [PATCH 1/4] [lldb][Instrumentation] Set selected frame to outside sanitizer libraries --- .../Target/InstrumentationRuntimeStopInfo.h | 3 ++ lldb/include/lldb/Target/StackFrameList.h | 2 + lldb/include/lldb/Target/Thread.h | 4 ++ .../Target/InstrumentationRuntimeStopInfo.cpp | 42 +++ lldb/source/Target/Process.cpp| 2 + 5 files changed, 53 insertions(+) diff --git a/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h b/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h index 5345160850914..dafa41c11327a 100644 --- a/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h +++ b/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h @@ -24,6 +24,9 @@ class InstrumentationRuntimeStopInfo : public StopInfo { return lldb::eStopReasonInstrumentation; } + std::optional + GetSuggestedStackFrameIndex(bool inlined_stack) override; + const char *GetDescription() override; bool DoShouldNotify(Event *event_ptr) override { return true; } diff --git a/lldb/include/lldb/Target/StackFrameList.h b/lldb/include/lldb/Target/StackFrameList.h index 8a66296346f2d..be6ec3b09d8aa 100644 --- a/lldb/include/lldb/Target/StackFrameList.h +++ b/lldb/include/lldb/Target/StackFrameList.h @@ -36,6 +36,8 @@ class StackFrameList { /// Get the frame at index \p idx. Invisible frames cannot be indexed. lldb::StackFrameSP GetFrameAtIndex(uint32_t idx); + void ResetSuggestedStackFrameIndex() { m_selected_frame_idx.reset(); } + /// Get the first concrete frame with index greater than or equal to \p idx. /// Unlike \ref GetFrameAtIndex, this cannot return a synthetic frame. lldb::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx); diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h index 1d1e3dcfc1dc6..747d7299025f8 100644 --- a/lldb/include/lldb/Target/Thread.h +++ b/lldb/include/lldb/Target/Thread.h @@ -433,6 +433,10 @@ class Thread : public std::enable_shared_from_this, return GetStackFrameList()->GetFrameAtIndex(idx); } + virtual void ResetSuggestedStackFrameIndex() { +return GetStackFrameList()->ResetSuggestedStackFrameIndex(); + } + virtual lldb::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx); diff --git a/lldb/source/Target/InstrumentationRuntimeStopInfo.cpp b/lldb/source/Target/InstrumentationRuntimeStopInfo.cpp index 7f82581cc601e..1daeebdbaf9c7 100644 --- a/lldb/source/Target/InstrumentationRuntimeStopInfo.cpp +++ b/lldb/source/Target/InstrumentationRuntimeStopInfo.cpp @@ -8,13 +8,20 @@ #include "lldb/Target/InstrumentationRuntimeStopInfo.h" +#include "lldb/Core/Module.h" #include "lldb/Target/InstrumentationRuntime.h" #include "lldb/Target/Process.h" +#include "lldb/lldb-enumerations.h" #include "lldb/lldb-private.h" using namespace lldb; using namespace lldb_private; +static bool IsStoppedInDarwinSanitizer(Thread &thread, Module &module) { + return module.GetFileSpec().GetFilename().GetStringRef().starts_with( + "libclang_rt."); +} + InstrumentationRuntimeStopInfo::InstrumentationRuntimeStopInfo( Thread &thread, std::string description, StructuredData::ObjectSP additional_data) @@ -34,3 +41,38 @@ InstrumentationRuntimeStopInfo::CreateStopReasonWithInstrumentationData( return StopInfoSP( new InstrumentationRuntimeStopInfo(thread, description, additionalData)); } + +std::optional +InstrumentationRuntimeStopInfo::GetSuggestedStackFrameIndex( +bool inlined_stack) { + auto thread_sp = GetThread(); + if (!thread_sp) +return std::nullopt; + + // Defensive upper-bound of when we stop walking up the frames in + // case we somehow ended up looking at an infinite recursion. + const size_t max_stack_depth = 128; + + // Start at parent frame. + size_t stack_idx = 1; + StackFrameSP most_relevant_frame_sp = + thread_sp->GetStackFrameAtIndex(stack_idx); + + while (most_relevant_frame_sp && stack_idx <= max_stack_depth) { +auto const &sc = +most_relevant_frame_sp->GetSymbolContext(lldb::eSymbolContextModule); + +if (!sc.module_sp) + return std::nullopt; + +// Found a frame outside of the sanitizer runtime libraries. +// That's the one we want to display. +if (!IsStoppedInDarwinSanitizer(*thread_sp, *sc.module_sp)) + return stack_idx; + +++stack_idx; +most_relevant_frame_sp = thread_sp->GetStackFrameAtIndex(stack_idx); + } + + return stack_idx; +} diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index f2f5598f0ab53..f82cea2d668ed 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -4257,6 +4257,8 @@ bool Process::ProcessEventData::ShouldStop(Event *eve
[Lldb-commits] [clang] [libcxx] [lldb] [llvm] [polly] [python] remove Python 3.9 specific typing annotations (PR #156868)
https://github.com/DeinAlptraum edited https://github.com/llvm/llvm-project/pull/156868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] cc220b1 - [lldb] Mark UnsupportedLanguage.test Unsupported on Windows
Author: Aiden Grossman Date: 2025-09-04T13:53:37Z New Revision: cc220b1d55297b5939eb7eb197767a8b27aa71f8 URL: https://github.com/llvm/llvm-project/commit/cc220b1d55297b5939eb7eb197767a8b27aa71f8 DIFF: https://github.com/llvm/llvm-project/commit/cc220b1d55297b5939eb7eb197767a8b27aa71f8.diff LOG: [lldb] Mark UnsupportedLanguage.test Unsupported on Windows This is to fix buildbot fallout post #156729 without needing to revert the original patch. Added: Modified: lldb/test/Shell/Process/UnsupportedLanguage.test Removed: diff --git a/lldb/test/Shell/Process/UnsupportedLanguage.test b/lldb/test/Shell/Process/UnsupportedLanguage.test index b7bbd860d0cac..ec5d1bd9bace1 100644 --- a/lldb/test/Shell/Process/UnsupportedLanguage.test +++ b/lldb/test/Shell/Process/UnsupportedLanguage.test @@ -1,5 +1,10 @@ Test unsupported language warning +TODO: This test does not work on Windows, seemingly because the sed commands +are not actually doing anything. This should be fixed so we can enable this on +Windows. +UNSUPPORTED: system-windows + RUN: %clang_host %S/Inputs/true.c -std=c99 -g -c -S -emit-llvm -o - \ RUN: | sed -e 's/DW_LANG_C99/DW_LANG_Mips_Assembler/g' >%t.ll RUN: %clang_host %t.ll -g -o %t.exe ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix race condition in Process::WaitForProcessToStop() (PR #144919)
athierry-oct wrote: > in async mode that event should be propagated so that the process event > listener can fetch the event and so the public state gets correctly reset @jimingham currently the event is also propagated in sync mode (and this propagated event stays unprocessed forever). Should a condition be added in RunThreadPlan() in order to not propagate it in sync mode? Or should it still be propagated in sync mode but the propagated event should then be consumed from within EvaluateExpression() ? https://github.com/llvm/llvm-project/pull/144919 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)
@@ -61,3 +61,10 @@ def pre_init_command: S<"pre-init-command">, def: Separate<["-"], "c">, Alias, HelpText<"Alias for --pre-init-command">; + +def time_to_live: S<"time-to-live">, + MetaVarName<"">, + HelpText<"When using --connection, the number of milliseconds to wait " +"for new connections at the beginning and after all clients have " +"disconnected. Not specifying this argument or specifying " walter-erquinigo wrote: you have to be more descriptive here. You need to mention what happens when the time out is hit both at the "beginning" and after clients disconnect. If there's any reset of the timer, you need to mention that here as well https://github.com/llvm/llvm-project/pull/156803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Correct style of error messages (PR #156774)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/156774 >From 7e2901ba9171555b07a44a008e84f6811a95a64d Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 3 Sep 2025 16:45:13 -0700 Subject: [PATCH] [lldb] Correct style of error messages The LLVM Style Guide says the following about error and warning messages [1]: > [T]o match error message styles commonly produced by other tools, > start the first sentence with a lowercase letter, and finish the last > sentence without a period, if it would end in one otherwise. I often provide this feedback during code review, but we still have a bunch of places where we have inconsistent error message, which bothers me as a user. This PR identifies a handful of those places and updates the messages to be consistent. [1] https://llvm.org/docs/CodingStandards.html#error-and-warning-messages --- lldb/source/API/SBCommandInterpreter.cpp | 2 +- .../Commands/CommandObjectBreakpoint.cpp | 36 +-- .../source/Commands/CommandObjectCommands.cpp | 4 +-- lldb/source/Commands/CommandObjectFrame.cpp | 8 ++--- lldb/source/Commands/CommandObjectLog.cpp | 2 +- .../Commands/CommandObjectMultiword.cpp | 2 +- lldb/source/Commands/CommandObjectProcess.cpp | 2 +- lldb/source/Commands/CommandObjectSource.cpp | 6 ++-- lldb/source/Commands/CommandObjectTarget.cpp | 6 ++-- lldb/source/Commands/CommandObjectThread.cpp | 2 +- .../Commands/CommandObjectWatchpoint.cpp | 24 ++--- .../CommandObjectWatchpointCommand.cpp| 6 ++-- lldb/source/Expression/DWARFExpression.cpp| 2 +- .../source/Expression/DWARFExpressionList.cpp | 2 +- .../source/Interpreter/CommandInterpreter.cpp | 6 ++-- lldb/source/Interpreter/CommandObject.cpp | 6 ++-- lldb/source/Interpreter/Options.cpp | 2 +- .../Language/CPlusPlus/LibCxxVector.cpp | 10 +++--- .../Language/CPlusPlus/MsvcStlVector.cpp | 10 +++--- .../script/add/TestAddParsedCommand.py| 2 +- .../commands/frame/select/TestFrameSelect.py | 6 ++-- ...taFormatterLibcxxInvalidVectorSimulator.py | 10 +++--- .../TestInferiorCrashingStep.py | 2 +- .../TestRecursiveInferiorStep.py | 2 +- .../TestMultiWordCommands.py | 2 +- .../TestRunCommandInterpreterAPI.py | 2 +- .../API/SBCommandInterpreterTest.cpp | 4 +-- 27 files changed, 84 insertions(+), 84 deletions(-) diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index 4ea79d336e08d..34323bc5a2c37 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -208,7 +208,7 @@ void SBCommandInterpreter::HandleCommandsFromFile( LLDB_INSTRUMENT_VA(this, file, override_context, options, result); if (!IsValid()) { -result->AppendError("SBCommandInterpreter is not valid."); +result->AppendError("SBCommandInterpreter is not valid"); return; } diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index 38ec375c03070..de0a7e7093411 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -609,12 +609,12 @@ class CommandObjectBreakpointSet : public CommandObjectParsed { const size_t num_files = m_options.m_filenames.GetSize(); if (num_files == 0) { if (!GetDefaultFile(target, file, result)) { - result.AppendError("No file supplied and no default file available."); + result.AppendError("no file supplied and no default file available"); return; } } else if (num_files > 1) { -result.AppendError("Only one file at a time is allowed for file and " - "line breakpoints."); +result.AppendError("only one file at a time is allowed for file and " + "line breakpoints"); return; } else file = m_options.m_filenames.GetFileSpecAtIndex(0); @@ -784,7 +784,7 @@ class CommandObjectBreakpointSet : public CommandObjectParsed { } result.SetStatus(eReturnStatusSuccessFinishResult); } else if (!bp_sp) { - result.AppendError("Breakpoint creation failed: No breakpoint created."); + result.AppendError("breakpoint creation failed: no breakpoint created"); } } @@ -940,7 +940,7 @@ class CommandObjectBreakpointEnable : public CommandObjectParsed { size_t num_breakpoints = breakpoints.GetSize(); if (num_breakpoints == 0) { - result.AppendError("No breakpoints exist to be enabled."); + result.AppendError("no breakpoints exist to be enabled"); return; } @@ -1048,7 +1048,7 @@ the second re-enables the first location."); size_t num_breakpoints = breakpoints.GetSize(); if (num_breakpoints == 0) { - result.AppendError("No breakpoints exist to
[Lldb-commits] [lldb] [lldb] Add more command option mnemonics (PR #155705)
JDevlieghere wrote: Friendly ping https://github.com/llvm/llvm-project/pull/155705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Correct style of error messages (PR #156774)
@@ -418,7 +418,7 @@ other command as far as there is only one alias command match."); if ((pos != std::string::npos) && (pos > 0)) raw_command_string = raw_command_string.substr(pos); } else { - result.AppendError("Error parsing command string. No alias created."); + result.AppendError("error parsing command string. No alias created"); JDevlieghere wrote: It does, yeah, it even includes an example (which I know you couldn't see because of the infra issue): > error: file.o: section header 3 is corrupt. Size is 10 when it should be 20 The double spaces is something else we should settle on, but that's a separate discussion... https://github.com/llvm/llvm-project/pull/156774 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Correct style of error messages (PR #156774)
JDevlieghere wrote: > Great! May be we should do this for: > > * `Status::Status(std::string err_str)` > * `static Status FromErrorString(const char *str)` > * `static Status FromErrorStringWithFormat(const char *format, ...)` > * `template static Status FromErrorStringWithFormatv(const > char *format, Args &&...args)` Yeah, those are all good functions to grep for. > Also, it would be great if we had a clang-tidy checker as part of the CI > testing to catching this inconsistencies earlier 👀 It would be nice to automate. Currently, we don't run any clang-tidy checks in CI and I think it would be most valuable if that were part of the pre-commit checks. The clang-tidy checks are a lot more expensive than the formatters though, so I don't know if that's even on the table. Might be an interesting topic for the infa workgroup. https://github.com/llvm/llvm-project/pull/156774 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [clang][Expr] Teach IgnoreUnlessSpelledInSource about implicit calls to std::get free function (PR #122265)
Michael137 wrote: Latest commit narrows the heuristics so it specifically applies to `CallExpr`s generated for structured bindings. Here's what the AST looks like when stopped in `IgnoreImplicitCallSingleStep` for a structured binding: ``` (lldb) p E->dump() CallExpr 0x912dd6cb8 'int' adl |-ImplicitCastExpr 0x912dd6ca0 'int (*)(triple)' | `-DeclRefExpr 0x912dd6be8 'int (triple)' lvalue Function 0x912dbdb98 'get' 'int (triple)' (FunctionTemplate 0x912dbd990 'get') `-CXXConstructExpr 0x912dd80e0 'triple' 'void (triple &&) noexcept' `-ImplicitCastExpr 0x912dd64b0 'std::triple' xvalue `-DeclRefExpr 0x912dd6490 'std::triple' lvalue Decomposition 0x912dd4f68 first_binding 'k' 'std::triple' (lldb) p A->dump() CXXConstructExpr 0x912dd80e0 'triple' 'void (triple &&) noexcept' `-ImplicitCastExpr 0x912dd64b0 'std::triple' xvalue `-DeclRefExpr 0x912dd6490 'std::triple' lvalue Decomposition 0x912dd4f68 first_binding 'k' 'std::triple' ``` What my latest change does is try and get to that `DeclRefExpr 0x912dd6490 'std::triple' lvalue Decomposition` node. And only for those cases ignore the `CallExpr`. Let me know what you think @cor3ntin @AaronBallman. There might be a better way of doing this. Particularly, I wasn't sure how to unwrap the `DeclRefExpr`, so I just used `IgnoreUnlessSpelledInSource` again (recursively). https://github.com/llvm/llvm-project/pull/122265 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix race condition in Process::WaitForProcessToStop() (PR #144919)
jimingham wrote: The latter. We have to send the event so that lldb will know that the expression stopped mid-way through. But process events have to be consumed to have any effect, so in sync mode EvaluateExpression should consume the event and then print the stop status. https://github.com/llvm/llvm-project/pull/144919 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [python] remove Python 3.9 specific typing annotations (PR #156868)
https://github.com/charles-zablit edited https://github.com/llvm/llvm-project/pull/156868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [python] remove Python 3.9 specific typing annotations (PR #156868)
charles-zablit wrote: Thanks for the feedback, I have made sure to keep the changes to a minimum in the new revision. https://github.com/llvm/llvm-project/pull/156868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libcxx] [lldb] [llvm] [polly] [python] remove Python 3.9 specific typing annotations (PR #156868)
https://github.com/DeinAlptraum edited https://github.com/llvm/llvm-project/pull/156868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Expression] Reject languages not supported by TypeSystems for expression evaluation (PR #156648)
Michael137 wrote: > How do we explain that for my global variable `class`, > > (lldb) expr class = 110 > > works when I happen to be stopped in a C frame, but if I can't find a C frame > around there's no way I can replicate that behavior? > How do we explain that for my global variable `class`, > > > > (lldb) expr class = 110 > > > > works when I happen to be stopped in a C frame, but if I can't find a C frame > around there's no way I can replicate that behavior? Good question. The reason it works for your example when stopped in a C frame is that the Clang expression evaluator has a workaround in it to allow C++ keywords in pure C/ObjC expressions. If the frame (or before this patch the `--language` flag was C/ObjC), we explicitly "unmark" the reserved C++ keywords here: https://github.com/llvm/llvm-project/blob/cc365331af423de99ae98655d035e4892842fe97/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp#L848-L861 But that in itself still has a workaround to make C-expressions work (because we rely on `using` to capture local variables) ``` static void RemoveCppKeyword(IdentifierTable &idents, llvm::StringRef token) { // FIXME: 'using' is used by LLDB for local variables, so we can't remove // this keyword without breaking this functionality. if (token == "using") return; ``` But we're still lying to the user about this being pure C expression evaluation. All-in-all, in my opinion, it would be best to keep this workaround contained to just expression evaluation from C/ObjC-frames. If we're stopped in a context where these identifiers were used as variable names, presumably that frame must be a language where this was allowed in. So we would still support the majority of use-cases. The only scenario I can think of that this breaks is that if we're stopped in a C-frame, then declare a top-level variable in the expression context with a reserved identifier in the name, and then switch to a C++ frame and try to use it: ``` frame #3: 0x0001046c a.out`func at lib.c:2:14 1 #include -> 2int func() { abort(); } (lldb) expr --top-level -- int namespace = 10; (lldb) expr namespace (int) $0 = 10 (lldb) up frame #4: 0x00010454 a.out`main at main.cpp:6:5 1extern "C" { 2int func(); 3} 4 5int main() { -> 6func(); 7} (lldb) expr namespace ˄ ╰─ error: expected identifier or '{' (lldb) down ``` Is that a scenario we want to support? https://github.com/llvm/llvm-project/pull/156648 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Target] Clear selected frame index after a StopInfo::PerformAction (PR #133078)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/133078 >From 4a0d13ef2751071505ab797c63c2ee20d14a6c61 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 26 Mar 2025 13:20:24 + Subject: [PATCH 1/4] [lldb][Target] Clear selected frame index after a StopInfo::PerformAction --- lldb/include/lldb/Target/StackFrameList.h | 3 +++ lldb/include/lldb/Target/Thread.h | 5 + lldb/source/Target/Process.cpp| 2 ++ lldb/source/Target/StackFrameList.cpp | 4 4 files changed, 14 insertions(+) diff --git a/lldb/include/lldb/Target/StackFrameList.h b/lldb/include/lldb/Target/StackFrameList.h index 8a66296346f2d..d805b644b0b31 100644 --- a/lldb/include/lldb/Target/StackFrameList.h +++ b/lldb/include/lldb/Target/StackFrameList.h @@ -46,6 +46,9 @@ class StackFrameList { /// Mark a stack frame as the currently selected frame and return its index. uint32_t SetSelectedFrame(lldb_private::StackFrame *frame); + /// Resets the selected frame index of this object. + void ClearSelectedFrameIndex(); + /// Get the currently selected frame index. /// We should only call SelectMostRelevantFrame if (a) the user hasn't already /// selected a frame, and (b) if this really is a user facing diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h index 6ede7fa301a82..688c056da2633 100644 --- a/lldb/include/lldb/Target/Thread.h +++ b/lldb/include/lldb/Target/Thread.h @@ -479,6 +479,11 @@ class Thread : public std::enable_shared_from_this, bool SetSelectedFrameByIndexNoisily(uint32_t frame_idx, Stream &output_stream); + /// Resets the selected frame index of this object. + void ClearSelectedFrameIndex() { +return GetStackFrameList()->ClearSelectedFrameIndex(); + } + void SetDefaultFileAndLineToSelectedFrame() { GetStackFrameList()->SetDefaultFileAndLineToSelectedFrame(); } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 369933234ccca..c51bab20f56ee 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -4295,6 +4295,8 @@ bool Process::ProcessEventData::ShouldStop(Event *event_ptr, // appropriately. We also need to stop processing actions, since they // aren't expecting the target to be running. +thread_sp->ClearSelectedFrameIndex(); + // FIXME: we might have run. if (stop_info_sp->HasTargetRunSinceMe()) { SetRestarted(true); diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp index 9c6208e9e0a65..3592c3c03db74 100644 --- a/lldb/source/Target/StackFrameList.cpp +++ b/lldb/source/Target/StackFrameList.cpp @@ -936,3 +936,7 @@ size_t StackFrameList::GetStatus(Stream &strm, uint32_t first_frame, strm.IndentLess(); return num_frames_displayed; } + +void StackFrameList::ClearSelectedFrameIndex() { + m_selected_frame_idx.reset(); +} >From 1a1a55786de369b1c9771623c21de459848c7e20 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 26 Mar 2025 13:35:23 + Subject: [PATCH 2/4] fixup! clang-format --- lldb/source/Target/Process.cpp | 6 ++ 1 file changed, 6 insertions(+) diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index c51bab20f56ee..46e8028160d04 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -4295,6 +4295,12 @@ bool Process::ProcessEventData::ShouldStop(Event *event_ptr, // appropriately. We also need to stop processing actions, since they // aren't expecting the target to be running. +// Clear the selected frame which may have been set as part of utility +// expressions that have been run as part of this stop. If we didn't +// clear this, then StopInfo::GetSuggestedStackFrameIndex would not +// take affect when we next called SelectMostRelevantFrame. PerformAction +// should not be the one setting a selected frame, instead this should be +// done via GetSuggestedStackFrameIndex. thread_sp->ClearSelectedFrameIndex(); // FIXME: we might have run. >From 158f0b2cd664ba1864e510bf8293d16790c6a65a Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 28 Mar 2025 15:40:47 + Subject: [PATCH 3/4] fixup! add thread-safety comment --- lldb/include/lldb/Target/StackFrameList.h | 9 + 1 file changed, 9 insertions(+) diff --git a/lldb/include/lldb/Target/StackFrameList.h b/lldb/include/lldb/Target/StackFrameList.h index d805b644b0b31..8d455dc831df3 100644 --- a/lldb/include/lldb/Target/StackFrameList.h +++ b/lldb/include/lldb/Target/StackFrameList.h @@ -175,6 +175,15 @@ class StackFrameList { /// The currently selected frame. An optional is used to record whether anyone /// has set the selected frame on this stack yet. We only let recognizers /// change the frame if this is the first time GetSelectedFrame is cal
[Lldb-commits] [lldb] [lldb] Use weak pointers instead of shared pointers in DynamicLoader (PR #156446)
https://github.com/asavonic closed https://github.com/llvm/llvm-project/pull/156446 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SBFunction::GetBaseName() & SBSymbol::GetBaseName() (PR #155939)
omjavaid wrote: @slydiman https://github.com/llvm/llvm-project/issues/156861 has been report. https://github.com/llvm/llvm-project/pull/155939 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [clang][Expr] Teach IgnoreUnlessSpelledInSource about implicit calls to std::get free function (PR #122265)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/122265 >From a9e13ad8d2a7a95d431dddcced611bea1e83b99a Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 9 Jan 2025 10:01:31 + Subject: [PATCH 01/13] [clang][DebugInfo] Expand detection of structured bindings to account for std::get free function When we generate the debug-info for a `VarDecl` we try to determine whether it was introduced as part of a structure binding (aka a "holding var"). If it was, we don't mark it as `artificial`. The heuristic to determine a holding var uses `IgnoreUnlessSpelledInSource` to unwrap the `VarDecl` initializer until we hit a `DeclRefExpr` that refers to a `Decomposition`. For "tuple-like decompositions", Clang will generate a call to a `template Foo get(Bar)` function that retrieves the `Ith` element from the tuple-like structure. If that function is a member function, we get an AST that looks as follows: ``` VarDecl implicit used z1 'std::tuple_element<0, B>::type &&' cinit `-ExprWithCleanups 'int' xvalue `-MaterializeTemporaryExpr 'int' xvalue extended by Var 0x11d110cf8 'z1' 'std::tuple_element<0, B>::type &&' `-CXXMemberCallExpr 'int' `-MemberExpr '' .get 0x11d104390 `-ImplicitCastExpr 'B' xvalue `-DeclRefExpr 'B' lvalue Decomposition 0x11d1100a8 '' 'B' ``` `IgnoreUnlessSpelledInSource` happily unwraps this down to the `DeclRefExpr`. However, when the `get` helper is a free function (which it is for `std::pair` in libc++ for example), then the AST is: ``` VarDecl col:16 implicit used k 'std::tuple_element<0, const std::tuple>::type &' cinit `-CallExpr 'const typename tuple_element<0UL, tuple>::type':'const int' lvalue adl |-ImplicitCastExpr 'const typename tuple_element<0UL, tuple>::type &(*)(const tuple &) noexcept' | `-DeclRefExpr 'const typename tuple_element<0UL, tuple>::type &(const tuple &) noexcept' lvalue Function 0x1210262d8 'get' 'const typename tuple_element<0UL, tuple>::type &(const tuple &) noexcept' (FunctionTemplate 0x11d068088 'get') `-DeclRefExpr 'const std::tuple' lvalue Decomposition 0x121021518 '' 'const std::tuple &' ``` `IgnoreUnlessSpelledInSource` doesn't unwrap this `CallExpr`, so we incorrectly mark the binding as `artificial` in debug-info. This patch adjusts our heuristic to account for `CallExpr` nodes. Fixes https://github.com/llvm/llvm-project/issues/122028 --- clang/lib/CodeGen/CGDebugInfo.cpp | 28 ++- .../test/DebugInfo/CXX/structured-binding.cpp | 27 +++ .../TestStructuredBinding.py | 11 +++ .../API/lang/cpp/structured-binding/main.cpp | 81 +-- 4 files changed, 140 insertions(+), 7 deletions(-) diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 0385dbdac869b..4b0f2bce457df 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -87,12 +87,38 @@ static bool IsDecomposedVarDecl(VarDecl const *VD) { if (!Init) return false; + Init = Init->IgnoreUnlessSpelledInSource(); + if (!Init) +return false; + + // For tuple-like decompositions, if the `get` function + // is not a member of the decomposed type, but instead a + // free function (e.g., how std::get is specialized for + // std::pair), then the initializer is a `CallExpr` and + // we need to dig into the argument before unwrapping it + // with IgnoreUnlessSpelledInSource. + if (auto const *CE = llvm::dyn_cast(Init)) { +if (CE->getNumArgs() == 0) + return false; + +// The first argument will be the type we're decomposing. +// Technically the getter could have more than 1 argument +// (e.g., if they're defaulted arguments), but we don't care +// about them because we just need to check whether the +// first argument is a DecompositionDecl. +auto const *Arg = CE->getArg(0); +if (!Arg) + return false; + +Init = Arg; + } + auto const *RefExpr = llvm::dyn_cast_or_null(Init->IgnoreUnlessSpelledInSource()); if (!RefExpr) return false; - return llvm::dyn_cast_or_null(RefExpr->getDecl()); + return llvm::isa_and_nonnull(RefExpr->getDecl()); } /// Returns true if \ref VD is a compiler-generated variable diff --git a/clang/test/DebugInfo/CXX/structured-binding.cpp b/clang/test/DebugInfo/CXX/structured-binding.cpp index 8032ce85c9e25..7d4919ad52bc7 100644 --- a/clang/test/DebugInfo/CXX/structured-binding.cpp +++ b/clang/test/DebugInfo/CXX/structured-binding.cpp @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple %itanium_abi_triple %s -o - | FileCheck %s --implicit-check-not="call void @llvm.dbg.declare" +// CHECK: define noundef i32 @_Z1fv // CHECK: #dbg_declare(ptr %{{[a-z]+}}, ![[VAR_0:[0-9]+]], !DIExpression(), // CHECK: #dbg_declare(ptr %{{[0-9]+}}, ![[VAR_1:[0-9]+]], !DIExpression(), // CHECK: #dbg_declare(ptr %{{[0-9]+}}, ![[VAR_2:[0-9]+]], !DIExpression(DW_OP_plus_uconst, 4), @@ -1
[Lldb-commits] [clang] [lldb] [clang][Expr] Teach IgnoreUnlessSpelledInSource about implicit calls to std::get free function (PR #122265)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/122265 >From a9e13ad8d2a7a95d431dddcced611bea1e83b99a Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 9 Jan 2025 10:01:31 + Subject: [PATCH 01/10] [clang][DebugInfo] Expand detection of structured bindings to account for std::get free function When we generate the debug-info for a `VarDecl` we try to determine whether it was introduced as part of a structure binding (aka a "holding var"). If it was, we don't mark it as `artificial`. The heuristic to determine a holding var uses `IgnoreUnlessSpelledInSource` to unwrap the `VarDecl` initializer until we hit a `DeclRefExpr` that refers to a `Decomposition`. For "tuple-like decompositions", Clang will generate a call to a `template Foo get(Bar)` function that retrieves the `Ith` element from the tuple-like structure. If that function is a member function, we get an AST that looks as follows: ``` VarDecl implicit used z1 'std::tuple_element<0, B>::type &&' cinit `-ExprWithCleanups 'int' xvalue `-MaterializeTemporaryExpr 'int' xvalue extended by Var 0x11d110cf8 'z1' 'std::tuple_element<0, B>::type &&' `-CXXMemberCallExpr 'int' `-MemberExpr '' .get 0x11d104390 `-ImplicitCastExpr 'B' xvalue `-DeclRefExpr 'B' lvalue Decomposition 0x11d1100a8 '' 'B' ``` `IgnoreUnlessSpelledInSource` happily unwraps this down to the `DeclRefExpr`. However, when the `get` helper is a free function (which it is for `std::pair` in libc++ for example), then the AST is: ``` VarDecl col:16 implicit used k 'std::tuple_element<0, const std::tuple>::type &' cinit `-CallExpr 'const typename tuple_element<0UL, tuple>::type':'const int' lvalue adl |-ImplicitCastExpr 'const typename tuple_element<0UL, tuple>::type &(*)(const tuple &) noexcept' | `-DeclRefExpr 'const typename tuple_element<0UL, tuple>::type &(const tuple &) noexcept' lvalue Function 0x1210262d8 'get' 'const typename tuple_element<0UL, tuple>::type &(const tuple &) noexcept' (FunctionTemplate 0x11d068088 'get') `-DeclRefExpr 'const std::tuple' lvalue Decomposition 0x121021518 '' 'const std::tuple &' ``` `IgnoreUnlessSpelledInSource` doesn't unwrap this `CallExpr`, so we incorrectly mark the binding as `artificial` in debug-info. This patch adjusts our heuristic to account for `CallExpr` nodes. Fixes https://github.com/llvm/llvm-project/issues/122028 --- clang/lib/CodeGen/CGDebugInfo.cpp | 28 ++- .../test/DebugInfo/CXX/structured-binding.cpp | 27 +++ .../TestStructuredBinding.py | 11 +++ .../API/lang/cpp/structured-binding/main.cpp | 81 +-- 4 files changed, 140 insertions(+), 7 deletions(-) diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 0385dbdac869b..4b0f2bce457df 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -87,12 +87,38 @@ static bool IsDecomposedVarDecl(VarDecl const *VD) { if (!Init) return false; + Init = Init->IgnoreUnlessSpelledInSource(); + if (!Init) +return false; + + // For tuple-like decompositions, if the `get` function + // is not a member of the decomposed type, but instead a + // free function (e.g., how std::get is specialized for + // std::pair), then the initializer is a `CallExpr` and + // we need to dig into the argument before unwrapping it + // with IgnoreUnlessSpelledInSource. + if (auto const *CE = llvm::dyn_cast(Init)) { +if (CE->getNumArgs() == 0) + return false; + +// The first argument will be the type we're decomposing. +// Technically the getter could have more than 1 argument +// (e.g., if they're defaulted arguments), but we don't care +// about them because we just need to check whether the +// first argument is a DecompositionDecl. +auto const *Arg = CE->getArg(0); +if (!Arg) + return false; + +Init = Arg; + } + auto const *RefExpr = llvm::dyn_cast_or_null(Init->IgnoreUnlessSpelledInSource()); if (!RefExpr) return false; - return llvm::dyn_cast_or_null(RefExpr->getDecl()); + return llvm::isa_and_nonnull(RefExpr->getDecl()); } /// Returns true if \ref VD is a compiler-generated variable diff --git a/clang/test/DebugInfo/CXX/structured-binding.cpp b/clang/test/DebugInfo/CXX/structured-binding.cpp index 8032ce85c9e25..7d4919ad52bc7 100644 --- a/clang/test/DebugInfo/CXX/structured-binding.cpp +++ b/clang/test/DebugInfo/CXX/structured-binding.cpp @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple %itanium_abi_triple %s -o - | FileCheck %s --implicit-check-not="call void @llvm.dbg.declare" +// CHECK: define noundef i32 @_Z1fv // CHECK: #dbg_declare(ptr %{{[a-z]+}}, ![[VAR_0:[0-9]+]], !DIExpression(), // CHECK: #dbg_declare(ptr %{{[0-9]+}}, ![[VAR_1:[0-9]+]], !DIExpression(), // CHECK: #dbg_declare(ptr %{{[0-9]+}}, ![[VAR_2:[0-9]+]], !DIExpression(DW_OP_plus_uconst, 4), @@ -1
[Lldb-commits] [lldb] [lldb][elf-core][ARM] Add support for VFP registers (PR #155956)
https://github.com/DavidSpickett edited https://github.com/llvm/llvm-project/pull/155956 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][elf-core][ARM] Add support for VFP registers (PR #155956)
@@ -696,6 +696,31 @@ def test_arm_core(self): self.expect("register read --all") +@skipIfLLVMTargetMissing("ARM") +def test_arm_core_vfp(self): +# check reading VFP registers +target = self.dbg.CreateTarget(None) +self.assertTrue(target, VALID_TARGET) +process = target.LoadCore("linux-arm-vfp.core") + +values = {} +values["d0"] = "0.5" +values["d1"] = "1.5" +values["d2"] = "2.5" +values["d3"] = "3.5" +values["s8"] = "4.5" +values["s9"] = "5.5" +values["s10"] = "6.5" +values["s11"] = "7.5" +values["fpscr"] = "0x2000" DavidSpickett wrote: fpcsr is an individual control register, so we check that. You're checking some D registers and then some S registers. s8 and s9 overlap d4, 10 and 11 overlap d5. There are 16 D registers, so could we check them all, or alternatively, check the very last one? This makes sure we have the note size correct, or more likely, are reading the note size from the core file correctly. I see that checking S registers that overlap D would get awkward. A nice neat number in D will be a strange number I think. So checking all S and all D is possible but awkward. I think setting and checking D16 would be enough to make this more robust. https://github.com/llvm/llvm-project/pull/155956 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Instrumentation] Set selected frame to outside sanitizer libraries (PR #133079)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/133079 >From 3d5ee1252efe24bf2c72fb4e155f8042e7334aba Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 26 Mar 2025 12:54:36 + Subject: [PATCH 1/2] [lldb][Instrumentation] Set selected frame to outside sanitizer libraries --- .../Target/InstrumentationRuntimeStopInfo.h | 3 ++ lldb/include/lldb/Target/StackFrameList.h | 2 + lldb/include/lldb/Target/Thread.h | 4 ++ .../Target/InstrumentationRuntimeStopInfo.cpp | 42 +++ lldb/source/Target/Process.cpp| 2 + 5 files changed, 53 insertions(+) diff --git a/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h b/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h index 5345160850914..dafa41c11327a 100644 --- a/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h +++ b/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h @@ -24,6 +24,9 @@ class InstrumentationRuntimeStopInfo : public StopInfo { return lldb::eStopReasonInstrumentation; } + std::optional + GetSuggestedStackFrameIndex(bool inlined_stack) override; + const char *GetDescription() override; bool DoShouldNotify(Event *event_ptr) override { return true; } diff --git a/lldb/include/lldb/Target/StackFrameList.h b/lldb/include/lldb/Target/StackFrameList.h index e5a6e942d7431..c3bebbb8428c0 100644 --- a/lldb/include/lldb/Target/StackFrameList.h +++ b/lldb/include/lldb/Target/StackFrameList.h @@ -36,6 +36,8 @@ class StackFrameList { /// Get the frame at index \p idx. Invisible frames cannot be indexed. lldb::StackFrameSP GetFrameAtIndex(uint32_t idx); + void ResetSuggestedStackFrameIndex() { m_selected_frame_idx.reset(); } + /// Get the first concrete frame with index greater than or equal to \p idx. /// Unlike \ref GetFrameAtIndex, this cannot return a synthetic frame. lldb::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx); diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h index 6ede7fa301a82..13258967c51f1 100644 --- a/lldb/include/lldb/Target/Thread.h +++ b/lldb/include/lldb/Target/Thread.h @@ -432,6 +432,10 @@ class Thread : public std::enable_shared_from_this, return GetStackFrameList()->GetFrameAtIndex(idx); } + virtual void ResetSuggestedStackFrameIndex() { +return GetStackFrameList()->ResetSuggestedStackFrameIndex(); + } + virtual lldb::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx); diff --git a/lldb/source/Target/InstrumentationRuntimeStopInfo.cpp b/lldb/source/Target/InstrumentationRuntimeStopInfo.cpp index 7f82581cc601e..1daeebdbaf9c7 100644 --- a/lldb/source/Target/InstrumentationRuntimeStopInfo.cpp +++ b/lldb/source/Target/InstrumentationRuntimeStopInfo.cpp @@ -8,13 +8,20 @@ #include "lldb/Target/InstrumentationRuntimeStopInfo.h" +#include "lldb/Core/Module.h" #include "lldb/Target/InstrumentationRuntime.h" #include "lldb/Target/Process.h" +#include "lldb/lldb-enumerations.h" #include "lldb/lldb-private.h" using namespace lldb; using namespace lldb_private; +static bool IsStoppedInDarwinSanitizer(Thread &thread, Module &module) { + return module.GetFileSpec().GetFilename().GetStringRef().starts_with( + "libclang_rt."); +} + InstrumentationRuntimeStopInfo::InstrumentationRuntimeStopInfo( Thread &thread, std::string description, StructuredData::ObjectSP additional_data) @@ -34,3 +41,38 @@ InstrumentationRuntimeStopInfo::CreateStopReasonWithInstrumentationData( return StopInfoSP( new InstrumentationRuntimeStopInfo(thread, description, additionalData)); } + +std::optional +InstrumentationRuntimeStopInfo::GetSuggestedStackFrameIndex( +bool inlined_stack) { + auto thread_sp = GetThread(); + if (!thread_sp) +return std::nullopt; + + // Defensive upper-bound of when we stop walking up the frames in + // case we somehow ended up looking at an infinite recursion. + const size_t max_stack_depth = 128; + + // Start at parent frame. + size_t stack_idx = 1; + StackFrameSP most_relevant_frame_sp = + thread_sp->GetStackFrameAtIndex(stack_idx); + + while (most_relevant_frame_sp && stack_idx <= max_stack_depth) { +auto const &sc = +most_relevant_frame_sp->GetSymbolContext(lldb::eSymbolContextModule); + +if (!sc.module_sp) + return std::nullopt; + +// Found a frame outside of the sanitizer runtime libraries. +// That's the one we want to display. +if (!IsStoppedInDarwinSanitizer(*thread_sp, *sc.module_sp)) + return stack_idx; + +++stack_idx; +most_relevant_frame_sp = thread_sp->GetStackFrameAtIndex(stack_idx); + } + + return stack_idx; +} diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index ff9e5fc12059e..754f07cb4facf 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -4269,6 +4269,8 @@ bool Process::ProcessEventData::ShouldStop(Event *eve
[Lldb-commits] [lldb] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators (PR #156050)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/156050 >From 35999d8d509864795dd36565d12ddea425a98c22 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 29 Aug 2025 16:57:35 +0100 Subject: [PATCH 1/4] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators This came up in https://github.com/llvm/llvm-project/issues/155691. For `std::basic_string` our formatter matching logic required the allocator template parameter to be a `std::allocator`. There is no compelling reason (that I know of) why this would be required for us to apply the existing formatter to the string. We don't check the `allocator` parameter for other STL containers either. This meant that `std::string` that used custom allocators wouldn't be formatted. This patch relaxes the regex for `basic_string`. --- .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 15 -- .../string/TestDataFormatterStdString.py | 6 .../generic/string/main.cpp | 30 +++ 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index c39b529f7305a..ad3c00a1132d4 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -749,31 +749,27 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxStringSummaryProviderASCII, "std::string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderASCII, "std::string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderUTF16, "std::u16string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderUTF32, "std::u32string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, @@ -784,8 +780,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxWStringSummaryProvider, "std::wstring summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py index fec20bae997ef..6a27b5d2f0780 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py @@ -80,6 +80,8 @@ def cleanup(): '(%s::string) Q = "quite a long std::strin with lots of info inside it"' % ns, "(%s::string *) null_str = nullptr" % ns, +'(CustomString) custom_str = "hello!"', +'(CustomWString) custom_wstr = L"hello!"', ], ) @@ -143,6 +145,10 @@ def do_test_multibyte(self): '(%s::u16string) u16_empty = u""' % ns, '(%s::u32string) u32_string = U"🍄🍅🍆🍌"' % ns, '(%s::u32string) u32_empty = U""' % ns, +'(CustomStringU16) custom_u16 = u"ß水氶"', +'(CustomStringU16) custom_u16_empty = u""', +'(CustomStringU32) custom_u32 = U"🍄🍅🍆🍌"', +'(CustomStringU32) custom_u32_empty = U""', ], ) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter
[Lldb-commits] [clang] [libcxx] [lldb] [llvm] [polly] [python] remove Python 3.9 specific typing annotations (PR #156868)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Charles Zablit (charles-zablit) Changes This patch replaces any occurences of lower case generic type hints with its `typing` implementation, i.e `list[str]` becomes `List[str]`. [Type hinting generic in the standard collection were introduced in Python 3.9](https://peps.python.org/pep-0585/), however the minimum supported Python version is 3.8. This patch helps maintaining backwards compatibility with Python versions lower than 3.9 and will unblock the [bots for Ubuntu 20.04](https://ci.swift.org/view/Swift%20rebranch/job/oss-swift-rebranch-package-ubuntu-20_04/2847/consoleText), which ships with 3.8. --- Patch is 34.18 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/156868.diff 23 Files Affected: - (modified) .ci/compute_projects.py (+3-4) - (modified) .ci/metrics/metrics.py (+3-2) - (modified) .github/workflows/commit-access-review.py (+2-2) - (modified) clang/bindings/python/clang/cindex.py (+11-9) - (modified) clang/docs/tools/dump_ast_matchers.py (+2-1) - (modified) cross-project-tests/debuginfo-tests/dexter/dex/dextIR/DextIR.py (+1-1) - (modified) libcxx/utils/generate_escaped_output_table.py (+5-5) - (modified) libcxx/utils/generate_extended_grapheme_cluster_table.py (+6-6) - (modified) libcxx/utils/generate_extended_grapheme_cluster_test.py (+5-5) - (modified) libcxx/utils/generate_indic_conjunct_break_table.py (+6-6) - (modified) libcxx/utils/generate_width_estimation_table.py (+5-5) - (modified) lldb/examples/python/templates/parsed_cmd.py (+3-2) - (modified) lldb/packages/Python/lldbsuite/test/decorators.py (+2-1) - (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py (+37-37) - (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py (+5-5) - (modified) lldb/test/API/functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py (+3-1) - (modified) lldb/test/API/python_api/target/TestTargetAPI.py (+3-1) - (modified) lldb/test/API/terminal/TestSTTYBeforeAndAfter.py (+4-2) - (modified) llvm/utils/UpdateTestChecks/common.py (+2-2) - (modified) llvm/utils/lldbDataFormatters.py (+3-2) - (modified) llvm/utils/spirv-sim/spirv-sim.py (+5-3) - (modified) polly/lib/External/isl/isl_test_python.py (+7-6) - (modified) third-party/benchmark/tools/strip_asm.py (+2-1) ``diff diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py index 40dd0507a9eaf..c90ef223843f6 100644 --- a/.ci/compute_projects.py +++ b/.ci/compute_projects.py @@ -7,6 +7,7 @@ """ from collections.abc import Set +from typing import List import pathlib import platform import sys @@ -115,8 +116,6 @@ "lld": "check-lld", "flang": "check-flang", "libc": "check-libc", -"lld": "check-lld", -"lldb": "check-lldb", "mlir": "check-mlir", "openmp": "check-openmp", "polly": "check-polly", @@ -204,7 +203,7 @@ def _compute_runtime_check_targets(projects_to_test: Set[str]) -> Set[str]: return check_targets -def _get_modified_projects(modified_files: list[str]) -> Set[str]: +def _get_modified_projects(modified_files: List[str]) -> Set[str]: modified_projects = set() for modified_file in modified_files: path_parts = pathlib.Path(modified_file).parts @@ -222,7 +221,7 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]: return modified_projects -def get_env_variables(modified_files: list[str], platform: str) -> Set[str]: +def get_env_variables(modified_files: List[str], platform: str) -> Set[str]: modified_projects = _get_modified_projects(modified_files) projects_to_test = _compute_projects_to_test(modified_projects, platform) projects_to_build = _compute_projects_to_build(projects_to_test) diff --git a/.ci/metrics/metrics.py b/.ci/metrics/metrics.py index 143e6ab4cf46a..cb6309bd91224 100644 --- a/.ci/metrics/metrics.py +++ b/.ci/metrics/metrics.py @@ -1,3 +1,4 @@ +from typing import List, Tuple, Set import collections import datetime import github @@ -72,8 +73,8 @@ class GaugeMetric: def github_get_metrics( -github_repo: github.Repository, last_workflows_seen_as_completed: set[int] -) -> tuple[list[JobMetrics], int]: +github_repo: github.Repository, last_workflows_seen_as_completed: Set[int] +) -> Tuple[List[JobMetrics], int]: """Gets the metrics for specified Github workflows. This function takes in a list of workflows to track, and optionally the diff --git a/.github/workflows/commit-access-review.py b/.github/workflows/commit-access-review.py index 4f539fe98004a..600541556ceba 100644 --- a/.github/workflows/commit-access-review.py +++ b/.github/workflows/commit-access-review.py @@ -9,13 +9,13 @@ # # ======# +from typing import List import datetime import github import re import requests import time im
[Lldb-commits] [clang] [libcxx] [lldb] [llvm] [polly] [python] remove Python 3.9 specific typing annotations (PR #156868)
https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/156868 This patch replaces any occurence of lower case generic type hints with its `typing` implementation, i.e `list[str]` becomes `List[str]`. [Type hinting generic in the standard collection were introduced in Python 3.9](https://peps.python.org/pep-0585/), however the minimum supported Python version is 3.8. This patch helps maintaining backwards compatibility with Python versions lower than 3.9 and will unblock the [bots for Ubuntu 20.04](https://ci.swift.org/view/Swift%20rebranch/job/oss-swift-rebranch-package-ubuntu-20_04/2847/consoleText), which ships with 3.8. >From 4be53b48dd31ebaa18c1b9d34fac78d5ce831797 Mon Sep 17 00:00:00 2001 From: Charles Zablit Date: Thu, 4 Sep 2025 12:56:53 +0100 Subject: [PATCH] [python] remove Python 3.9 specific typing annotations --- .ci/compute_projects.py | 7 +- .ci/metrics/metrics.py| 5 +- .github/workflows/commit-access-review.py | 4 +- clang/bindings/python/clang/cindex.py | 20 ++--- clang/docs/tools/dump_ast_matchers.py | 3 +- .../dexter/dex/dextIR/DextIR.py | 2 +- libcxx/utils/generate_escaped_output_table.py | 10 +-- ...enerate_extended_grapheme_cluster_table.py | 12 +-- ...generate_extended_grapheme_cluster_test.py | 10 +-- .../generate_indic_conjunct_break_table.py| 12 +-- .../utils/generate_width_estimation_table.py | 10 +-- lldb/examples/python/templates/parsed_cmd.py | 5 +- .../Python/lldbsuite/test/decorators.py | 3 +- .../test/tools/lldb-dap/dap_server.py | 74 +-- .../test/tools/lldb-dap/lldbdap_testcase.py | 10 +-- .../TestBreakpointByLineAndColumn.py | 4 +- .../API/python_api/target/TestTargetAPI.py| 4 +- .../API/terminal/TestSTTYBeforeAndAfter.py| 6 +- llvm/utils/UpdateTestChecks/common.py | 4 +- llvm/utils/lldbDataFormatters.py | 5 +- llvm/utils/spirv-sim/spirv-sim.py | 8 +- polly/lib/External/isl/isl_test_python.py | 13 ++-- third-party/benchmark/tools/strip_asm.py | 3 +- 23 files changed, 125 insertions(+), 109 deletions(-) diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py index 40dd0507a9eaf..c90ef223843f6 100644 --- a/.ci/compute_projects.py +++ b/.ci/compute_projects.py @@ -7,6 +7,7 @@ """ from collections.abc import Set +from typing import List import pathlib import platform import sys @@ -115,8 +116,6 @@ "lld": "check-lld", "flang": "check-flang", "libc": "check-libc", -"lld": "check-lld", -"lldb": "check-lldb", "mlir": "check-mlir", "openmp": "check-openmp", "polly": "check-polly", @@ -204,7 +203,7 @@ def _compute_runtime_check_targets(projects_to_test: Set[str]) -> Set[str]: return check_targets -def _get_modified_projects(modified_files: list[str]) -> Set[str]: +def _get_modified_projects(modified_files: List[str]) -> Set[str]: modified_projects = set() for modified_file in modified_files: path_parts = pathlib.Path(modified_file).parts @@ -222,7 +221,7 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]: return modified_projects -def get_env_variables(modified_files: list[str], platform: str) -> Set[str]: +def get_env_variables(modified_files: List[str], platform: str) -> Set[str]: modified_projects = _get_modified_projects(modified_files) projects_to_test = _compute_projects_to_test(modified_projects, platform) projects_to_build = _compute_projects_to_build(projects_to_test) diff --git a/.ci/metrics/metrics.py b/.ci/metrics/metrics.py index 143e6ab4cf46a..cb6309bd91224 100644 --- a/.ci/metrics/metrics.py +++ b/.ci/metrics/metrics.py @@ -1,3 +1,4 @@ +from typing import List, Tuple, Set import collections import datetime import github @@ -72,8 +73,8 @@ class GaugeMetric: def github_get_metrics( -github_repo: github.Repository, last_workflows_seen_as_completed: set[int] -) -> tuple[list[JobMetrics], int]: +github_repo: github.Repository, last_workflows_seen_as_completed: Set[int] +) -> Tuple[List[JobMetrics], int]: """Gets the metrics for specified Github workflows. This function takes in a list of workflows to track, and optionally the diff --git a/.github/workflows/commit-access-review.py b/.github/workflows/commit-access-review.py index 4f539fe98004a..600541556ceba 100644 --- a/.github/workflows/commit-access-review.py +++ b/.github/workflows/commit-access-review.py @@ -9,13 +9,13 @@ # # ======# +from typing import List import datetime import github import re import requests import time import sys -import re class User: @@ -64,7 +64,7 @@ def __repr__(self): def check_manual_requests( gh: github.Github, start_date: datetime.datetime -) -> list[str]: +) -> List[str]: """ Retu
[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)
@@ -283,6 +283,21 @@ serveConnection(const Socket::SocketProtocol &protocol, const std::string &name, g_loop.AddPendingCallback( [](MainLoopBase &loop) { loop.RequestTermination(); }); }); + static MainLoopBase::TimePoint ttl_time_point; walter-erquinigo wrote: add the g_ prefix to this variable because it's a global https://github.com/llvm/llvm-project/pull/156803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)
@@ -61,3 +61,10 @@ def pre_init_command: S<"pre-init-command">, def: Separate<["-"], "c">, Alias, HelpText<"Alias for --pre-init-command">; + +def time_to_live: S<"time-to-live">, + MetaVarName<"">, + HelpText<"When using --connection, the number of milliseconds to wait " +"for new connections at the beginning and after all clients have " +"disconnected. Not specifying this argument or specifying " walter-erquinigo wrote: You should also elaborate more in a new section in the documentation of lldb-dap, which is in `lldb/tools/lldb-dap/README.md` https://github.com/llvm/llvm-project/pull/156803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)
@@ -283,6 +283,21 @@ serveConnection(const Socket::SocketProtocol &protocol, const std::string &name, g_loop.AddPendingCallback( [](MainLoopBase &loop) { loop.RequestTermination(); }); }); + static MainLoopBase::TimePoint ttl_time_point; + static std::mutex ttl_mutex; + if (ttl > 0) { +std::scoped_lock lock(ttl_mutex); +MainLoopBase::TimePoint future = +std::chrono::steady_clock::now() + std::chrono::milliseconds(ttl); +ttl_time_point = future; +g_loop.AddCallback( +[future](MainLoopBase &loop) { + if (ttl_time_point == future) { +loop.RequestTermination(); + } +}, +future); + } walter-erquinigo wrote: this code is basically the same as the one above, please refactor it into a helper function https://github.com/llvm/llvm-project/pull/156803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)
@@ -283,6 +283,21 @@ serveConnection(const Socket::SocketProtocol &protocol, const std::string &name, g_loop.AddPendingCallback( [](MainLoopBase &loop) { loop.RequestTermination(); }); }); + static MainLoopBase::TimePoint ttl_time_point; + static std::mutex ttl_mutex; walter-erquinigo wrote: ditto https://github.com/llvm/llvm-project/pull/156803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Target] Clear selected frame index after a StopInfo::PerformAction (PR #133078)
Michael137 wrote: > The only bad effect I can see just from looking at the patch is if I had > selected frame 5 of a given thread, and then had run an expression. I want to > make sure that when the expression is done running, we don't set the selected > frame back to 0 (or whatever the most relevant frame machinery would choose). > It should stay at 5. I am pretty sure that will work because the expression > evaluator resets the frame by hand when it's done. But we should make sure > I'm right about that. Other than that, this still seems fine to me. Yup, I tried running an expression from a different frame and after the expression completed the selected frame was the one we started with. https://github.com/llvm/llvm-project/pull/133078 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [clang][Expr] Teach IgnoreUnlessSpelledInSource about implicit calls to std::get free function (PR #122265)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/122265 >From a9e13ad8d2a7a95d431dddcced611bea1e83b99a Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 9 Jan 2025 10:01:31 + Subject: [PATCH 01/11] [clang][DebugInfo] Expand detection of structured bindings to account for std::get free function When we generate the debug-info for a `VarDecl` we try to determine whether it was introduced as part of a structure binding (aka a "holding var"). If it was, we don't mark it as `artificial`. The heuristic to determine a holding var uses `IgnoreUnlessSpelledInSource` to unwrap the `VarDecl` initializer until we hit a `DeclRefExpr` that refers to a `Decomposition`. For "tuple-like decompositions", Clang will generate a call to a `template Foo get(Bar)` function that retrieves the `Ith` element from the tuple-like structure. If that function is a member function, we get an AST that looks as follows: ``` VarDecl implicit used z1 'std::tuple_element<0, B>::type &&' cinit `-ExprWithCleanups 'int' xvalue `-MaterializeTemporaryExpr 'int' xvalue extended by Var 0x11d110cf8 'z1' 'std::tuple_element<0, B>::type &&' `-CXXMemberCallExpr 'int' `-MemberExpr '' .get 0x11d104390 `-ImplicitCastExpr 'B' xvalue `-DeclRefExpr 'B' lvalue Decomposition 0x11d1100a8 '' 'B' ``` `IgnoreUnlessSpelledInSource` happily unwraps this down to the `DeclRefExpr`. However, when the `get` helper is a free function (which it is for `std::pair` in libc++ for example), then the AST is: ``` VarDecl col:16 implicit used k 'std::tuple_element<0, const std::tuple>::type &' cinit `-CallExpr 'const typename tuple_element<0UL, tuple>::type':'const int' lvalue adl |-ImplicitCastExpr 'const typename tuple_element<0UL, tuple>::type &(*)(const tuple &) noexcept' | `-DeclRefExpr 'const typename tuple_element<0UL, tuple>::type &(const tuple &) noexcept' lvalue Function 0x1210262d8 'get' 'const typename tuple_element<0UL, tuple>::type &(const tuple &) noexcept' (FunctionTemplate 0x11d068088 'get') `-DeclRefExpr 'const std::tuple' lvalue Decomposition 0x121021518 '' 'const std::tuple &' ``` `IgnoreUnlessSpelledInSource` doesn't unwrap this `CallExpr`, so we incorrectly mark the binding as `artificial` in debug-info. This patch adjusts our heuristic to account for `CallExpr` nodes. Fixes https://github.com/llvm/llvm-project/issues/122028 --- clang/lib/CodeGen/CGDebugInfo.cpp | 28 ++- .../test/DebugInfo/CXX/structured-binding.cpp | 27 +++ .../TestStructuredBinding.py | 11 +++ .../API/lang/cpp/structured-binding/main.cpp | 81 +-- 4 files changed, 140 insertions(+), 7 deletions(-) diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 0385dbdac869b..4b0f2bce457df 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -87,12 +87,38 @@ static bool IsDecomposedVarDecl(VarDecl const *VD) { if (!Init) return false; + Init = Init->IgnoreUnlessSpelledInSource(); + if (!Init) +return false; + + // For tuple-like decompositions, if the `get` function + // is not a member of the decomposed type, but instead a + // free function (e.g., how std::get is specialized for + // std::pair), then the initializer is a `CallExpr` and + // we need to dig into the argument before unwrapping it + // with IgnoreUnlessSpelledInSource. + if (auto const *CE = llvm::dyn_cast(Init)) { +if (CE->getNumArgs() == 0) + return false; + +// The first argument will be the type we're decomposing. +// Technically the getter could have more than 1 argument +// (e.g., if they're defaulted arguments), but we don't care +// about them because we just need to check whether the +// first argument is a DecompositionDecl. +auto const *Arg = CE->getArg(0); +if (!Arg) + return false; + +Init = Arg; + } + auto const *RefExpr = llvm::dyn_cast_or_null(Init->IgnoreUnlessSpelledInSource()); if (!RefExpr) return false; - return llvm::dyn_cast_or_null(RefExpr->getDecl()); + return llvm::isa_and_nonnull(RefExpr->getDecl()); } /// Returns true if \ref VD is a compiler-generated variable diff --git a/clang/test/DebugInfo/CXX/structured-binding.cpp b/clang/test/DebugInfo/CXX/structured-binding.cpp index 8032ce85c9e25..7d4919ad52bc7 100644 --- a/clang/test/DebugInfo/CXX/structured-binding.cpp +++ b/clang/test/DebugInfo/CXX/structured-binding.cpp @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple %itanium_abi_triple %s -o - | FileCheck %s --implicit-check-not="call void @llvm.dbg.declare" +// CHECK: define noundef i32 @_Z1fv // CHECK: #dbg_declare(ptr %{{[a-z]+}}, ![[VAR_0:[0-9]+]], !DIExpression(), // CHECK: #dbg_declare(ptr %{{[0-9]+}}, ![[VAR_1:[0-9]+]], !DIExpression(), // CHECK: #dbg_declare(ptr %{{[0-9]+}}, ![[VAR_2:[0-9]+]], !DIExpression(DW_OP_plus_uconst, 4), @@ -1
[Lldb-commits] [clang] [lldb] [clang][Expr] Teach IgnoreUnlessSpelledInSource about implicit calls to std::get free function (PR #122265)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/122265 >From a9e13ad8d2a7a95d431dddcced611bea1e83b99a Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 9 Jan 2025 10:01:31 + Subject: [PATCH 01/12] [clang][DebugInfo] Expand detection of structured bindings to account for std::get free function When we generate the debug-info for a `VarDecl` we try to determine whether it was introduced as part of a structure binding (aka a "holding var"). If it was, we don't mark it as `artificial`. The heuristic to determine a holding var uses `IgnoreUnlessSpelledInSource` to unwrap the `VarDecl` initializer until we hit a `DeclRefExpr` that refers to a `Decomposition`. For "tuple-like decompositions", Clang will generate a call to a `template Foo get(Bar)` function that retrieves the `Ith` element from the tuple-like structure. If that function is a member function, we get an AST that looks as follows: ``` VarDecl implicit used z1 'std::tuple_element<0, B>::type &&' cinit `-ExprWithCleanups 'int' xvalue `-MaterializeTemporaryExpr 'int' xvalue extended by Var 0x11d110cf8 'z1' 'std::tuple_element<0, B>::type &&' `-CXXMemberCallExpr 'int' `-MemberExpr '' .get 0x11d104390 `-ImplicitCastExpr 'B' xvalue `-DeclRefExpr 'B' lvalue Decomposition 0x11d1100a8 '' 'B' ``` `IgnoreUnlessSpelledInSource` happily unwraps this down to the `DeclRefExpr`. However, when the `get` helper is a free function (which it is for `std::pair` in libc++ for example), then the AST is: ``` VarDecl col:16 implicit used k 'std::tuple_element<0, const std::tuple>::type &' cinit `-CallExpr 'const typename tuple_element<0UL, tuple>::type':'const int' lvalue adl |-ImplicitCastExpr 'const typename tuple_element<0UL, tuple>::type &(*)(const tuple &) noexcept' | `-DeclRefExpr 'const typename tuple_element<0UL, tuple>::type &(const tuple &) noexcept' lvalue Function 0x1210262d8 'get' 'const typename tuple_element<0UL, tuple>::type &(const tuple &) noexcept' (FunctionTemplate 0x11d068088 'get') `-DeclRefExpr 'const std::tuple' lvalue Decomposition 0x121021518 '' 'const std::tuple &' ``` `IgnoreUnlessSpelledInSource` doesn't unwrap this `CallExpr`, so we incorrectly mark the binding as `artificial` in debug-info. This patch adjusts our heuristic to account for `CallExpr` nodes. Fixes https://github.com/llvm/llvm-project/issues/122028 --- clang/lib/CodeGen/CGDebugInfo.cpp | 28 ++- .../test/DebugInfo/CXX/structured-binding.cpp | 27 +++ .../TestStructuredBinding.py | 11 +++ .../API/lang/cpp/structured-binding/main.cpp | 81 +-- 4 files changed, 140 insertions(+), 7 deletions(-) diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 0385dbdac869b..4b0f2bce457df 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -87,12 +87,38 @@ static bool IsDecomposedVarDecl(VarDecl const *VD) { if (!Init) return false; + Init = Init->IgnoreUnlessSpelledInSource(); + if (!Init) +return false; + + // For tuple-like decompositions, if the `get` function + // is not a member of the decomposed type, but instead a + // free function (e.g., how std::get is specialized for + // std::pair), then the initializer is a `CallExpr` and + // we need to dig into the argument before unwrapping it + // with IgnoreUnlessSpelledInSource. + if (auto const *CE = llvm::dyn_cast(Init)) { +if (CE->getNumArgs() == 0) + return false; + +// The first argument will be the type we're decomposing. +// Technically the getter could have more than 1 argument +// (e.g., if they're defaulted arguments), but we don't care +// about them because we just need to check whether the +// first argument is a DecompositionDecl. +auto const *Arg = CE->getArg(0); +if (!Arg) + return false; + +Init = Arg; + } + auto const *RefExpr = llvm::dyn_cast_or_null(Init->IgnoreUnlessSpelledInSource()); if (!RefExpr) return false; - return llvm::dyn_cast_or_null(RefExpr->getDecl()); + return llvm::isa_and_nonnull(RefExpr->getDecl()); } /// Returns true if \ref VD is a compiler-generated variable diff --git a/clang/test/DebugInfo/CXX/structured-binding.cpp b/clang/test/DebugInfo/CXX/structured-binding.cpp index 8032ce85c9e25..7d4919ad52bc7 100644 --- a/clang/test/DebugInfo/CXX/structured-binding.cpp +++ b/clang/test/DebugInfo/CXX/structured-binding.cpp @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple %itanium_abi_triple %s -o - | FileCheck %s --implicit-check-not="call void @llvm.dbg.declare" +// CHECK: define noundef i32 @_Z1fv // CHECK: #dbg_declare(ptr %{{[a-z]+}}, ![[VAR_0:[0-9]+]], !DIExpression(), // CHECK: #dbg_declare(ptr %{{[0-9]+}}, ![[VAR_1:[0-9]+]], !DIExpression(), // CHECK: #dbg_declare(ptr %{{[0-9]+}}, ![[VAR_2:[0-9]+]], !DIExpression(DW_OP_plus_uconst, 4), @@ -1
[Lldb-commits] [clang] [libcxx] [lldb] [llvm] [polly] [python] remove Python 3.9 specific typing annotations (PR #156868)
https://github.com/DeinAlptraum requested changes to this pull request. Re: Python bindings (`clang/bindings/python/clang/cindex.py`) We `from __future__ import annotations` at the start of `cindex.py` which allows using the PEP 585 features (among others). We have a CI job that runs the libclang-python tests against 3.8 and 3.13, see here: https://github.com/llvm/llvm-project/actions/workflows/libclang-python-tests.yml I have also tested this locally, and I can successfully run both the cindex tests and the mypy type checker on it with Python 3.8. (removing the future import produces the problems your PR would have resolved) Besides, I see no reference to the libclang python tests in the build log you've linked. Sidenote regarding the other files (which I'm not maintainer for, so cannot say much about them): consider doing the same thing there, to similarly import from future, instead of changing all generic collection types. https://github.com/llvm/llvm-project/pull/156868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libcxx] [lldb] [llvm] [polly] [python] remove Python 3.9 specific typing annotations (PR #156868)
DeinAlptraum wrote: @DavidSpickett the `typing` module is part of the standard library, so there is no need to install it https://github.com/llvm/llvm-project/pull/156868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libcxx] [lldb] [llvm] [polly] [python] remove Python 3.9 specific typing annotations (PR #156868)
https://github.com/DeinAlptraum edited https://github.com/llvm/llvm-project/pull/156868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Introduce ScriptedFrame affordance (PR #149622)
https://github.com/medismailben updated https://github.com/llvm/llvm-project/pull/149622 >From df4c41ddc529dce9aac96a698199cb6ed4506000 Mon Sep 17 00:00:00 2001 From: Med Ismail Bennani Date: Thu, 4 Sep 2025 10:21:46 -0700 Subject: [PATCH] [lldb] Introduce ScriptedFrame affordance This patch introduces a new scripting affordance in lldb: `ScriptedFrame`. This allows user to produce mock stackframes in scripted threads and scripted processes from a python script. With this change, StackFrame can be synthetized from different sources: - Either from a dictionary containing a load address, and a frame index, which is the legacy way. - Or by creating a ScriptedFrame python object. One particularity of synthezising stackframes from the ScriptedFrame python object, is that these frame have an optional PC, meaning that they don't have a report a valid PC and they can act as shells that just contain static information, like the frame function name, the list of variables or registers, etc. It can also provide a symbol context. rdar://157260006 Signed-off-by: Med Ismail Bennani --- lldb/bindings/python/python-wrapper.swig | 1 + .../python/templates/scripted_process.py | 136 + lldb/include/lldb/API/SBSymbolContext.h | 1 + .../Interfaces/ScriptedFrameInterface.h | 55 + .../Interfaces/ScriptedThreadInterface.h | 10 + .../lldb/Interpreter/ScriptInterpreter.h | 5 + lldb/include/lldb/Target/StackFrame.h | 34 ++-- lldb/include/lldb/lldb-forward.h | 3 + lldb/source/Core/FormatEntity.cpp | 2 +- .../Plugins/Process/scripted/CMakeLists.txt | 1 + .../Process/scripted/ScriptedFrame.cpp| 191 ++ .../Plugins/Process/scripted/ScriptedFrame.h | 63 ++ .../Process/scripted/ScriptedThread.cpp | 82 +++- .../Plugins/Process/scripted/ScriptedThread.h | 5 +- .../Python/Interfaces/CMakeLists.txt | 1 + .../ScriptInterpreterPythonInterfaces.h | 1 + .../ScriptedFramePythonInterface.cpp | 157 ++ .../Interfaces/ScriptedFramePythonInterface.h | 59 ++ .../Interfaces/ScriptedPythonInterface.cpp| 3 +- .../ScriptedThreadPythonInterface.cpp | 17 ++ .../ScriptedThreadPythonInterface.h | 5 + .../Python/ScriptInterpreterPython.cpp| 5 + .../Python/ScriptInterpreterPythonImpl.h | 2 + lldb/source/Symbol/LineEntry.cpp | 4 +- .../dummy_scripted_process.py | 75 ++- 25 files changed, 883 insertions(+), 35 deletions(-) create mode 100644 lldb/include/lldb/Interpreter/Interfaces/ScriptedFrameInterface.h create mode 100644 lldb/source/Plugins/Process/scripted/ScriptedFrame.cpp create mode 100644 lldb/source/Plugins/Process/scripted/ScriptedFrame.h create mode 100644 lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFramePythonInterface.cpp create mode 100644 lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFramePythonInterface.h diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index 2c30d536a753d..c0ad456bc12e8 100644 --- a/lldb/bindings/python/python-wrapper.swig +++ b/lldb/bindings/python/python-wrapper.swig @@ -519,6 +519,7 @@ void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(PyOb return sb_ptr; } + void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBExecutionContext(PyObject * data) { lldb::SBExecutionContext *sb_ptr = NULL; diff --git a/lldb/examples/python/templates/scripted_process.py b/lldb/examples/python/templates/scripted_process.py index b6360b8519077..49059d533f38a 100644 --- a/lldb/examples/python/templates/scripted_process.py +++ b/lldb/examples/python/templates/scripted_process.py @@ -383,6 +383,142 @@ def get_extended_info(self): """ return self.extended_info +def get_scripted_frame_plugin(self): +"""Get scripted frame plugin name. + +Returns: +str: Name of the scripted frame plugin. +""" +return None + + +class ScriptedFrame(metaclass=ABCMeta): +""" +The base class for a scripted frame. + +Most of the base class methods are `@abstractmethod` that need to be +overwritten by the inheriting class. +""" + +@abstractmethod +def __init__(self, thread, args): +"""Construct a scripted frame. + +Args: +thread (ScriptedThread): The thread owning this frame. +args (lldb.SBStructuredData): A Dictionary holding arbitrary +key/value pairs used by the scripted frame. +""" +self.target = None +self.originating_thread = None +self.thread = None +self.args = None +self.id = None +self.name = None +self.register_info = None +self.register_ctx = {}
[Lldb-commits] [lldb] [LLDB] Fix tests that fail when using internal shell. (PR #156931)
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 origin/main HEAD --extensions cpp -- lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp `` :warning: The reproduction instructions above might return results for more than one PR in a stack if you are using a stacked PR workflow. You can limit the results by changing `origin/main` to the base branch/commit you want to compare against. :warning: View the diff from clang-format here. ``diff diff --git a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp index a45f794c7..13fe3898e 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp @@ -7,5 +7,4 @@ // RUN: %lldb %t -o "breakpoint set -f %s -l 11" -o run -o exit | FileCheck %s // CHECK: stop reason = breakpoint - int main() { return 0; } `` https://github.com/llvm/llvm-project/pull/156931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Fix tests that fail when using internal shell. (PR #156931)
https://github.com/cmtice updated https://github.com/llvm/llvm-project/pull/156931 >From f1418f873ce40963ca09e39490c202da503535ce Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Thu, 4 Sep 2025 10:14:20 -0700 Subject: [PATCH 1/2] [LLDB] Fix tests that fail when using internal shell. These tests were failing on darwin, because the internal shell needs environment var definitions to start with 'env'. This PR (hopefully) fixes that problem. --- lldb/test/Shell/Host/TestCustomShell.test| 2 +- lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp | 2 +- lldb/test/Shell/SymbolFile/add-dsym.test | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/test/Shell/Host/TestCustomShell.test b/lldb/test/Shell/Host/TestCustomShell.test index 0e948a1b1f7f3..5d3e90162fb28 100644 --- a/lldb/test/Shell/Host/TestCustomShell.test +++ b/lldb/test/Shell/Host/TestCustomShell.test @@ -6,7 +6,7 @@ # XFAIL: system-openbsd # RUN: %clang_host %S/Inputs/simple.c -g -o %t.out -# RUN: SHELL=bogus not %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s --check-prefix ERROR +# RUN: env SHELL=bogus not %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s --check-prefix ERROR # RUN: env -i ASAN_OPTIONS='detect_container_overflow=0' %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s # ERROR: error: shell expansion failed diff --git a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp index 9e79f23db2b74..a45f794c73a43 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp @@ -3,7 +3,7 @@ // requires the ld64 linker, which clang invokes by default. // REQUIRES: system-darwin // RUN: %clang_host %s -g -c -o %t.o -// RUN: ZERO_AR_DATE=1 %clang_host %t.o -g -o %t +// RUN: env ZERO_AR_DATE=1 %clang_host %t.o -g -o %t // RUN: %lldb %t -o "breakpoint set -f %s -l 11" -o run -o exit | FileCheck %s // CHECK: stop reason = breakpoint diff --git a/lldb/test/Shell/SymbolFile/add-dsym.test b/lldb/test/Shell/SymbolFile/add-dsym.test index 52d1a1363feef..9695ddc297aa9 100644 --- a/lldb/test/Shell/SymbolFile/add-dsym.test +++ b/lldb/test/Shell/SymbolFile/add-dsym.test @@ -4,5 +4,5 @@ # HELP: Syntax: add-dsym # RUN: yaml2obj %S/Inputs/a.yaml -o %t.out -# RUN: LLDB_APPLE_DSYMFORUUID_EXECUTABLE=%S/Inputs/dsymforuuid.sh %lldb %t.out -o 'add-dsym -u 41945CA4-5D9D-3CDE-82B4-37E4C09750B5' 2>&1 | FileCheck %s +# RUN: env LLDB_APPLE_DSYMFORUUID_EXECUTABLE=%S/Inputs/dsymforuuid.sh %lldb %t.out -o 'add-dsym -u 41945CA4-5D9D-3CDE-82B4-37E4C09750B5' 2>&1 | FileCheck %s # CHECK: UUID information was not found >From ca2e305d6b7c588ef754202a35201bf2f87c3b94 Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Thu, 4 Sep 2025 10:23:29 -0700 Subject: [PATCH 2/2] Fix clang format issue. --- lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp index a45f794c73a43..13fe3898e50aa 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp @@ -7,5 +7,4 @@ // RUN: %lldb %t -o "breakpoint set -f %s -l 11" -o run -o exit | FileCheck %s // CHECK: stop reason = breakpoint - int main() { return 0; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Expression] Reject languages not supported by TypeSystems for expression evaluation (PR #156648)
jimingham wrote: The other scenario is accessing an extant C global variable (maybe even one you don't have debug info for) called "class" or "namespace". But more importantly, having this sort of secret out that is applied inconsistently will just make lldb more confusing. It's fine to say "the support for the 'C' language is incomplete" but to treat it inconsistently just makes it harder to understand how lldb is working for you. https://github.com/llvm/llvm-project/pull/156648 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Fix tests that fail when using internal shell. (PR #156931)
https://github.com/boomanaiden154 edited https://github.com/llvm/llvm-project/pull/156931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Fix tests that fail when using internal shell. (PR #156931)
@@ -6,7 +6,7 @@ # XFAIL: system-openbsd # RUN: %clang_host %S/Inputs/simple.c -g -o %t.out -# RUN: SHELL=bogus not %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s --check-prefix ERROR +# RUN: env SHELL=bogus not %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s --check-prefix ERROR # RUN: env -i ASAN_OPTIONS='detect_container_overflow=0' %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s boomanaiden154 wrote: This will still fail because lit's internal shell doesn't support `env -i` yet (and I confirmed that it still fails locally). https://github.com/llvm/llvm-project/pull/156931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)
royitaqi wrote: @JDevlieghere Thanks for the good questions. I appreciate all of them. Below are my thoughts for discussion. > proliferation of new options > motivation Main motivation is memory pressure. Other ways to counter memory pressure is either to monitor from lldb-dap VS Code extension and SIGINT for lldb-dap process to stop, OR use "memory pressure detected" from within lldb-dap process but the timing is tricky. Side product is that the periodical restart will also clean up bad states that may happen. > command line option vs. over the protocol vs. VS Code settings IIUC, there are two aspects to it: lifetime, and where to live. The following is my thoughts but no strong opinion. Lifetime of the option: I feel this option is better for the lifetime of the lldb-dap process, because it should be consistent across different connections. Or maybe I'm missing a scenario where per-connection or per-target value works better. I think the above decides "where does the option live". If we decide that the option is better for the whole process, then I think we need both a command line argument and a VS Code setting. If it's going to be per connection, then we need a VS Code setting. > milliseconds Yeah I thought seconds/minutes will be more intuitive, too. FWIW, did a calculation, max int in milliseconds is about 24.8 days. I don't think anyone would want that long of a TTL, so the range seems big enough. But yeah, seconds/minutes would probably make more sense (who is gonna use <1s TTL, right?). > This definitely needs a test Yes, definitely (see "I will find a test file to add tests." in PR description). Yeah probably set TTL to be a 1 second and wait for it to terminate correctly within 3 seconds. https://github.com/llvm/llvm-project/pull/156803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Correct style of error messages (PR #156774)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/156774 The LLVM Style Guide says the following about error and warning messages [1]: > [T]o match error message styles commonly produced by other tools, > start the first sentence with a lowercase letter, and finish the last > sentence without a period, if it would end in one otherwise. I often provide this feedback during code review, but we still have a bunch of places where we have inconsistent error message, which bothers me as a user. This PR identifies a handful of those places and updates the messages to be consistent. [1] https://llvm.org/docs/CodingStandards.html#error-and-warning-messages >From e06f3823296797ab3b23003999d415f5ea6785d4 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 3 Sep 2025 16:45:13 -0700 Subject: [PATCH] [lldb] Correct style of error messages The LLVM Style Guide says the following about error and warning messages [1]: > [T]o match error message styles commonly produced by other tools, > start the first sentence with a lowercase letter, and finish the last > sentence without a period, if it would end in one otherwise. I often provide this feedback during code review, but we still have a bunch of places where we have inconsistent error message, which bothers me as a user. This PR identifies a handful of those places and updates the messages to be consistent. [1] https://llvm.org/docs/CodingStandards.html#error-and-warning-messages --- lldb/source/API/SBCommandInterpreter.cpp | 2 +- .../Commands/CommandObjectBreakpoint.cpp | 36 +-- .../source/Commands/CommandObjectCommands.cpp | 4 +-- lldb/source/Commands/CommandObjectFrame.cpp | 8 ++--- lldb/source/Commands/CommandObjectLog.cpp | 2 +- .../Commands/CommandObjectMultiword.cpp | 2 +- lldb/source/Commands/CommandObjectProcess.cpp | 2 +- lldb/source/Commands/CommandObjectSource.cpp | 6 ++-- lldb/source/Commands/CommandObjectTarget.cpp | 6 ++-- lldb/source/Commands/CommandObjectThread.cpp | 2 +- .../Commands/CommandObjectWatchpoint.cpp | 24 ++--- .../CommandObjectWatchpointCommand.cpp| 6 ++-- lldb/source/Expression/DWARFExpression.cpp| 2 +- .../source/Expression/DWARFExpressionList.cpp | 2 +- .../source/Interpreter/CommandInterpreter.cpp | 6 ++-- lldb/source/Interpreter/CommandObject.cpp | 6 ++-- lldb/source/Interpreter/Options.cpp | 2 +- .../Language/CPlusPlus/LibCxxVector.cpp | 10 +++--- .../Language/CPlusPlus/MsvcStlVector.cpp | 10 +++--- .../script/add/TestAddParsedCommand.py| 2 +- .../commands/frame/select/TestFrameSelect.py | 6 ++-- ...taFormatterLibcxxInvalidVectorSimulator.py | 10 +++--- .../TestMultiWordCommands.py | 2 +- .../TestRunCommandInterpreterAPI.py | 2 +- .../API/SBCommandInterpreterTest.cpp | 4 +-- 25 files changed, 82 insertions(+), 82 deletions(-) diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index 4ea79d336e08d..34323bc5a2c37 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -208,7 +208,7 @@ void SBCommandInterpreter::HandleCommandsFromFile( LLDB_INSTRUMENT_VA(this, file, override_context, options, result); if (!IsValid()) { -result->AppendError("SBCommandInterpreter is not valid."); +result->AppendError("SBCommandInterpreter is not valid"); return; } diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index 38ec375c03070..de0a7e7093411 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -609,12 +609,12 @@ class CommandObjectBreakpointSet : public CommandObjectParsed { const size_t num_files = m_options.m_filenames.GetSize(); if (num_files == 0) { if (!GetDefaultFile(target, file, result)) { - result.AppendError("No file supplied and no default file available."); + result.AppendError("no file supplied and no default file available"); return; } } else if (num_files > 1) { -result.AppendError("Only one file at a time is allowed for file and " - "line breakpoints."); +result.AppendError("only one file at a time is allowed for file and " + "line breakpoints"); return; } else file = m_options.m_filenames.GetFileSpecAtIndex(0); @@ -784,7 +784,7 @@ class CommandObjectBreakpointSet : public CommandObjectParsed { } result.SetStatus(eReturnStatusSuccessFinishResult); } else if (!bp_sp) { - result.AppendError("Breakpoint creation failed: No breakpoint created."); + result.AppendError("breakpoint creation failed: no breakpoint created"); } } @@ -940,7 +940,7 @@ class CommandObjectB
[Lldb-commits] [lldb] [LLDB] Fix tests that fail when using internal shell. (PR #156931)
https://github.com/boomanaiden154 commented: `lldb/test/Shell/Host/TestCustomShell.test` will still fail after this, but this change is still necessary either way. It does fix the other two tests and enables implementing `env -i` within lit's internal shell to fix `lldb/test/Shell/Host/TestCustomShell.test`. I'm hoping to get to implementing `env -i` within the next hour or two. https://github.com/llvm/llvm-project/pull/156931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Fix tests that fail when using internal shell. (PR #156931)
https://github.com/boomanaiden154 approved this pull request. https://github.com/llvm/llvm-project/pull/156931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Correct style of error messages (PR #156774)
https://github.com/DavidSpickett commented: llvm.org having issues at the moment so I can't read the guidance but sure why not, if that's the format it wants. Wonder about multiple sentence messages though. https://github.com/llvm/llvm-project/pull/156774 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [python] remove Python 3.9 specific typing annotations (PR #156868)
https://github.com/DeinAlptraum edited https://github.com/llvm/llvm-project/pull/156868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [python] remove Python 3.9 specific typing annotations (PR #156868)
https://github.com/charles-zablit edited https://github.com/llvm/llvm-project/pull/156868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][elf-core][ARM] Add support for VFP registers (PR #155956)
@@ -152,6 +152,11 @@ constexpr RegsetDesc AARCH64_GCS_Desc[] = { {llvm::Triple::Linux, llvm::Triple::aarch64, llvm::ELF::NT_ARM_GCS}, }; +constexpr RegsetDesc ARM_VFP_Desc[] = { +{llvm::Triple::FreeBSD, llvm::Triple::UnknownArch, llvm::ELF::NT_ARM_VFP}, +{llvm::Triple::Linux, llvm::Triple::UnknownArch, llvm::ELF::NT_ARM_VFP}, DavidSpickett wrote: UnknownArch -> Arm https://github.com/llvm/llvm-project/pull/155956 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][elf-core][ARM] Add support for VFP registers (PR #155956)
https://github.com/DavidSpickett commented: I wanted to say merge this into the existing `linux-arm.core` but I can't find any source for it. So I'm ok with this being its own thing, and if you do have time, extending it to set GPR and replacing the existing core file would be great. https://github.com/llvm/llvm-project/pull/155956 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix unordered-map test (PR #156033)
labath wrote: The script code is not an exact equivalent of the "frame var" expression. Notice how in the "frame var", you explicitly dereference the object, while in the script, you call GetChildAtIndex directly on the pointer value. The "frame var" expression would be more similar to `script lldb.frame.FindVariable("ptr1").Dereference().GetChildAtIndex(0)`, and I'd guess (I didn't try reproducing this) that this will print the map member correctly. That doesn't quite explain why is this failing, it might give us a clue about what could be happening. I suspect the problem here is that the map data formatter is just misbehaving when given a pointer value, and the implementation happens to end up returning the parent of the actual pair value. According to grep the `__cc_` member is used in the c++03 implementation of the map, and I don't think many people use/test the data formatters in c++03 mode, so it's kind of surprising that the formatter works at all. https://github.com/llvm/llvm-project/pull/156033 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Make internal shell the default for running LLDB lit tests. (PR #156729)
cmtice wrote: > Ok, I will revert this and try to work out how to test/fix the issues on > windows (I wonder why it passed the windows CI premerge tests). Maybe not? The failing test has already been updated and marked as 'Unsupported' on windows? https://github.com/llvm/llvm-project/pull/156729 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NativePDB] Find global variables in namespaces (PR #156736)
https://github.com/Nerixyz closed https://github.com/llvm/llvm-project/pull/156736 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators (PR #156050)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/156050 >From 35999d8d509864795dd36565d12ddea425a98c22 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 29 Aug 2025 16:57:35 +0100 Subject: [PATCH 1/5] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators This came up in https://github.com/llvm/llvm-project/issues/155691. For `std::basic_string` our formatter matching logic required the allocator template parameter to be a `std::allocator`. There is no compelling reason (that I know of) why this would be required for us to apply the existing formatter to the string. We don't check the `allocator` parameter for other STL containers either. This meant that `std::string` that used custom allocators wouldn't be formatted. This patch relaxes the regex for `basic_string`. --- .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 15 -- .../string/TestDataFormatterStdString.py | 6 .../generic/string/main.cpp | 30 +++ 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index c39b529f7305a..ad3c00a1132d4 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -749,31 +749,27 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxStringSummaryProviderASCII, "std::string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderASCII, "std::string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderUTF16, "std::u16string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderUTF32, "std::u32string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, @@ -784,8 +780,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxWStringSummaryProvider, "std::wstring summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py index fec20bae997ef..6a27b5d2f0780 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py @@ -80,6 +80,8 @@ def cleanup(): '(%s::string) Q = "quite a long std::strin with lots of info inside it"' % ns, "(%s::string *) null_str = nullptr" % ns, +'(CustomString) custom_str = "hello!"', +'(CustomWString) custom_wstr = L"hello!"', ], ) @@ -143,6 +145,10 @@ def do_test_multibyte(self): '(%s::u16string) u16_empty = u""' % ns, '(%s::u32string) u32_string = U"🍄🍅🍆🍌"' % ns, '(%s::u32string) u32_empty = U""' % ns, +'(CustomStringU16) custom_u16 = u"ß水氶"', +'(CustomStringU16) custom_u16_empty = u""', +'(CustomStringU32) custom_u32 = U"🍄🍅🍆🍌"', +'(CustomStringU32) custom_u32_empty = U""', ], ) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter
[Lldb-commits] [lldb] [lldb] Add more command option mnemonics (PR #155705)
https://github.com/jimingham approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/155705 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Don't crash if no default unwind plan (PR #152481)
nikic wrote: Ping :) https://github.com/llvm/llvm-project/pull/152481 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Make internal shell the default for running LLDB lit tests. (PR #156729)
adrian-prantl wrote: @cmtice I suspect that this may have broken three tests: https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-cmake/14836/ Could you revert/investigate? Let me know if you need any data or help reproducing. https://github.com/llvm/llvm-project/pull/156729 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libcxx] [lldb] [llvm] [polly] [python] remove Python 3.9 specific typing annotations (PR #156868)
https://github.com/boomanaiden154 requested changes to this pull request. If you have bots for this, please address specific failures rather than grepping through the entire monorepo for these constructs. A bunch of the files you have hit here (like the ones related to CI) will never be run as part of an LLVM build and are always run with python 3.10+ and thus don't need to be fixed. https://github.com/llvm/llvm-project/pull/156868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Destroy debugger when debug session terminates (PR #156231)
https://github.com/walter-erquinigo approved this pull request. cool https://github.com/llvm/llvm-project/pull/156231 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libcxx] [lldb] [llvm] [polly] [python] remove Python 3.9 specific typing annotations (PR #156868)
DavidSpickett wrote: > from typing import List Is this something we install or something that's included with Python 3.8+? https://github.com/llvm/llvm-project/pull/156868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [python] remove Python 3.9 specific typing annotations (PR #156868)
https://github.com/DeinAlptraum dismissed https://github.com/llvm/llvm-project/pull/156868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][AArch64] Make TPIDR a generic tp register (PR #154444)
https://github.com/DavidSpickett approved this pull request. LGTM Remove the `@` mention in the description before merging, so that they don't get spammed when this gets merged into forks. https://github.com/llvm/llvm-project/pull/15 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)
JDevlieghere wrote: Can you talk a bit about what's motivating this change? I'm a little worried about the proliferation of new options and I'm especially wary about the ones that need to be specified on the command line instead of over the protocol. Every new option extends the matrix of things we need to support. - Can this be a UI setting instead of a command line option? - Milliseconds seems like the wrong granularity for this . Seconds or minutes seems like a more meaningful order of magnitude. - This definitely needs a test. Unfortunately, tests that rely on timing tend to be less reliable, but here there should be a lower bound (e.g. exceeds X seconds) rather than an upper bound, so hopefully that should be fine. https://github.com/llvm/llvm-project/pull/156803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)
@@ -327,6 +348,23 @@ serveConnection(const Socket::SocketProtocol &protocol, const std::string &name, std::unique_lock lock(dap_sessions_mutex); dap_sessions.erase(&loop); std::notify_all_at_thread_exit(dap_sessions_condition, std::move(lock)); + + if (ttl > 0) { +// Start the countdown to kill the server at the end of each connection. +std::scoped_lock lock(ttl_mutex); +MainLoopBase::TimePoint future = +std::chrono::steady_clock::now() + std::chrono::milliseconds(ttl); +// We don't need to take the max of `keep_alive_up_to` and `future`, +// because `future` must be the latest. +ttl_time_point = future; +g_loop.AddCallback( +[future](MainLoopBase &loop) { + if (ttl_time_point == future) { +loop.RequestTermination(); + } walter-erquinigo wrote: braces https://github.com/llvm/llvm-project/pull/156803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)
https://github.com/walter-erquinigo requested changes to this pull request. https://github.com/llvm/llvm-project/pull/156803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [libcxx] [lldb] [llvm] [polly] [python] remove Python 3.9 specific typing annotations (PR #156868)
https://github.com/charles-zablit edited https://github.com/llvm/llvm-project/pull/156868 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 65f60fd - [lldb] Moving MCPTransport into its own file. (#156712)
Author: John Harrison Date: 2025-09-04T08:52:33-07:00 New Revision: 65f60fd4657a31f832ac48caf3d9e1b138d96653 URL: https://github.com/llvm/llvm-project/commit/65f60fd4657a31f832ac48caf3d9e1b138d96653 DIFF: https://github.com/llvm/llvm-project/commit/65f60fd4657a31f832ac48caf3d9e1b138d96653.diff LOG: [lldb] Moving MCPTransport into its own file. (#156712) Moving `lldb_protocol::mcp::MCPTransport` into its own file and renaming to `lldb_protocol::mcp::Transport`. Added: lldb/include/lldb/Protocol/MCP/Transport.h lldb/source/Protocol/MCP/Transport.cpp Modified: lldb/include/lldb/Host/JSONTransport.h lldb/include/lldb/Protocol/MCP/Server.h lldb/source/Plugins/Protocol/MCP/ProtocolServerMCP.cpp lldb/source/Protocol/MCP/CMakeLists.txt lldb/tools/lldb-mcp/lldb-mcp.cpp lldb/unittests/Protocol/ProtocolMCPServerTest.cpp Removed: diff --git a/lldb/include/lldb/Host/JSONTransport.h b/lldb/include/lldb/Host/JSONTransport.h index 0be60a8f3f96a..210f33edace6e 100644 --- a/lldb/include/lldb/Host/JSONTransport.h +++ b/lldb/include/lldb/Host/JSONTransport.h @@ -100,7 +100,8 @@ template class Transport { virtual llvm::Expected RegisterMessageHandler(MainLoop &loop, MessageHandler &handler) = 0; -protected: + // FIXME: Refactor mcp::Server to not directly access log on the transport. + // protected: template inline auto Logv(const char *Fmt, Ts &&...Vals) { Log(llvm::formatv(Fmt, std::forward(Vals)...).str()); } @@ -139,9 +140,7 @@ class JSONTransport : public Transport { /// detail. static constexpr size_t kReadBufferSize = 1024; -protected: - virtual llvm::Expected> Parse() = 0; - virtual std::string Encode(const llvm::json::Value &message) = 0; + // FIXME: Write should be protected. llvm::Error Write(const llvm::json::Value &message) { this->Logv("<-- {0}", message); std::string output = Encode(message); @@ -149,6 +148,10 @@ class JSONTransport : public Transport { return m_out->Write(output.data(), bytes_written).takeError(); } +protected: + virtual llvm::Expected> Parse() = 0; + virtual std::string Encode(const llvm::json::Value &message) = 0; + llvm::SmallString m_buffer; private: diff --git a/lldb/include/lldb/Protocol/MCP/Server.h b/lldb/include/lldb/Protocol/MCP/Server.h index c6e78a9ea0cff..254b7d9680cd8 100644 --- a/lldb/include/lldb/Protocol/MCP/Server.h +++ b/lldb/include/lldb/Protocol/MCP/Server.h @@ -14,33 +14,17 @@ #include "lldb/Protocol/MCP/Protocol.h" #include "lldb/Protocol/MCP/Resource.h" #include "lldb/Protocol/MCP/Tool.h" +#include "lldb/Protocol/MCP/Transport.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/Error.h" -#include +#include "llvm/Support/JSON.h" +#include +#include +#include +#include namespace lldb_protocol::mcp { -class MCPTransport -: public lldb_private::JSONRPCTransport { -public: - using LogCallback = std::function; - - MCPTransport(lldb::IOObjectSP in, lldb::IOObjectSP out, - std::string client_name, LogCallback log_callback = {}) - : JSONRPCTransport(in, out), m_client_name(std::move(client_name)), -m_log_callback(log_callback) {} - virtual ~MCPTransport() = default; - - void Log(llvm::StringRef message) override { -if (m_log_callback) - m_log_callback(llvm::formatv("{0}: {1}", m_client_name, message).str()); - } - -private: - std::string m_client_name; - LogCallback m_log_callback; -}; - /// Information about this instance of lldb's MCP server for lldb-mcp to use to /// coordinate connecting an lldb-mcp client. struct ServerInfo { diff --git a/lldb/include/lldb/Protocol/MCP/Transport.h b/lldb/include/lldb/Protocol/MCP/Transport.h new file mode 100644 index 0..47c2ccfc44dfe --- /dev/null +++ b/lldb/include/lldb/Protocol/MCP/Transport.h @@ -0,0 +1,48 @@ +//===--===// +// +// 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 +// +//===--===// + +#ifndef LLDB_PROTOCOL_MCP_TRANSPORT_H +#define LLDB_PROTOCOL_MCP_TRANSPORT_H + +#include "lldb/Host/JSONTransport.h" +#include "lldb/Protocol/MCP/Protocol.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/FunctionExtras.h" +#include "llvm/ADT/StringRef.h" + +namespace lldb_protocol::mcp { + +/// Generic transport that uses the MCP protocol. +using MCPTransport = lldb_private::Transport; + +/// Generic logging callback, to allow the MCP server / client / transport layer +/// to be independent of the lldb log implementation. +using LogCallback = llvm::unique_function; + +class Transport final +: public lldb_private::JSONRPCTransport { +public: + Transport(lldb::IOObje
[Lldb-commits] [lldb] [LLDB] Fix tests that fail when using internal shell. (PR #156931)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: None (cmtice) Changes These tests were failing on darwin, because the internal shell needs environment var definitions to start with 'env'. This PR (hopefully) fixes that problem. --- Full diff: https://github.com/llvm/llvm-project/pull/156931.diff 3 Files Affected: - (modified) lldb/test/Shell/Host/TestCustomShell.test (+1-1) - (modified) lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp (+1-1) - (modified) lldb/test/Shell/SymbolFile/add-dsym.test (+1-1) ``diff diff --git a/lldb/test/Shell/Host/TestCustomShell.test b/lldb/test/Shell/Host/TestCustomShell.test index 0e948a1b1f7f3..5d3e90162fb28 100644 --- a/lldb/test/Shell/Host/TestCustomShell.test +++ b/lldb/test/Shell/Host/TestCustomShell.test @@ -6,7 +6,7 @@ # XFAIL: system-openbsd # RUN: %clang_host %S/Inputs/simple.c -g -o %t.out -# RUN: SHELL=bogus not %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s --check-prefix ERROR +# RUN: env SHELL=bogus not %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s --check-prefix ERROR # RUN: env -i ASAN_OPTIONS='detect_container_overflow=0' %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s # ERROR: error: shell expansion failed diff --git a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp index 9e79f23db2b74..a45f794c73a43 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp @@ -3,7 +3,7 @@ // requires the ld64 linker, which clang invokes by default. // REQUIRES: system-darwin // RUN: %clang_host %s -g -c -o %t.o -// RUN: ZERO_AR_DATE=1 %clang_host %t.o -g -o %t +// RUN: env ZERO_AR_DATE=1 %clang_host %t.o -g -o %t // RUN: %lldb %t -o "breakpoint set -f %s -l 11" -o run -o exit | FileCheck %s // CHECK: stop reason = breakpoint diff --git a/lldb/test/Shell/SymbolFile/add-dsym.test b/lldb/test/Shell/SymbolFile/add-dsym.test index 52d1a1363feef..9695ddc297aa9 100644 --- a/lldb/test/Shell/SymbolFile/add-dsym.test +++ b/lldb/test/Shell/SymbolFile/add-dsym.test @@ -4,5 +4,5 @@ # HELP: Syntax: add-dsym # RUN: yaml2obj %S/Inputs/a.yaml -o %t.out -# RUN: LLDB_APPLE_DSYMFORUUID_EXECUTABLE=%S/Inputs/dsymforuuid.sh %lldb %t.out -o 'add-dsym -u 41945CA4-5D9D-3CDE-82B4-37E4C09750B5' 2>&1 | FileCheck %s +# RUN: env LLDB_APPLE_DSYMFORUUID_EXECUTABLE=%S/Inputs/dsymforuuid.sh %lldb %t.out -o 'add-dsym -u 41945CA4-5D9D-3CDE-82B4-37E4C09750B5' 2>&1 | FileCheck %s # CHECK: UUID information was not found `` https://github.com/llvm/llvm-project/pull/156931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Fix tests that fail when using internal shell. (PR #156931)
https://github.com/cmtice created https://github.com/llvm/llvm-project/pull/156931 These tests were failing on darwin, because the internal shell needs environment var definitions to start with 'env'. This PR (hopefully) fixes that problem. >From f1418f873ce40963ca09e39490c202da503535ce Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Thu, 4 Sep 2025 10:14:20 -0700 Subject: [PATCH] [LLDB] Fix tests that fail when using internal shell. These tests were failing on darwin, because the internal shell needs environment var definitions to start with 'env'. This PR (hopefully) fixes that problem. --- lldb/test/Shell/Host/TestCustomShell.test| 2 +- lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp | 2 +- lldb/test/Shell/SymbolFile/add-dsym.test | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/test/Shell/Host/TestCustomShell.test b/lldb/test/Shell/Host/TestCustomShell.test index 0e948a1b1f7f3..5d3e90162fb28 100644 --- a/lldb/test/Shell/Host/TestCustomShell.test +++ b/lldb/test/Shell/Host/TestCustomShell.test @@ -6,7 +6,7 @@ # XFAIL: system-openbsd # RUN: %clang_host %S/Inputs/simple.c -g -o %t.out -# RUN: SHELL=bogus not %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s --check-prefix ERROR +# RUN: env SHELL=bogus not %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s --check-prefix ERROR # RUN: env -i ASAN_OPTIONS='detect_container_overflow=0' %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s # ERROR: error: shell expansion failed diff --git a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp index 9e79f23db2b74..a45f794c73a43 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp @@ -3,7 +3,7 @@ // requires the ld64 linker, which clang invokes by default. // REQUIRES: system-darwin // RUN: %clang_host %s -g -c -o %t.o -// RUN: ZERO_AR_DATE=1 %clang_host %t.o -g -o %t +// RUN: env ZERO_AR_DATE=1 %clang_host %t.o -g -o %t // RUN: %lldb %t -o "breakpoint set -f %s -l 11" -o run -o exit | FileCheck %s // CHECK: stop reason = breakpoint diff --git a/lldb/test/Shell/SymbolFile/add-dsym.test b/lldb/test/Shell/SymbolFile/add-dsym.test index 52d1a1363feef..9695ddc297aa9 100644 --- a/lldb/test/Shell/SymbolFile/add-dsym.test +++ b/lldb/test/Shell/SymbolFile/add-dsym.test @@ -4,5 +4,5 @@ # HELP: Syntax: add-dsym # RUN: yaml2obj %S/Inputs/a.yaml -o %t.out -# RUN: LLDB_APPLE_DSYMFORUUID_EXECUTABLE=%S/Inputs/dsymforuuid.sh %lldb %t.out -o 'add-dsym -u 41945CA4-5D9D-3CDE-82B4-37E4C09750B5' 2>&1 | FileCheck %s +# RUN: env LLDB_APPLE_DSYMFORUUID_EXECUTABLE=%S/Inputs/dsymforuuid.sh %lldb %t.out -o 'add-dsym -u 41945CA4-5D9D-3CDE-82B4-37E4C09750B5' 2>&1 | FileCheck %s # CHECK: UUID information was not found ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Fix tests that fail when using internal shell. (PR #156931)
cmtice wrote: I need someone with a darwin system to verify that this actually fixes the breakages from here: https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-cmake/14836/ https://github.com/llvm/llvm-project/pull/156931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Make internal shell the default for running LLDB lit tests. (PR #156729)
cmtice wrote: > @cmtice I suspect that this may have broken three tests: > > https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-cmake/14836/ > > Could you revert/investigate? Let me know if you need any data or help > reproducing. @adrian-prantl Could you please test https://github.com/llvm/llvm-project/pull/156931 and see if it fixes the problem? https://github.com/llvm/llvm-project/pull/156729 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Make internal shell the default for running LLDB lit tests. (PR #156729)
Michael137 wrote: I suspect this broke `UnsupportedLanguage.test` on the lldb-x86_64-win bot: https://lab.llvm.org/buildbot/#/builders/211/builds/1840 Though don't have a machine to confirm that. ``` TEST 'lldb-shell :: Process/UnsupportedLanguage.test' FAILED Exit Code: 1 Command Output (stdout): -- # RUN: at line 3 c:\buildbot\as-builder-10\lldb-x86-64\build\bin\clang.exe --target=specify-a-target-or-use-a-_host-substitution --target=x86_64-pc-windows-msvc -fmodules-cache-path=C:/buildbot/as-builder-10/lldb-x86-64/build/lldb-test-build.noindex/module-cache-clang\lldb-shell C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\Shell\Process/Inputs/true.c -std=c99 -g -c -S -emit-llvm -o -| sed -e 's/DW_LANG_C99/DW_LANG_Mips_Assembler/g' >C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.ll # executed command: 'c:\buildbot\as-builder-10\lldb-x86-64\build\bin\clang.exe' --target=specify-a-target-or-use-a-_host-substitution --target=x86_64-pc-windows-msvc '-fmodules-cache-path=C:/buildbot/as-builder-10/lldb-x86-64/build/lldb-test-build.noindex/module-cache-clang\lldb-shell' 'C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\Shell\Process/Inputs/true.c' -std=c99 -g -c -S -emit-llvm -o - # .---command stderr # | clang: warning: argument unused during compilation: '-fmodules-cache-path=C:/buildbot/as-builder-10/lldb-x86-64/build/lldb-test-build.noindex/module-cache-clang\lldb-shell' [-Wunused-command-line-argument] # | clang: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument] # `- # executed command: sed -e s/DW_LANG_C99/DW_LANG_Mips_Assembler/g # note: command had no output on stdout or stderr # RUN: at line 5 c:\buildbot\as-builder-10\lldb-x86-64\build\bin\clang.exe --target=specify-a-target-or-use-a-_host-substitution --target=x86_64-pc-windows-msvc -fmodules-cache-path=C:/buildbot/as-builder-10/lldb-x86-64/build/lldb-test-build.noindex/module-cache-clang\lldb-shell C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.ll -g -o C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.exe # executed command: 'c:\buildbot\as-builder-10\lldb-x86-64\build\bin\clang.exe' --target=specify-a-target-or-use-a-_host-substitution --target=x86_64-pc-windows-msvc '-fmodules-cache-path=C:/buildbot/as-builder-10/lldb-x86-64/build/lldb-test-build.noindex/module-cache-clang\lldb-shell' 'C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.ll' -g -o 'C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.exe' # .---command stderr # | clang: warning: argument unused during compilation: '-fmodules-cache-path=C:/buildbot/as-builder-10/lldb-x86-64/build/lldb-test-build.noindex/module-cache-clang\lldb-shell' [-Wunused-command-line-argument] # `- # RUN: at line 6 c:\buildbot\as-builder-10\lldb-x86-64\build\bin\lldb.exe --no-lldbinit -S C:/buildbot/as-builder-10/lldb-x86-64/build/tools/lldb\test\Shell\lit-lldb-init-quiet -o "b main" -o r -o q -b C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.exe 2>&1 | c:\buildbot\as-builder-10\lldb-x86-64\build\bin\filecheck.exe C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\Shell\Process\UnsupportedLanguage.test --check-prefix ASM # executed command: 'c:\buildbot\as-builder-10\lldb-x86-64\build\bin\lldb.exe' --no-lldbinit -S 'C:/buildbot/as-builder-10/lldb-x86-64/build/tools/lldb\test\Shell\lit-lldb-init-quiet' -o 'b main' -o r -o q -b 'C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.exe' # note: command had no output on stdout or stderr # executed command: 'c:\buildbot\as-builder-10\lldb-x86-64\build\bin\filecheck.exe' 'C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\Shell\Process\UnsupportedLanguage.test' --check-prefix ASM # note: command had no output on stdout or stderr # RUN: at line 10 c:\buildbot\as-builder-10\lldb-x86-64\build\bin\clang.exe --target=specify-a-target-or-use-a-_host-substitution --target=x86_64-pc-windows-msvc -fmodules-cache-path=C:/buildbot/as-builder-10/lldb-x86-64/build/lldb-test-build.noindex/module-cache-clang\lldb-shell C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\Shell\Process/Inputs/true.c -std=c99 -g -c -S -emit-llvm -o -| sed -e 's/DW_LANG_C99/DW_LANG_Cobol74/g' >C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.ll # executed command: 'c:\buildbot\as-builder-10\lldb-x86-64\build\bin\clang.exe' --target=specify-a-target-or-use-a-
[Lldb-commits] [lldb] [LLDB] Make internal shell the default for running LLDB lit tests. (PR #156729)
boomanaiden154 wrote: #156939 should fix the last remaining issue. https://github.com/llvm/llvm-project/pull/156729 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators (PR #156050)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/156050 >From 35999d8d509864795dd36565d12ddea425a98c22 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Fri, 29 Aug 2025 16:57:35 +0100 Subject: [PATCH 1/6] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators This came up in https://github.com/llvm/llvm-project/issues/155691. For `std::basic_string` our formatter matching logic required the allocator template parameter to be a `std::allocator`. There is no compelling reason (that I know of) why this would be required for us to apply the existing formatter to the string. We don't check the `allocator` parameter for other STL containers either. This meant that `std::string` that used custom allocators wouldn't be formatted. This patch relaxes the regex for `basic_string`. --- .../Language/CPlusPlus/CPlusPlusLanguage.cpp | 15 -- .../string/TestDataFormatterStdString.py | 6 .../generic/string/main.cpp | 30 +++ 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index c39b529f7305a..ad3c00a1132d4 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -749,31 +749,27 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxStringSummaryProviderASCII, "std::string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderASCII, "std::string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderUTF16, "std::u16string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderUTF32, "std::u32string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, @@ -784,8 +780,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxWStringSummaryProvider, "std::wstring summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py index fec20bae997ef..6a27b5d2f0780 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py @@ -80,6 +80,8 @@ def cleanup(): '(%s::string) Q = "quite a long std::strin with lots of info inside it"' % ns, "(%s::string *) null_str = nullptr" % ns, +'(CustomString) custom_str = "hello!"', +'(CustomWString) custom_wstr = L"hello!"', ], ) @@ -143,6 +145,10 @@ def do_test_multibyte(self): '(%s::u16string) u16_empty = u""' % ns, '(%s::u32string) u32_string = U"🍄🍅🍆🍌"' % ns, '(%s::u32string) u32_empty = U""' % ns, +'(CustomStringU16) custom_u16 = u"ß水氶"', +'(CustomStringU16) custom_u16_empty = u""', +'(CustomStringU32) custom_u32 = U"🍄🍅🍆🍌"', +'(CustomStringU32) custom_u32_empty = U""', ], ) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter
[Lldb-commits] [lldb] [lldb] Introduce ScriptedFrame affordance (PR #149622)
https://github.com/medismailben updated https://github.com/llvm/llvm-project/pull/149622 >From a38ed4d99315224889c503d2ce31362be28b28eb Mon Sep 17 00:00:00 2001 From: Med Ismail Bennani Date: Wed, 3 Sep 2025 18:32:22 -0700 Subject: [PATCH] [lldb] Introduce ScriptedFrame affordance This patch introduces a new scripting affordance in lldb: `ScriptedFrame`. This allows user to produce mock stackframes in scripted threads and scripted processes from a python script. With this change, StackFrame can be synthetized from different sources: - Either from a dictionary containing a load address, and a frame index, which is the legacy way. - Or by creating a ScriptedFrame python object. One particularity of synthezising stackframes from the ScriptedFrame python object, is that these frame have an optional PC, meaning that they don't have a report a valid PC and they can act as shells that just contain static information, like the frame function name, the list of variables or registers, etc. It can also provide a symbol context. rdar://157260006 Signed-off-by: Med Ismail Bennani --- lldb/bindings/python/python-wrapper.swig | 1 + .../python/templates/scripted_process.py | 136 + lldb/include/lldb/API/SBSymbolContext.h | 1 + .../Interfaces/ScriptedFrameInterface.h | 55 + .../Interfaces/ScriptedThreadInterface.h | 10 + .../lldb/Interpreter/ScriptInterpreter.h | 5 + lldb/include/lldb/Target/StackFrame.h | 34 ++-- lldb/include/lldb/lldb-forward.h | 3 + lldb/source/Core/FormatEntity.cpp | 2 +- .../Plugins/Process/scripted/CMakeLists.txt | 1 + .../Process/scripted/ScriptedFrame.cpp| 191 ++ .../Plugins/Process/scripted/ScriptedFrame.h | 63 ++ .../Process/scripted/ScriptedThread.cpp | 82 +++- .../Plugins/Process/scripted/ScriptedThread.h | 5 +- .../Python/Interfaces/CMakeLists.txt | 1 + .../ScriptInterpreterPythonInterfaces.h | 1 + .../ScriptedFramePythonInterface.cpp | 157 ++ .../Interfaces/ScriptedFramePythonInterface.h | 59 ++ .../Interfaces/ScriptedPythonInterface.cpp| 3 +- .../ScriptedThreadPythonInterface.cpp | 17 ++ .../ScriptedThreadPythonInterface.h | 5 + .../Python/ScriptInterpreterPython.cpp| 5 + .../Python/ScriptInterpreterPythonImpl.h | 2 + lldb/source/Symbol/LineEntry.cpp | 4 +- .../dummy_scripted_process.py | 75 ++- 25 files changed, 883 insertions(+), 35 deletions(-) create mode 100644 lldb/include/lldb/Interpreter/Interfaces/ScriptedFrameInterface.h create mode 100644 lldb/source/Plugins/Process/scripted/ScriptedFrame.cpp create mode 100644 lldb/source/Plugins/Process/scripted/ScriptedFrame.h create mode 100644 lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFramePythonInterface.cpp create mode 100644 lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFramePythonInterface.h diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index 2c30d536a753d..c0ad456bc12e8 100644 --- a/lldb/bindings/python/python-wrapper.swig +++ b/lldb/bindings/python/python-wrapper.swig @@ -519,6 +519,7 @@ void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(PyOb return sb_ptr; } + void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBExecutionContext(PyObject * data) { lldb::SBExecutionContext *sb_ptr = NULL; diff --git a/lldb/examples/python/templates/scripted_process.py b/lldb/examples/python/templates/scripted_process.py index b6360b8519077..49059d533f38a 100644 --- a/lldb/examples/python/templates/scripted_process.py +++ b/lldb/examples/python/templates/scripted_process.py @@ -383,6 +383,142 @@ def get_extended_info(self): """ return self.extended_info +def get_scripted_frame_plugin(self): +"""Get scripted frame plugin name. + +Returns: +str: Name of the scripted frame plugin. +""" +return None + + +class ScriptedFrame(metaclass=ABCMeta): +""" +The base class for a scripted frame. + +Most of the base class methods are `@abstractmethod` that need to be +overwritten by the inheriting class. +""" + +@abstractmethod +def __init__(self, thread, args): +"""Construct a scripted frame. + +Args: +thread (ScriptedThread): The thread owning this frame. +args (lldb.SBStructuredData): A Dictionary holding arbitrary +key/value pairs used by the scripted frame. +""" +self.target = None +self.originating_thread = None +self.thread = None +self.args = None +self.id = None +self.name = None +self.register_info = None +self.register_ctx = {}
[Lldb-commits] [lldb] bdb9283 - [LLDB][NativePDB] Find global variables in namespaces (#156736)
Author: nerix Date: 2025-09-04T19:30:34+02:00 New Revision: bdb9283eec633585a14f7b1640822448c17ed71a URL: https://github.com/llvm/llvm-project/commit/bdb9283eec633585a14f7b1640822448c17ed71a DIFF: https://github.com/llvm/llvm-project/commit/bdb9283eec633585a14f7b1640822448c17ed71a.diff LOG: [LLDB][NativePDB] Find global variables in namespaces (#156736) To find global variables, `SymbolFileNativePDB` used to search the globals stream for the name passed to `FindGlobalVariables`. However, the symbols in the globals stream contain the fully qualified name and `FindGlobalVariables` only gets the basename. The approach here is similar to the one for types and functions. As we already search the globals stream for functions, we can cache the basenames for global variables there as well. This makes the `expressions.test` from the DIA PDB plugin pass with the native one (#114906). Added: Modified: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h lldb/test/Shell/SymbolFile/PDB/expressions.test Removed: diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp index 16ca90ad9dd40..6768a944bc10d 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -1655,22 +1655,62 @@ void SymbolFileNativePDB::DumpClangAST(Stream &s, llvm::StringRef filter) { clang->GetNativePDBParser()->Dump(s, filter); } -void SymbolFileNativePDB::CacheFunctionNames() { - if (!m_func_full_names.IsEmpty()) +void SymbolFileNativePDB::CacheGlobalBaseNames() { + if (!m_func_full_names.IsEmpty() || !m_global_variable_base_names.IsEmpty()) return; // (segment, code offset) -> gid - std::map, uint32_t> addr_ids; + std::map, uint32_t> func_addr_ids; - // First, find all function references in the globals table. + // First, look through all items in the globals table. for (const uint32_t gid : m_index->globals().getGlobalsTable()) { -CVSymbol ref_sym = m_index->symrecords().readRecord(gid); -auto kind = ref_sym.kind(); +CVSymbol sym = m_index->symrecords().readRecord(gid); +auto kind = sym.kind(); + +// If this is a global variable, we only need to look at the name +llvm::StringRef name; +switch (kind) { +case SymbolKind::S_GDATA32: +case SymbolKind::S_LDATA32: { + DataSym data = + llvm::cantFail(SymbolDeserializer::deserializeAs(sym)); + name = data.Name; + break; +} +case SymbolKind::S_GTHREAD32: +case SymbolKind::S_LTHREAD32: { + ThreadLocalDataSym data = llvm::cantFail( + SymbolDeserializer::deserializeAs(sym)); + name = data.Name; + break; +} +case SymbolKind::S_CONSTANT: { + ConstantSym data = + llvm::cantFail(SymbolDeserializer::deserializeAs(sym)); + name = data.Name; + break; +} +default: + break; +} + +if (!name.empty()) { + llvm::StringRef base = MSVCUndecoratedNameParser::DropScope(name); + if (base.empty()) +base = name; + + m_global_variable_base_names.Append(ConstString(base), gid); + continue; +} + if (kind != S_PROCREF && kind != S_LPROCREF) continue; +// For functions, we need to follow the reference to the procedure and look +// at the type + ProcRefSym ref = -llvm::cantFail(SymbolDeserializer::deserializeAs(ref_sym)); +llvm::cantFail(SymbolDeserializer::deserializeAs(sym)); if (ref.Name.empty()) continue; @@ -1694,7 +1734,7 @@ void SymbolFileNativePDB::CacheFunctionNames() { // The function/procedure symbol only contains the demangled name. // The mangled names are in the publics table. Save the address of this // function to lookup the mangled name later. -addr_ids.emplace(std::make_pair(proc.Segment, proc.CodeOffset), gid); +func_addr_ids.emplace(std::make_pair(proc.Segment, proc.CodeOffset), gid); llvm::StringRef basename = MSVCUndecoratedNameParser::DropScope(proc.Name); if (basename.empty()) @@ -1729,8 +1769,8 @@ void SymbolFileNativePDB::CacheFunctionNames() { continue; // Check if this symbol is for one of our functions. -auto it = addr_ids.find({pub.Segment, pub.Offset}); -if (it != addr_ids.end()) +auto it = func_addr_ids.find({pub.Segment, pub.Offset}); +if (it != func_addr_ids.end()) m_func_full_names.Append(ConstString(pub.Name), it->second); } @@ -1741,31 +1781,35 @@ void SymbolFileNativePDB::CacheFunctionNames() { m_func_method_names.SizeToFit(); m_func_base_names.Sort(std::less()); m_func_base_names.SizeToFit(); + m_global_variable_base_names.Sort(std::less()); + m_global_variable_base_names.Size
[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)
@@ -509,6 +547,17 @@ int main(int argc, char *argv[]) { } if (!connection.empty()) { +int ttl = 0; ashgti wrote: nit: Could this be `ttl_ms` or maybe a `std::chrono::milliseconds` instead of an `int`? https://github.com/llvm/llvm-project/pull/156803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)
@@ -327,6 +348,23 @@ serveConnection(const Socket::SocketProtocol &protocol, const std::string &name, std::unique_lock lock(dap_sessions_mutex); dap_sessions.erase(&loop); std::notify_all_at_thread_exit(dap_sessions_condition, std::move(lock)); + + if (ttl > 0) { +// Start the countdown to kill the server at the end of each connection. +std::scoped_lock lock(ttl_mutex); +MainLoopBase::TimePoint future = ashgti wrote: nit: Can we have a more descriptive name than `future`? https://github.com/llvm/llvm-project/pull/156803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)
@@ -327,6 +348,23 @@ serveConnection(const Socket::SocketProtocol &protocol, const std::string &name, std::unique_lock lock(dap_sessions_mutex); dap_sessions.erase(&loop); std::notify_all_at_thread_exit(dap_sessions_condition, std::move(lock)); + + if (ttl > 0) { +// Start the countdown to kill the server at the end of each connection. +std::scoped_lock lock(ttl_mutex); +MainLoopBase::TimePoint future = +std::chrono::steady_clock::now() + std::chrono::milliseconds(ttl); +// We don't need to take the max of `keep_alive_up_to` and `future`, ashgti wrote: `keep_alive_up_to` isn't a variable here, I think this comment may be stale? https://github.com/llvm/llvm-project/pull/156803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)
@@ -327,6 +348,23 @@ serveConnection(const Socket::SocketProtocol &protocol, const std::string &name, std::unique_lock lock(dap_sessions_mutex); dap_sessions.erase(&loop); std::notify_all_at_thread_exit(dap_sessions_condition, std::move(lock)); + + if (ttl > 0) { +// Start the countdown to kill the server at the end of each connection. +std::scoped_lock lock(ttl_mutex); +MainLoopBase::TimePoint future = +std::chrono::steady_clock::now() + std::chrono::milliseconds(ttl); +// We don't need to take the max of `keep_alive_up_to` and `future`, +// because `future` must be the latest. +ttl_time_point = future; +g_loop.AddCallback( +[future](MainLoopBase &loop) { + if (ttl_time_point == future) { ashgti wrote: Should we use a scoped_lock when accessing ttl_time_point? https://github.com/llvm/llvm-project/pull/156803 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Fix tests that fail when using internal shell. (PR #156931)
boomanaiden154 wrote: I've tested this locally on Darwin. I can confirm it fixes part of `TestCustomShell.test` and completely fixes the other two tests. https://github.com/llvm/llvm-project/pull/156931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Fix tests that fail when using internal shell. (PR #156931)
cmtice wrote: > `lldb/test/Shell/Host/TestCustomShell.test` will still fail after this, but > this change is still necessary either way. It does fix the other two tests > and enables implementing `env -i` within lit's internal shell to fix > `lldb/test/Shell/Host/TestCustomShell.test`. > > I'm hoping to get to implementing `env -i` within the next hour or two. So even if I commit the PR, the GreenDragon builder will continue to fail until you get 'env -i' implemented. Is that acceptable? Or do I need to actually revert the change that makes internal shell the default until the 'env -i' fix is committed. @JDevlieghere , @adrian-prantl what do you think? https://github.com/llvm/llvm-project/pull/156931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Fix tests that fail when using internal shell. (PR #156931)
adrian-prantl wrote: @cmtice @boomanaiden154 1/3 are still failing: https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-cmake/14864/testReport/lldb-shell/SymbolFile_DWARF/deterministic_build_cpp/ https://github.com/llvm/llvm-project/pull/156931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add some vector operations to the IRInterpreter (PR #155000)
@@ -1564,7 +1660,103 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, returnVal = value.GetScalar(); // Push the return value as the result -frame.AssignValue(inst, returnVal, module); +frame.AssignValue(inst, returnVal, module, exe_ctx); + } +} break; +case Instruction::ExtractElement: { + const ExtractElementInst *extract_inst = cast(inst); + + // Get the vector and index operands + const Value *vector_operand = extract_inst->getVectorOperand(); + const Value *index_operand = extract_inst->getIndexOperand(); Michael137 wrote: We probably need nullptr checks here https://github.com/llvm/llvm-project/pull/155000 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators (PR #156050)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Michael Buch (Michael137) Changes This came up in https://github.com/llvm/llvm-project/issues/155691. For `std::basic_string` our formatter matching logic required the allocator template parameter to be a `std::allocator`. There is no compelling reason (that I know of) why this would be required for us to apply the existing formatter to the string. We don't check the `allocator` parameter for other STL containers either. This meant that `std::string` that used custom allocators wouldn't be formatted. This patch relaxes the regex for `basic_string`. --- Full diff: https://github.com/llvm/llvm-project/pull/156050.diff 3 Files Affected: - (modified) lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp (+17-33) - (modified) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py (+6) - (modified) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/main.cpp (+35) ``diff diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index c39b529f7305a..277de8f444828 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -749,31 +749,27 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxStringSummaryProviderASCII, "std::string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderASCII, "std::string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderUTF16, "std::u16string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, lldb_private::formatters::LibcxxStringSummaryProviderUTF32, "std::u32string summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, @@ -784,8 +780,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { lldb_private::formatters::LibcxxWStringSummaryProvider, "std::wstring summary provider", "^std::__[[:alnum:]]+::basic_string, " -"std::__[[:alnum:]]+::allocator >$", +"std::__[[:alnum:]]+::char_traits,.*>$", stl_summary_flags, true); AddCXXSummary(cpp_category_sp, @@ -1301,24 +1296,16 @@ static void RegisterStdStringSummaryProvider( category_sp->AddTypeSummary(makeSpecifier(string_ty), summary_sp); - // std::basic_string category_sp->AddTypeSummary( makeSpecifier(llvm::formatv("std::basic_string<{}>", char_ty).str()), summary_sp); - // std::basic_string,std::allocator > - category_sp->AddTypeSummary( - makeSpecifier(llvm::formatv("std::basic_string<{0},std::char_traits<{0}>," - "std::allocator<{0}> >", - char_ty) -.str()), - summary_sp); - // std::basic_string, std::allocator > + category_sp->AddTypeSummary( - makeSpecifier( - llvm::formatv("std::basic_string<{0}, std::char_traits<{0}>, " -"std::allocator<{0}> >", + std::make_shared( + llvm::formatv("^std::basic_string<{0}, ?std::char_traits<{0}>,.*>$", char_ty) - .str()), + .str(), + eFormatterMatchRegex), summary_sp); } @@ -1363,20 +1350,17 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { cpp_category_sp->AddTypeSummary("std::__cxx11::string", eFormatterMatchExact, string_summary_sp); cpp_category_sp->AddTypeSummary( - "std::__cxx11::basic_string, " - "std::allocator >", - eFormatterMatchExact, string_summary_sp); - cpp_category_sp->AddTypeSummary("std::__cxx11::basic_string, " -
[Lldb-commits] [lldb] [lldb] Add some vector operations to the IRInterpreter (PR #155000)
@@ -30,9 +30,14 @@ class ArchitecturePPC64 : public Architecture { void AdjustBreakpointAddress(const Symbol &func, Address &addr) const override; + lldb::ByteOrder GetVectorElementOrder() const override; + private: static std::unique_ptr Create(const ArchSpec &arch); - ArchitecturePPC64() = default; + ArchitecturePPC64(lldb::ByteOrder vector_element_order) Michael137 wrote: Can we split the architecture plugin changes into a separate PR? https://github.com/llvm/llvm-project/pull/155000 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] lldb-dap: Stop using replicated variable ids (PR #124232)
@@ -62,7 +97,11 @@ struct Variables { /// These are the variables evaluated from debug console REPL. llvm::DenseMap m_referencedpermanent_variables; - int64_t m_next_temporary_var_ref{VARREF_FIRST_VAR_IDX}; + /// Key = frame_id + /// Value = (locals, globals Registers) scopes + std::maphttps://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame > interface StackFrame { > /** >An identifier for the stack frame. It must be unique across all threads. >This id can be used to retrieve the scopes of the frame with the `scopes` >request or to restart the execution of a stack frame. > */ > id: number; https://github.com/llvm/llvm-project/pull/124232 ___ 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] [compiler-rt] [flang] [libcxx] [libcxxabi] [lld] [lldb] [llvm] [Inclusive Language] migrate "sanity" checks to "soundness" checks (PR #156995)
https://github.com/vanvoorden edited https://github.com/llvm/llvm-project/pull/156995 ___ 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] [compiler-rt] [flang] [libcxx] [libcxxabi] [lld] [lldb] [llvm] [Inclusive Language] migrate "sanity" checks to "soundness" checks (PR #156995)
https://github.com/vanvoorden edited https://github.com/llvm/llvm-project/pull/156995 ___ 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] [compiler-rt] [flang] [libcxx] [libcxxabi] [lld] [lldb] [llvm] [Inclusive Language] migrate "sanity" checks to "soundness" checks (PR #156995)
Endilll wrote: I'd like to see this massive change to be backed by an RFC on Discourse. That is also a good place to discuss various options for the exact wording. https://github.com/llvm/llvm-project/pull/156995 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators (PR #156050)
https://github.com/Michael137 ready_for_review https://github.com/llvm/llvm-project/pull/156050 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [clang] remove IsDefaulted bit from TemplateArgument (PR #155120)
mizvekov wrote: ping, I need feedback from the DebugInfo experts, do the test changes look good? https://github.com/llvm/llvm-project/pull/155120 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] lldb-dap: Stop using replicated variable ids (PR #124232)
https://github.com/Anthony-Eid updated https://github.com/llvm/llvm-project/pull/124232 >From 30658e994b18b7c0db114a297036421c8de2dea3 Mon Sep 17 00:00:00 2001 From: Anthony Date: Wed, 27 Aug 2025 13:04:26 -0400 Subject: [PATCH 01/17] Fix variable request from reusing variable_ids --- .../lldb-dap/Handler/ScopesRequestHandler.cpp | 45 ++- lldb/tools/lldb-dap/JSONUtils.h | 1 + lldb/tools/lldb-dap/Variables.cpp | 80 +-- lldb/tools/lldb-dap/Variables.h | 18 - 4 files changed, 119 insertions(+), 25 deletions(-) diff --git a/lldb/tools/lldb-dap/Handler/ScopesRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/ScopesRequestHandler.cpp index aaad0e20f9c21..160d8e264d089 100644 --- a/lldb/tools/lldb-dap/Handler/ScopesRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/ScopesRequestHandler.cpp @@ -29,8 +29,8 @@ namespace lldb_dap { /// /// \return /// A `protocol::Scope` -static Scope CreateScope(const llvm::StringRef name, int64_t variablesReference, - int64_t namedVariables, bool expensive) { +Scope CreateScope(const llvm::StringRef name, int64_t variablesReference, + int64_t namedVariables, bool expensive) { Scope scope; scope.name = name; @@ -75,22 +75,31 @@ ScopesRequestHandler::Run(const ScopesArguments &args) const { frame.GetThread().GetProcess().SetSelectedThread(frame.GetThread()); frame.GetThread().SetSelectedFrame(frame.GetFrameID()); } - dap.variables.locals = frame.GetVariables(/*arguments=*/true, -/*locals=*/true, -/*statics=*/false, -/*in_scope_only=*/true); - dap.variables.globals = frame.GetVariables(/*arguments=*/false, - /*locals=*/false, - /*statics=*/true, - /*in_scope_only=*/true); - dap.variables.registers = frame.GetRegisters(); - - std::vector scopes = {CreateScope("Locals", VARREF_LOCALS, -dap.variables.locals.GetSize(), false), -CreateScope("Globals", VARREF_GLOBALS, -dap.variables.globals.GetSize(), false), -CreateScope("Registers", VARREF_REGS, -dap.variables.registers.GetSize(), false)}; + + uint32_t frame_id = frame.GetFrameID(); + + dap.variables.ReadyFrame(frame_id, frame); + dap.variables.SwitchFrame(frame_id); + + std::vector scopes = {}; + + int64_t variable_reference = dap.variables.GetNewVariableReference(false); + scopes.push_back(CreateScope("Locals", variable_reference, + dap.variables.locals.GetSize(), false)); + + dap.variables.AddScopeKind(variable_reference, ScopeKind::Locals, frame_id); + + variable_reference = dap.variables.GetNewVariableReference(false); + scopes.push_back(CreateScope("Globals", variable_reference, + dap.variables.globals.GetSize(), false)); + dap.variables.AddScopeKind(variable_reference, ScopeKind::Globals, frame_id); + + variable_reference = dap.variables.GetNewVariableReference(false); + scopes.push_back(CreateScope("Registers", variable_reference, + dap.variables.registers.GetSize(), false)); + + dap.variables.AddScopeKind(variable_reference, ScopeKind::Registers, + frame_id); return ScopesResponseBody{std::move(scopes)}; } diff --git a/lldb/tools/lldb-dap/JSONUtils.h b/lldb/tools/lldb-dap/JSONUtils.h index e9094f67b94ec..6575411acd878 100644 --- a/lldb/tools/lldb-dap/JSONUtils.h +++ b/lldb/tools/lldb-dap/JSONUtils.h @@ -9,6 +9,7 @@ #ifndef LLDB_TOOLS_LLDB_DAP_JSONUTILS_H #define LLDB_TOOLS_LLDB_DAP_JSONUTILS_H +#include "DAP.h" #include "DAPForward.h" #include "Protocol/ProtocolTypes.h" #include "lldb/API/SBCompileUnit.h" diff --git a/lldb/tools/lldb-dap/Variables.cpp b/lldb/tools/lldb-dap/Variables.cpp index 777e3183d8c0d..9ed3773df817d 100644 --- a/lldb/tools/lldb-dap/Variables.cpp +++ b/lldb/tools/lldb-dap/Variables.cpp @@ -8,20 +8,33 @@ #include "Variables.h" #include "JSONUtils.h" +#include "lldb/API/SBFrame.h" using namespace lldb_dap; lldb::SBValueList *Variables::GetTopLevelScope(int64_t variablesReference) { - switch (variablesReference) { - case VARREF_LOCALS: + auto iter = m_scope_kinds.find(variablesReference); + if (iter == m_scope_kinds.end()) { +return nullptr; + } + + ScopeKind scope_kind = iter->second.first; + uint32_t frame_id = iter->second.second; + + if (!SwitchFrame(frame_id)) { +return nullptr; + } + + switch (scope_kind) { + case lldb_dap::ScopeKind::Locals: return &locals; - case VARREF_GLOBALS: + case lldb_dap::ScopeKind::Globals: return &globals; - case VARREF_REGS: + c
[Lldb-commits] [lldb] lldb-dap: Stop using replicated variable ids (PR #124232)
@@ -62,7 +97,11 @@ struct Variables { /// These are the variables evaluated from debug console REPL. llvm::DenseMap m_referencedpermanent_variables; - int64_t m_next_temporary_var_ref{VARREF_FIRST_VAR_IDX}; + /// Key = frame_id + /// Value = (locals, globals Registers) scopes + std::map> + m_frames; Anthony-Eid wrote: I'm waiting for feedback about your comment below before I fully address this one https://github.com/llvm/llvm-project/pull/124232 ___ 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] [compiler-rt] [flang] [libcxx] [libcxxabi] [lld] [lldb] [llvm] [Inclusive Language] migrate "sanity" checks to "soundness" checks (PR #156995)
https://github.com/vanvoorden edited https://github.com/llvm/llvm-project/pull/156995 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Fix deterministic-build.cpp post #156931 (PR #156983)
cmtice wrote: Just FYI: That blank line got removed because otherwise it failed the code formatting premerge test. :-( https://github.com/llvm/llvm-project/pull/156983 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Fix deterministic-build.cpp post #156931 (PR #156983)
boomanaiden154 wrote: > Just FYI: That blank line got removed because otherwise it failed the code > formatting premerge test. :-( Good point. Updated to change the line number rather than add in the extra blank line. I've confirmed this fixes the issue locally, so I'm going to merge this once upstream premerge CI passes to try and get the bots back to green. https://github.com/llvm/llvm-project/pull/156983 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits