[Lldb-commits] [lldb] [lldb][test] Synchronize `__compressed_pair_padding` with libc++ (PR #142516)
https://github.com/frederick-vs-ja closed https://github.com/llvm/llvm-project/pull/142516 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][mcp] Skip MCPUnixSocketCommandTestCase if remote (PR #146807)
https://github.com/aperez created https://github.com/llvm/llvm-project/pull/146807 It looks like #146603 broke the [lldb-remote-linux-win](https://lab.llvm.org/buildbot/#/builders/197) build bot because `MCPUnixSocketCommandTestCase` is trying to start a protocol-server via unix domain sockets on windows. This change makes it so the test is skipped if it is remote. >From 895fa917592e2b512f7852f6bc04266159b16bdb Mon Sep 17 00:00:00 2001 From: Alexandre Perez Date: Wed, 2 Jul 2025 17:53:16 -0700 Subject: [PATCH] [lldb][mcp] Skip MCPUnixSocketCommandTestCase if remote --- lldb/test/API/commands/protocol/TestMCPUnixSocket.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/test/API/commands/protocol/TestMCPUnixSocket.py b/lldb/test/API/commands/protocol/TestMCPUnixSocket.py index de0aec040695f..ea9255cc60ef5 100644 --- a/lldb/test/API/commands/protocol/TestMCPUnixSocket.py +++ b/lldb/test/API/commands/protocol/TestMCPUnixSocket.py @@ -12,6 +12,7 @@ class MCPUnixSocketCommandTestCase(TestBase): @skipIfWindows +@skipIfRemote @no_debug_info_test def test_unix_socket(self): """ ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][mcp] Skip MCPUnixSocketCommandTestCase if remote (PR #146807)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Alexandre Perez (aperez) Changes It looks like #146603 broke the [lldb-remote-linux-win](https://lab.llvm.org/buildbot/#/builders/197) build bot because `MCPUnixSocketCommandTestCase` is trying to start a protocol-server via unix domain sockets on windows. This change makes it so the test is skipped if it is remote. --- Full diff: https://github.com/llvm/llvm-project/pull/146807.diff 1 Files Affected: - (modified) lldb/test/API/commands/protocol/TestMCPUnixSocket.py (+1) ``diff diff --git a/lldb/test/API/commands/protocol/TestMCPUnixSocket.py b/lldb/test/API/commands/protocol/TestMCPUnixSocket.py index de0aec040695f..ea9255cc60ef5 100644 --- a/lldb/test/API/commands/protocol/TestMCPUnixSocket.py +++ b/lldb/test/API/commands/protocol/TestMCPUnixSocket.py @@ -12,6 +12,7 @@ class MCPUnixSocketCommandTestCase(TestBase): @skipIfWindows +@skipIfRemote @no_debug_info_test def test_unix_socket(self): """ `` https://github.com/llvm/llvm-project/pull/146807 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][mcp] Skip MCPUnixSocketCommandTestCase if remote (PR #146807)
https://github.com/kusmour approved this pull request. https://github.com/llvm/llvm-project/pull/146807 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use correct size when dumping DWARF64 DW_FORM_ref_addr (PR #146686)
@@ -420,8 +420,7 @@ void DWARFFormValue::Dump(Stream &s) const { DumpAddress(s.AsRawOstream(), uvalue, sizeof(uint64_t) * 2); else DumpAddress(s.AsRawOstream(), uvalue, HemangGadhavi wrote: No need to check for the <= 2 DWARF version now, Because its handled by getRefAddrByteSize(). you can removed below peace of code, ``` if (m_unit->GetVersion() <= 2) DumpAddress(s.AsRawOstream(), uvalue, sizeof(uint64_t) * 2); else ``` https://github.com/llvm/llvm-project/pull/146686 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use correct size when dumping DWARF64 DW_FORM_ref_addr (PR #146686)
HemangGadhavi wrote: > @HemangGadhavi (can't add you to reviewers for whatever reason) May be I do not have maintainer access yet ..?? Not sure. https://github.com/llvm/llvm-project/pull/146686 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] dfcef35 - [lldb][NFC][MachO] Clean up LC_THREAD reading code, remove i386 corefile (#146480)
Author: Jason Molenda Date: 2025-07-02T10:21:38-07:00 New Revision: dfcef35ff1d30d112362645ec2cd0d5e99952b0f URL: https://github.com/llvm/llvm-project/commit/dfcef35ff1d30d112362645ec2cd0d5e99952b0f DIFF: https://github.com/llvm/llvm-project/commit/dfcef35ff1d30d112362645ec2cd0d5e99952b0f.diff LOG: [lldb][NFC][MachO] Clean up LC_THREAD reading code, remove i386 corefile (#146480) While fixing bugs in the x86_64 LC_THREAD parser in ObjectFileMachO, I noticed that the other LC_THREAD parsers are all less clear than they should be. To recap, a Mach-O LC_THREAD load command has a byte size for the entire payload. Within the payload, there will be one or more register sets provided. A register set starts with a UInt32 "flavor", the type of register set defined in the system headers, and a UInt32 "count", the number of UInt32 words of memory for this register set. After one register set, there may be additional sets. A parser can skip an unknown register set flavor by using the count field to get to the next register set. When the total byte size of the LC_THREAD load command has been parsed, it is completed. This patch fixes the riscv/arm/arm64 LC_THREAD parsers to use the total byte size as the exit condition, and to skip past unrecognized register sets, instead of stopping parsing. Instead of fixing the i386 corefile support, I removed it. The last macOS that supported 32-bit Intel code was macOS 10.14 in 2018. I also removed i386 KDP support, 32-bit intel kernel debugging hasn't been supported for even longer than that. It would be preferable to do these things separately, but I couldn't bring myself to update the i386 LC_THREAD parser, and it required very few changes to remove this support entirely. Added: Modified: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/source/Plugins/Process/MacOSX-Kernel/CMakeLists.txt lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp lldb/source/Plugins/Process/Utility/CMakeLists.txt llvm/utils/gn/secondary/lldb/source/Plugins/Process/Utility/BUILD.gn Removed: lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.h lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp lldb/source/Plugins/Process/Utility/RegisterContextDarwin_i386.h lldb/source/Plugins/Process/Utility/RegisterContextMach_i386.cpp lldb/source/Plugins/Process/Utility/RegisterContextMach_i386.h diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 70f954cd5413f..dfff473ac1777 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -11,7 +11,6 @@ #include "Plugins/Process/Utility/RegisterContextDarwin_arm.h" #include "Plugins/Process/Utility/RegisterContextDarwin_arm64.h" -#include "Plugins/Process/Utility/RegisterContextDarwin_i386.h" #include "Plugins/Process/Utility/RegisterContextDarwin_riscv32.h" #include "Plugins/Process/Utility/RegisterContextDarwin_x86_64.h" #include "lldb/Core/Debugger.h" @@ -81,9 +80,6 @@ #ifdef CPU_TYPE_ARM64_32 #undef CPU_TYPE_ARM64_32 #endif -#ifdef CPU_TYPE_I386 -#undef CPU_TYPE_I386 -#endif #ifdef CPU_TYPE_X86_64 #undef CPU_TYPE_X86_64 #endif @@ -358,122 +354,6 @@ class RegisterContextDarwin_x86_64_Mach : public RegisterContextDarwin_x86_64 { } }; -class RegisterContextDarwin_i386_Mach : public RegisterContextDarwin_i386 { -public: - RegisterContextDarwin_i386_Mach(lldb_private::Thread &thread, - const DataExtractor &data) - : RegisterContextDarwin_i386(thread, 0) { -SetRegisterDataFrom_LC_THREAD(data); - } - - void InvalidateAllRegisters() override { -// Do nothing... registers are always valid... - } - - void SetRegisterDataFrom_LC_THREAD(const DataExtractor &data) { -lldb::offset_t offset = 0; -SetError(GPRRegSet, Read, -1); -SetError(FPURegSet, Read, -1); -SetError(EXCRegSet, Read, -1); -bool done = false; - -while (!done) { - int flavor = data.GetU32(&offset); - if (flavor == 0) -done = true; - else { -uint32_t i; -uint32_t count = data.GetU32(&offset); -switch (flavor) { -case GPRRegSet: - for (i = 0; i < count; ++i) -(&gpr.eax)[i] = data.GetU32(&offset); - SetError(GPRRegSet, Read, 0); - done = true; - - break; -case FPURegSet: - // TODO: fill in FPU regs - // SetError (FPURegSet, Read, -1); - done = true; - - break; -case EXCRegSet: - exc.trapno = data.GetU32(&offset); - exc.err = data.GetU32(&offset); - exc.faultvaddr = data.GetU32(&offset); - SetError(EXCRegSet, Rea
[Lldb-commits] [lldb] [lldb] Add SB API to make a breakpoint a hardware breakpoint (PR #146602)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/146602 >From 656beb2df5f39604454af0e3f4a9f4b1b7e9c5f8 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 1 Jul 2025 16:02:21 -0700 Subject: [PATCH 1/5] [lldb] Add SB API to make a breakpoint a hardware breakpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds SBBreakpoint::SetIsHardware, allowing clients to mark an existing breakpoint as a hardware breakpoint purely through the API. This is safe to do after creation, as the hardware/software distinction doesn't affect how breakpoint locations are selected. In some cases (e.g. when writing a trap instruction would alter program behavior), it's important to use hardware breakpoints. Ideally, we’d extend the various Create methods to support this, but given their number, this patch limits the scope to the post-creation API. As a workaround, users can also rely on target.require-hardware-breakpoint or use the breakpoint set command. rdar://153528045 --- lldb/include/lldb/API/SBBreakpoint.h | 2 + lldb/include/lldb/Breakpoint/Breakpoint.h | 1 + lldb/source/API/SBBreakpoint.cpp | 11 + lldb/source/Breakpoint/Breakpoint.cpp | 21 ++ .../simple_hw_breakpoints/Makefile| 7 .../TestSimpleHWBreakpoints.py| 40 +++ .../simple_hw_breakpoints/main.c | 7 7 files changed, 89 insertions(+) create mode 100644 lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/Makefile create mode 100644 lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/TestSimpleHWBreakpoints.py create mode 100644 lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/main.c diff --git a/lldb/include/lldb/API/SBBreakpoint.h b/lldb/include/lldb/API/SBBreakpoint.h index e08df3b6d5ab0..307c9e13d7e39 100644 --- a/lldb/include/lldb/API/SBBreakpoint.h +++ b/lldb/include/lldb/API/SBBreakpoint.h @@ -148,6 +148,8 @@ class LLDB_API SBBreakpoint { bool IsHardware() const; + void SetIsHardware(bool is_hardware); + // Can only be called from a ScriptedBreakpointResolver... SBError AddLocation(SBAddress &address); diff --git a/lldb/include/lldb/Breakpoint/Breakpoint.h b/lldb/include/lldb/Breakpoint/Breakpoint.h index f623a2e0c295b..8b1ab219832cc 100644 --- a/lldb/include/lldb/Breakpoint/Breakpoint.h +++ b/lldb/include/lldb/Breakpoint/Breakpoint.h @@ -518,6 +518,7 @@ class Breakpoint : public std::enable_shared_from_this, lldb::break_id_t bp_loc_id); bool IsHardware() const { return m_hardware; } + void SetIsHardware(bool is_hardware); lldb::BreakpointResolverSP GetResolver() { return m_resolver_sp; } diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp index 87fadbcec4f26..d790b3f4ca271 100644 --- a/lldb/source/API/SBBreakpoint.cpp +++ b/lldb/source/API/SBBreakpoint.cpp @@ -781,6 +781,17 @@ bool SBBreakpoint::IsHardware() const { return false; } +void SBBreakpoint::SetIsHardware(bool is_hardware) { + LLDB_INSTRUMENT_VA(this, is_hardware); + + BreakpointSP bkpt_sp = GetSP(); + if (bkpt_sp) { +std::lock_guard guard( +bkpt_sp->GetTarget().GetAPIMutex()); +bkpt_sp->SetIsHardware(is_hardware); + } +} + BreakpointSP SBBreakpoint::GetSP() const { return m_opaque_wp.lock(); } // This is simple collection of breakpoint id's and their target. diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index 2ed0c9314e3e1..d5845ebeeb08a 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -251,6 +251,27 @@ const lldb::TargetSP Breakpoint::GetTargetSP() { bool Breakpoint::IsInternal() const { return LLDB_BREAK_ID_IS_INTERNAL(m_bid); } +void Breakpoint::SetIsHardware(bool is_hardware) { + if (is_hardware == m_hardware) +return; + + // Remember all the breakpoint locations we've disabled. + std::vector locations; + for (BreakpointLocationSP location : m_locations.BreakpointLocations()) { +if (location->IsEnabled()) { + locations.push_back(location); + location->SetEnabled(false); +} + } + + // Toggle the hardware mode. + m_hardware = is_hardware; + + // Re-enable the breakpoint locations. + for (BreakpointLocationSP location : locations) +location->SetEnabled(true); +} + BreakpointLocationSP Breakpoint::AddLocation(const Address &addr, bool *new_location) { return m_locations.AddLocation(addr, m_resolve_indirect_symbols, diff --git a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/Makefile b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/Makefile new file mode 100644 index 0..304633c2dca1f --- /dev/null
[Lldb-commits] [lldb] d457621 - [lldb] Fixing warnings / win32 builds in MainLoop. (#146632)
Author: John Harrison Date: 2025-07-02T12:49:19-07:00 New Revision: d457621872528d27c8081cf147d41a6f46276d1d URL: https://github.com/llvm/llvm-project/commit/d457621872528d27c8081cf147d41a6f46276d1d DIFF: https://github.com/llvm/llvm-project/commit/d457621872528d27c8081cf147d41a6f46276d1d.diff LOG: [lldb] Fixing warnings / win32 builds in MainLoop. (#146632) Commit 1a7b7e24bcc1041ae0fb90abcfb73d36d76f4a07 introduced a few casting warnings and a build issue in Win32 platforms. Trying to correct the casts to c++ style casts instead of C style casts. Added: Modified: lldb/include/lldb/Host/windows/MainLoopWindows.h lldb/include/lldb/lldb-types.h lldb/source/Host/common/JSONTransport.cpp lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp lldb/source/Host/windows/MainLoopWindows.cpp lldb/source/Utility/SelectHelper.cpp Removed: diff --git a/lldb/include/lldb/Host/windows/MainLoopWindows.h b/lldb/include/lldb/Host/windows/MainLoopWindows.h index 53df815255c3d..705e7e78ba48a 100644 --- a/lldb/include/lldb/Host/windows/MainLoopWindows.h +++ b/lldb/include/lldb/Host/windows/MainLoopWindows.h @@ -17,6 +17,8 @@ namespace lldb_private { +using handle_t = void *; + // Windows-specific implementation of the MainLoopBase class. It can monitor // socket descriptors for readability using WSAEventSelect. Non-socket file // descriptors are not supported. @@ -33,15 +35,15 @@ class MainLoopWindows : public MainLoopBase { class IOEvent { public: -IOEvent(IOObject::WaitableHandle event) : m_event(event) {} +IOEvent(handle_t event) : m_event(event) {} virtual ~IOEvent() {} virtual void WillPoll() {} virtual void DidPoll() {} virtual void Disarm() {} -IOObject::WaitableHandle GetHandle() { return m_event; } +handle_t GetHandle() { return m_event; } protected: -IOObject::WaitableHandle m_event; +handle_t m_event; }; using IOEventUP = std::unique_ptr; diff --git a/lldb/include/lldb/lldb-types.h b/lldb/include/lldb/lldb-types.h index 15781ad626efb..4c07e5abc4424 100644 --- a/lldb/include/lldb/lldb-types.h +++ b/lldb/include/lldb/lldb-types.h @@ -42,12 +42,15 @@ typedef void *rwlock_t; typedef void *process_t; // Process type is HANDLE typedef void *thread_t; // Host thread type typedef void *file_t; // Host file type -typedef unsigned int __w64 socket_t; // Host socket type +typedef uintptr_t socket_t; // Host socket type typedef void *thread_arg_t; // Host thread argument type typedef unsigned thread_result_t; // Host thread result type typedef thread_result_t (*thread_func_t)(void *); // Host thread function type typedef void *pipe_t; // Host pipe type is HANDLE +// printf macro for file_t +#define PRIuFT PRIuPTR + #else #include @@ -63,6 +66,9 @@ typedef void *thread_result_t; // Host thread result type typedef void *(*thread_func_t)(void *); // Host thread function type typedef int pipe_t; // Host pipe type +// printf macro for file_t +#define PRIuFT PRIi32 + #endif // _WIN32 #define LLDB_INVALID_PROCESS ((lldb::process_t)-1) diff --git a/lldb/source/Host/common/JSONTransport.cpp b/lldb/source/Host/common/JSONTransport.cpp index bf269ffa45966..546c12c8f7114 100644 --- a/lldb/source/Host/common/JSONTransport.cpp +++ b/lldb/source/Host/common/JSONTransport.cpp @@ -42,7 +42,8 @@ ReadFull(IOObject &descriptor, size_t length, if (timeout && timeout_supported) { SelectHelper sh; sh.SetTimeout(*timeout); -sh.FDSetRead((lldb::socket_t)descriptor.GetWaitableHandle()); +sh.FDSetRead( +reinterpret_cast(descriptor.GetWaitableHandle())); Status status = sh.Select(); if (status.Fail()) { // Convert timeouts into a specific error. diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index 44a3ed2e59d5f..83eb0c56853b3 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -273,10 +273,10 @@ size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len, if (log) { LLDB_LOGF(log, - "%p ConnectionFileDescriptor::Read() fd = %" PRIu64 + "%p ConnectionFileDescriptor::Read() fd = %" PRIuFT ", dst = %p, dst_len = %" PRIu64 ") => %" PRIu64 ", error = %s", static_cast(this), - static_cast(m_io_sp->GetWaitableHandle()), + static_cast(m_io_sp->GetWaitableHandle()), static_cast(dst), static_cast(dst_len), static_cast(bytes_read), error.AsCString()); } @@ -377,10 +377,10 @@ size_t Connecti
[Lldb-commits] [lldb] [lldb] Fixing warnings / win32 builds in MainLoop. (PR #146632)
https://github.com/ashgti closed https://github.com/llvm/llvm-project/pull/146632 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adjust variable display values. (PR #146754)
jimingham wrote: Object Description is always code-running. It works in languages that have a convention for printing a user-facing string representation of an object. I guess you could have a language with a static way to do this but I haven't seen one. https://github.com/llvm/llvm-project/pull/146754 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adjust variable display values. (PR #146754)
jimingham wrote: dynamic value and object description are orthogonal. Dynamic value is the system that allows you to discover, for instance, the "most specific class of an object" when you are passed a pointer typed as one of the base classes of that most specific class. , I don't think we currently have to run code to get dynamic types anymore. It used to be that in some cases in ObjC we had to do that, but we haven't had to do that for a while. https://github.com/llvm/llvm-project/pull/146754 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adjust variable display values. (PR #146754)
jimingham wrote: The way Xcode deals with this is that the Locals view's Right-Click menu offers a "Print Description" action. That way users can very easily dial up the object description, but doing so remains under the user's explicit control. https://github.com/llvm/llvm-project/pull/146754 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adjust variable display values. (PR #146754)
jimingham wrote: IIRC, C# has a similar object description mechanism, and they had to add some annotations to the object to specify "don't run this one automatically" because they kept getting into trouble with object descriptions that did too much work, or forced lazily evaluated entities to get evaluated, or whatever. This is a policy for the UI to manage, so you can do what you feel is best. But IME the policy of not running code in the target behind the user's back is the most sane policy. https://github.com/llvm/llvm-project/pull/146754 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adjust variable display values. (PR #146754)
jimingham wrote: Also note that for ObjC in particular for many classes the "Object Description" is NOT a summary of the object. Print the Object Description of an NSDictionary 1000 objects and you'll get pages and pages of output with all the elements (and their Descriptions inline IIRC). There is nothing in the contract that says Object Descriptions should be brief. You're accidentally saved in the NSDictionary case because it turns out lldb has a Summary Provider for NSDictionary, but that's not a guarantee. https://github.com/llvm/llvm-project/pull/146754 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 119705e - [lldb][test] Synchronize `__compressed_pair_padding` with libc++ (#142516)
Author: A. Jiang Date: 2025-07-03T13:57:20+08:00 New Revision: 119705e5ad2b7e4bfc55f7df9a8fbaa7504aedbd URL: https://github.com/llvm/llvm-project/commit/119705e5ad2b7e4bfc55f7df9a8fbaa7504aedbd DIFF: https://github.com/llvm/llvm-project/commit/119705e5ad2b7e4bfc55f7df9a8fbaa7504aedbd.diff LOG: [lldb][test] Synchronize `__compressed_pair_padding` with libc++ (#142516) This PR mirrors changes of `__compressed_pair_padding` in libc++ into lldb test suite. Related PR for libc++: - #108956 - #109028 - #142125 Added: Modified: lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/invalid-vector/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/unique_ptr/TestDataFormatterLibcxxUniquePtrSimulator.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/unique_ptr/main.cpp Removed: diff --git a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h index 6dc53a4e88ffd..35649b10ce45e 100644 --- a/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h +++ b/lldb/packages/Python/lldbsuite/test/make/libcxx-simulators-common/compressed_pair.h @@ -58,7 +58,7 @@ class __compressed_pair : private __compressed_pair_elem<_T1, 0>, _T1 &first() { return static_cast<_Base1 &>(*this).__get(); } }; -#elif COMPRESSED_PAIR_REV == 1 +#elif COMPRESSED_PAIR_REV == 1 || COMPRESSED_PAIR_REV == 2 // From libc++ datasizeof.h template struct _FirstPaddingByte { _LLDB_NO_UNIQUE_ADDRESS _Tp __v_; @@ -72,6 +72,9 @@ inline const size_t __datasizeof_v = template struct __lldb_is_final : public integral_constant {}; +// The legacy layout has been patched, see +// https://github.com/llvm/llvm-project/pull/142516. +#if COMPRESSED_PAIR_REV == 1 template class __compressed_pair_padding { char __padding_[((is_empty<_ToPad>::value && !__lldb_is_final<_ToPad>::value) || @@ -79,6 +82,25 @@ template class __compressed_pair_padding { ? 0 : sizeof(_ToPad) - __datasizeof_v<_ToPad>]; }; +#else +template +inline const bool __is_reference_or_unpadded_object = +(std::is_empty<_ToPad>::value && !__lldb_is_final<_ToPad>::value) || +sizeof(_ToPad) == __datasizeof_v<_ToPad>; + +template +inline const bool __is_reference_or_unpadded_object<_Tp &> = true; + +template +inline const bool __is_reference_or_unpadded_object<_Tp &&> = true; + +template > +class __compressed_pair_padding { + char __padding_[sizeof(_ToPad) - __datasizeof_v<_ToPad>] = {}; +}; + +template class __compressed_pair_padding<_ToPad, true> {}; +#endif #define _LLDB_COMPRESSED_PAIR(T1, Initializer1, T2, Initializer2) \ [[__gnu__::__aligned__( \ @@ -96,7 +118,7 @@ template class __compressed_pair_padding { _LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding __padding2_; \ _LLDB_NO_UNIQUE_ADDRESS T3 Initializer3; \ _LLDB_NO_UNIQUE_ADDRESS __compressed_pair_padding __padding3_; -#elif COMPRESSED_PAIR_REV == 2 +#elif COMPRESSED_PAIR_REV == 3 #define _LLDB_COMPRESSED_PAIR(T1, Name1, T2, Name2) \ _LLDB_NO_UNIQUE_ADDRESS T1 Name1; \ _LLDB_NO_UNIQUE_ADDRESS T2 Name2 diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/invalid-vector/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/invalid-vector/main.cpp index 3a745883fb49c..f10811817c0d2 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/invalid-vector/main.cpp +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/invalid-vector/main.cpp @@ -1,4 +1,4 @@ -#define COMPRESSED_PAIR_REV 2 +#define COMPRESSED_PAIR_REV 3 #include namespace std { diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py index c996fff4fb7aa..c8d9c2e389a05 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py +
[Lldb-commits] [lld] [lldb] [llvm] [AArch64] Support TLS variables in debug info (PR #146572)
smithp35 wrote: > Just requesting changes so we don't forget about the ABI change. > > Might need to coordinate with other toolchains, we can deal with that after > ABI discussions. I did a quick check of the support for R_AARCH64_TLS_DTPREL64 in GNU by making up a fake .debug_info section with .reloc ``` .global foo .type foo, %tls_object .section .debug_info, "", %progbits .xword 0 .reloc 0x0, R_AARCH64_TLS_DTPREL64, foo ``` Looks like there's a small change needed in GNU ld to make this work there ``` aarch64-none-linux-gnu-ld: warning: cannot find entry symbol _start; defaulting to 004000b0 dtprel.o:(.debug_info+0x0): dangerous relocation: unsupported relocation ``` I think this is just a matter of putting the relocation into the switch statement as all the other parts seem to be there. We may want to conditionally add the relocation on aarch64-linux-gnu targets as if we put it out universally we're going to make clang -g output incompatible with the system linker for many programs. https://github.com/llvm/llvm-project/pull/146572 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)
DavidSpickett wrote: > I'm still seeing the no job control error in the pre-commit CI. As far as I > know this error is not supposed to be happening, RPC should be getting built > which should mean that the lldb-rpc-gen tool is available for use in the > shell test. I can't repro locally, I'm wondering if this is a Linux-specific > issue. The very latest CI build has a different failure, one that I can reproduce locally too. ``` FAIL: lldb-shell :: RPC/Generator/Tests/CheckRPCGenToolByproducts.test (622 of 639) TEST 'lldb-shell :: RPC/Generator/Tests/CheckRPCGenToolByproducts.test' FAILED Exit Code: 1 Command Output (stderr): -- /home/david.spickett/build-llvm-aarch64/bin/lldb-rpc-gen --extra-arg="-resource-dir=/home/david.spickett/build-llvm-aarch64/lib/clang/21" --output-dir=/home/david.spickett/build-llvm-aarch64/tools/lldb/test/Shell/RPC/Generator/Tests/Output/CheckRPCGenToolByproducts.test.tmp /home/david.spickett/llvm-project/lldb/test/Shell/RPC/Generator/Tests/../../../../../include/lldb/API/SBAddress.h # RUN: at line 3 + /home/david.spickett/build-llvm-aarch64/bin/lldb-rpc-gen --extra-arg=-resource-dir=/home/david.spickett/build-llvm-aarch64/lib/clang/21 --output-dir=/home/david.spickett/build-llvm-aarch64/tools/lldb/test/Shell/RPC/Generator/Tests/Output/CheckRPCGenToolByproducts.test.tmp /home/david.spickett/llvm-project/lldb/test/Shell/RPC/Generator/Tests/../../../../../include/lldb/API/SBAddress.h Error while trying to load a compilation database: Could not auto-detect compilation database for file "/home/david.spickett/llvm-project/lldb/test/Shell/RPC/Generator/Tests/../../../../../include/lldb/API/SBAddress.h" No compilation database found in /home/david.spickett/llvm-project/lldb/test/Shell/RPC/Generator/Tests/../../../../../include/lldb/API or any parent directory fixed-compilation-database: Error while opening fixed database: No such file or directory json-compilation-database: Error while opening JSON database: No such file or directory Running without flags. In file included from /home/david.spickett/llvm-project/lldb/test/Shell/RPC/Generator/Tests/../../../../../include/lldb/API/SBAddress.h:12: In file included from /usr/local/include/lldb/API/SBDefines.h:12: In file included from /usr/local/include/lldb/lldb-defines.h:12: In file included from /usr/local/include/lldb/lldb-types.h:12: /usr/local/include/lldb/lldb-enumerations.h:12:10: fatal error: 'cstdint' file not found 12 | #include | ^ 1 error generated. Error while processing /home/david.spickett/llvm-project/lldb/test/Shell/RPC/Generator/Tests/../../../../../include/lldb/API/SBAddress.h. Failed to create output file: /home/david.spickett/build-llvm-aarch64/tools/lldb/test/Shell/RPC/Generator/Tests/Output/CheckRPCGenToolByproducts.test.tmp/SBClasses.def! Failed to create SB Class file -- Failed Tests (1): lldb-shell :: RPC/Generator/Tests/CheckRPCGenToolByproducts.test ``` This build was done with a warm ccache, and the new option defaulted to ON as expected. Hopefully that means that bit is solved. https://github.com/llvm/llvm-project/pull/138031 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Consolidate generic and libcxx std::deque formatter tests (PR #146697)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r HEAD~1...HEAD lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py `` View the diff from darker here. ``diff --- TestDataFormatterGenericDeque.py2025-07-02 13:51:05.00 + +++ TestDataFormatterGenericDeque.py2025-07-02 13:56:45.059767 + @@ -119,13 +119,11 @@ ) lldbutil.continue_to_breakpoint(process, bkpt) # first value added -self.expect( -"frame variable empty", substrs=["empty = size=1", "[0] = 1", "}"] -) +self.expect("frame variable empty", substrs=["empty = size=1", "[0] = 1", "}"]) # add remaining values lldbutil.continue_to_breakpoint(process, bkpt) self.check_numbers("empty") `` https://github.com/llvm/llvm-project/pull/146697 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)
DavidSpickett wrote: Also it's a bit misleading, this is printed but I don't know if it is the cause of the include problem: ``` fixed-compilation-database: Error while opening fixed database: No such file or directory json-compilation-database: Error while opening JSON database: No such file or directory Running without flags. ``` I expect not because the compilation database only deals with sources, .cpp, .cc etc. not headers. https://github.com/llvm/llvm-project/pull/138031 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SB API to make a breakpoint a hardware breakpoint (PR #146602)
@@ -69,7 +69,7 @@ class BreakpointLocation // The next section deals with various breakpoint options. /// If \a enabled is \b true, enable the breakpoint, if \b false disable it. - void SetEnabled(bool enabled); + bool SetEnabled(bool enabled); jimingham wrote: Might be good here to document how this can fail. If you enable a HW breakpoint after you've used up all the resources with other breakpoints is the only case I can think of, but that's not entirely obvious. That's the only way this can fail that I can think of. If there are other ways this could fail, we should return an SBError to distinguish between them. https://github.com/llvm/llvm-project/pull/146602 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SB API to make a breakpoint a hardware breakpoint (PR #146602)
@@ -148,6 +148,8 @@ class LLDB_API SBBreakpoint { bool IsHardware() const; + bool SetIsHardware(bool is_hardware); jimingham wrote: Document the return value's meaning somewhere. https://github.com/llvm/llvm-project/pull/146602 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SB API to make a breakpoint a hardware breakpoint (PR #146602)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/146602 >From 656beb2df5f39604454af0e3f4a9f4b1b7e9c5f8 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 1 Jul 2025 16:02:21 -0700 Subject: [PATCH 1/3] [lldb] Add SB API to make a breakpoint a hardware breakpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds SBBreakpoint::SetIsHardware, allowing clients to mark an existing breakpoint as a hardware breakpoint purely through the API. This is safe to do after creation, as the hardware/software distinction doesn't affect how breakpoint locations are selected. In some cases (e.g. when writing a trap instruction would alter program behavior), it's important to use hardware breakpoints. Ideally, we’d extend the various Create methods to support this, but given their number, this patch limits the scope to the post-creation API. As a workaround, users can also rely on target.require-hardware-breakpoint or use the breakpoint set command. rdar://153528045 --- lldb/include/lldb/API/SBBreakpoint.h | 2 + lldb/include/lldb/Breakpoint/Breakpoint.h | 1 + lldb/source/API/SBBreakpoint.cpp | 11 + lldb/source/Breakpoint/Breakpoint.cpp | 21 ++ .../simple_hw_breakpoints/Makefile| 7 .../TestSimpleHWBreakpoints.py| 40 +++ .../simple_hw_breakpoints/main.c | 7 7 files changed, 89 insertions(+) create mode 100644 lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/Makefile create mode 100644 lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/TestSimpleHWBreakpoints.py create mode 100644 lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/main.c diff --git a/lldb/include/lldb/API/SBBreakpoint.h b/lldb/include/lldb/API/SBBreakpoint.h index e08df3b6d5ab0..307c9e13d7e39 100644 --- a/lldb/include/lldb/API/SBBreakpoint.h +++ b/lldb/include/lldb/API/SBBreakpoint.h @@ -148,6 +148,8 @@ class LLDB_API SBBreakpoint { bool IsHardware() const; + void SetIsHardware(bool is_hardware); + // Can only be called from a ScriptedBreakpointResolver... SBError AddLocation(SBAddress &address); diff --git a/lldb/include/lldb/Breakpoint/Breakpoint.h b/lldb/include/lldb/Breakpoint/Breakpoint.h index f623a2e0c295b..8b1ab219832cc 100644 --- a/lldb/include/lldb/Breakpoint/Breakpoint.h +++ b/lldb/include/lldb/Breakpoint/Breakpoint.h @@ -518,6 +518,7 @@ class Breakpoint : public std::enable_shared_from_this, lldb::break_id_t bp_loc_id); bool IsHardware() const { return m_hardware; } + void SetIsHardware(bool is_hardware); lldb::BreakpointResolverSP GetResolver() { return m_resolver_sp; } diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp index 87fadbcec4f26..d790b3f4ca271 100644 --- a/lldb/source/API/SBBreakpoint.cpp +++ b/lldb/source/API/SBBreakpoint.cpp @@ -781,6 +781,17 @@ bool SBBreakpoint::IsHardware() const { return false; } +void SBBreakpoint::SetIsHardware(bool is_hardware) { + LLDB_INSTRUMENT_VA(this, is_hardware); + + BreakpointSP bkpt_sp = GetSP(); + if (bkpt_sp) { +std::lock_guard guard( +bkpt_sp->GetTarget().GetAPIMutex()); +bkpt_sp->SetIsHardware(is_hardware); + } +} + BreakpointSP SBBreakpoint::GetSP() const { return m_opaque_wp.lock(); } // This is simple collection of breakpoint id's and their target. diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index 2ed0c9314e3e1..d5845ebeeb08a 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -251,6 +251,27 @@ const lldb::TargetSP Breakpoint::GetTargetSP() { bool Breakpoint::IsInternal() const { return LLDB_BREAK_ID_IS_INTERNAL(m_bid); } +void Breakpoint::SetIsHardware(bool is_hardware) { + if (is_hardware == m_hardware) +return; + + // Remember all the breakpoint locations we've disabled. + std::vector locations; + for (BreakpointLocationSP location : m_locations.BreakpointLocations()) { +if (location->IsEnabled()) { + locations.push_back(location); + location->SetEnabled(false); +} + } + + // Toggle the hardware mode. + m_hardware = is_hardware; + + // Re-enable the breakpoint locations. + for (BreakpointLocationSP location : locations) +location->SetEnabled(true); +} + BreakpointLocationSP Breakpoint::AddLocation(const Address &addr, bool *new_location) { return m_locations.AddLocation(addr, m_resolve_indirect_symbols, diff --git a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/Makefile b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/Makefile new file mode 100644 index 0..304633c2dca1f --- /dev/null
[Lldb-commits] [lldb] [lldb] Add SB API to make a breakpoint a hardware breakpoint (PR #146602)
jimingham wrote: There's one more tricky bit we need to handle here. What happens if I have a breakpoint that has more locations than we have hardware resources, and you do `SBBreakpoint.SetIsHardware(True)`? Do we set the first `n` breakpoints and stop there? Do we back out and restore the breakpoint to software? Maybe we need an actual error and not a bool to explain what went on there? https://github.com/llvm/llvm-project/pull/146602 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add SB API to make a breakpoint a hardware breakpoint (PR #146602)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/146602 >From 656beb2df5f39604454af0e3f4a9f4b1b7e9c5f8 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 1 Jul 2025 16:02:21 -0700 Subject: [PATCH 1/4] [lldb] Add SB API to make a breakpoint a hardware breakpoint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds SBBreakpoint::SetIsHardware, allowing clients to mark an existing breakpoint as a hardware breakpoint purely through the API. This is safe to do after creation, as the hardware/software distinction doesn't affect how breakpoint locations are selected. In some cases (e.g. when writing a trap instruction would alter program behavior), it's important to use hardware breakpoints. Ideally, we’d extend the various Create methods to support this, but given their number, this patch limits the scope to the post-creation API. As a workaround, users can also rely on target.require-hardware-breakpoint or use the breakpoint set command. rdar://153528045 --- lldb/include/lldb/API/SBBreakpoint.h | 2 + lldb/include/lldb/Breakpoint/Breakpoint.h | 1 + lldb/source/API/SBBreakpoint.cpp | 11 + lldb/source/Breakpoint/Breakpoint.cpp | 21 ++ .../simple_hw_breakpoints/Makefile| 7 .../TestSimpleHWBreakpoints.py| 40 +++ .../simple_hw_breakpoints/main.c | 7 7 files changed, 89 insertions(+) create mode 100644 lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/Makefile create mode 100644 lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/TestSimpleHWBreakpoints.py create mode 100644 lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/main.c diff --git a/lldb/include/lldb/API/SBBreakpoint.h b/lldb/include/lldb/API/SBBreakpoint.h index e08df3b6d5ab0..307c9e13d7e39 100644 --- a/lldb/include/lldb/API/SBBreakpoint.h +++ b/lldb/include/lldb/API/SBBreakpoint.h @@ -148,6 +148,8 @@ class LLDB_API SBBreakpoint { bool IsHardware() const; + void SetIsHardware(bool is_hardware); + // Can only be called from a ScriptedBreakpointResolver... SBError AddLocation(SBAddress &address); diff --git a/lldb/include/lldb/Breakpoint/Breakpoint.h b/lldb/include/lldb/Breakpoint/Breakpoint.h index f623a2e0c295b..8b1ab219832cc 100644 --- a/lldb/include/lldb/Breakpoint/Breakpoint.h +++ b/lldb/include/lldb/Breakpoint/Breakpoint.h @@ -518,6 +518,7 @@ class Breakpoint : public std::enable_shared_from_this, lldb::break_id_t bp_loc_id); bool IsHardware() const { return m_hardware; } + void SetIsHardware(bool is_hardware); lldb::BreakpointResolverSP GetResolver() { return m_resolver_sp; } diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp index 87fadbcec4f26..d790b3f4ca271 100644 --- a/lldb/source/API/SBBreakpoint.cpp +++ b/lldb/source/API/SBBreakpoint.cpp @@ -781,6 +781,17 @@ bool SBBreakpoint::IsHardware() const { return false; } +void SBBreakpoint::SetIsHardware(bool is_hardware) { + LLDB_INSTRUMENT_VA(this, is_hardware); + + BreakpointSP bkpt_sp = GetSP(); + if (bkpt_sp) { +std::lock_guard guard( +bkpt_sp->GetTarget().GetAPIMutex()); +bkpt_sp->SetIsHardware(is_hardware); + } +} + BreakpointSP SBBreakpoint::GetSP() const { return m_opaque_wp.lock(); } // This is simple collection of breakpoint id's and their target. diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index 2ed0c9314e3e1..d5845ebeeb08a 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -251,6 +251,27 @@ const lldb::TargetSP Breakpoint::GetTargetSP() { bool Breakpoint::IsInternal() const { return LLDB_BREAK_ID_IS_INTERNAL(m_bid); } +void Breakpoint::SetIsHardware(bool is_hardware) { + if (is_hardware == m_hardware) +return; + + // Remember all the breakpoint locations we've disabled. + std::vector locations; + for (BreakpointLocationSP location : m_locations.BreakpointLocations()) { +if (location->IsEnabled()) { + locations.push_back(location); + location->SetEnabled(false); +} + } + + // Toggle the hardware mode. + m_hardware = is_hardware; + + // Re-enable the breakpoint locations. + for (BreakpointLocationSP location : locations) +location->SetEnabled(true); +} + BreakpointLocationSP Breakpoint::AddLocation(const Address &addr, bool *new_location) { return m_locations.AddLocation(addr, m_resolve_indirect_symbols, diff --git a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/Makefile b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/simple_hw_breakpoints/Makefile new file mode 100644 index 0..304633c2dca1f --- /dev/null
[Lldb-commits] [lldb] [llvm] [lldb][NFC][MachO] Clean up LC_THREAD reading code, remove i386 corefile (PR #146480)
https://github.com/JDevlieghere approved this pull request. 👋 https://github.com/llvm/llvm-project/pull/146480 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Take a sledgehammer approach to resizing the statusline (PR #146578)
JDevlieghere wrote: @labath let me know what you think of this approach. I'd like to take this on the Swift 6.2 release branch as it addresses several issues folks have reported. https://github.com/llvm/llvm-project/pull/146578 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests (PR #146740)
adrian-prantl wrote: More test coverage sounds great! https://github.com/llvm/llvm-project/pull/146740 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 40275a4 - [lldb][test] Add tests for formatting pointers to std::unordered_map
Author: Michael Buch Date: 2025-07-02T11:21:02+01:00 New Revision: 40275a4ee31203b9ed014b0b830f456a1c267063 URL: https://github.com/llvm/llvm-project/commit/40275a4ee31203b9ed014b0b830f456a1c267063 DIFF: https://github.com/llvm/llvm-project/commit/40275a4ee31203b9ed014b0b830f456a1c267063.diff LOG: [lldb][test] Add tests for formatting pointers to std::unordered_map Ever since #143501 and #144517, these should pass. Adds tests for https://github.com/llvm/llvm-project/issues/146040 Added: Modified: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp Removed: diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py index 2b1bd676a5b34..bf103aa78baba 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py @@ -9,21 +9,28 @@ class LibcxxUnorderedMapDataFormatterTestCase(TestBase): -def check_reference(self, var_name: str, expected_type: str): -self.expect_var_path( -var_name, -summary="size=1", -type=expected_type, -children=[ -ValueCheck( -name="[0]", -children=[ -ValueCheck(name="first", summary='"Hello"'), -ValueCheck(name="second", summary='"World"'), -], -), -], -) +def check_ptr_or_ref(self, var_name: str): +var = self.frame().FindVariable(var_name) +self.assertTrue(var) + +pair = var.GetChildAtIndex(0) +self.assertTrue(pair) + +self.assertEqual(pair.GetChildAtIndex(0).summary, '"Hello"') +self.assertEqual(pair.GetChildAtIndex(1).summary, '"World"') + +def check_ptr_ptr(self, var_name: str): +var = self.frame().FindVariable(var_name) +self.assertTrue(var) + +ptr = var.GetChildAtIndex(0) +self.assertTrue(ptr) + +pair = ptr.GetChildAtIndex(0) +self.assertTrue(pair) + +self.assertEqual(pair.GetChildAtIndex(0).summary, '"Hello"') +self.assertEqual(pair.GetChildAtIndex(1).summary, '"World"') @add_test_categories(["libc++"]) def test_iterator_formatters(self): @@ -84,12 +91,12 @@ def test_iterator_formatters(self): lldbutil.continue_to_breakpoint(process, bkpt) # Test references to std::unordered_map -self.check_reference("ref1", "const StringMapT &") -self.check_reference("ref2", "StringMapT &") -self.check_reference("ref3", "StringMapTRef") -self.check_reference("ref4", "const StringMapT &") -self.check_reference("ref5", "const StringMapT &&") -self.check_reference("ref6", "StringMapT &&") +self.check_ptr_or_ref("ref1") +self.check_ptr_or_ref("ref2") +self.check_ptr_or_ref("ref3") +self.check_ptr_or_ref("ref4") +self.check_ptr_or_ref("ref5") +self.check_ptr_or_ref("ref6") # FIXME: we're getting this wrong. self.expect_var_path( @@ -97,3 +104,12 @@ def test_iterator_formatters(self): summary="size=0", type="const StringMapT *const &", ) + +lldbutil.continue_to_breakpoint(process, bkpt) + +self.check_ptr_or_ref("ptr1") +self.check_ptr_or_ref("ptr2") +self.check_ptr_or_ref("ptr3") +self.check_ptr_ptr("ptr4") +self.check_ptr_ptr("ptr5") +self.check_ptr_ptr("ptr6") diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp index c581fded1ec5f..26cbb9476119d 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp @@ -4,6 +4,7 @@ using StringMapT = std::unordered_map; using StringMapTRef = const StringMapT &; +using StringMapTPtr = const StringMapT *; static void check_references(const StringMapT &ref1, StringMapT &ref2, StringMapTRef ref3, StringMapTRef &ref4, @@ -12,6 +13,12 @@ static void check_references(const StringMapT &ref1, StringMapT &ref2, std::printf("Break here"); } +static void check_pointer(const StringMa
[Lldb-commits] [lldb] [LLDB] Simplify libstdc++ string summaries (PR #146562)
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/146562 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 4c7a706 - [LLDB] Simplify libstdc++ string summaries (#146562)
Author: nerix Date: 2025-07-02T11:21:31+01:00 New Revision: 4c7a706589ca97101972c88d90449d27275b3ab5 URL: https://github.com/llvm/llvm-project/commit/4c7a706589ca97101972c88d90449d27275b3ab5 DIFF: https://github.com/llvm/llvm-project/commit/4c7a706589ca97101972c88d90449d27275b3ab5.diff LOG: [LLDB] Simplify libstdc++ string summaries (#146562) >From #143177. This combines the summaries for the pre- and post C++ 11 `std::string` as well as `std::wstring`. In all cases, the data pointer is reachable through `_M_dataplus._M_p`. It has the correct type (i.e. `char*`/`wchar_t*`) and it's null terminated, so LLDB knows how to format it as expected when using `GetSummaryAsCString`. Added: Modified: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.h Removed: diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 7ae2e141a63e0..f96fd0f0bcd30 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -1344,38 +1344,31 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { .SetShowMembersOneLiner(false) .SetHideItemNames(false); - lldb::TypeSummaryImplSP std_string_summary_sp( - new StringSummaryFormat(stl_summary_flags, "${var._M_dataplus._M_p}")); - - lldb::TypeSummaryImplSP cxx11_string_summary_sp(new CXXFunctionSummaryFormat( + lldb::TypeSummaryImplSP string_summary_sp(new CXXFunctionSummaryFormat( stl_summary_flags, LibStdcppStringSummaryProvider, - "libstdc++ c++11 std::string summary provider")); - lldb::TypeSummaryImplSP cxx11_wstring_summary_sp(new CXXFunctionSummaryFormat( - stl_summary_flags, LibStdcppWStringSummaryProvider, - "libstdc++ c++11 std::wstring summary provider")); + "libstdc++ std::(w)string summary provider")); cpp_category_sp->AddTypeSummary("std::string", eFormatterMatchExact, - std_string_summary_sp); + string_summary_sp); cpp_category_sp->AddTypeSummary("std::basic_string", - eFormatterMatchExact, std_string_summary_sp); + eFormatterMatchExact, string_summary_sp); cpp_category_sp->AddTypeSummary( "std::basic_string,std::allocator >", - eFormatterMatchExact, std_string_summary_sp); + eFormatterMatchExact, string_summary_sp); cpp_category_sp->AddTypeSummary( "std::basic_string, std::allocator >", - eFormatterMatchExact, std_string_summary_sp); + eFormatterMatchExact, string_summary_sp); cpp_category_sp->AddTypeSummary("std::__cxx11::string", eFormatterMatchExact, - cxx11_string_summary_sp); + string_summary_sp); cpp_category_sp->AddTypeSummary( "std::__cxx11::basic_string, " "std::allocator >", - eFormatterMatchExact, cxx11_string_summary_sp); + eFormatterMatchExact, string_summary_sp); cpp_category_sp->AddTypeSummary("std::__cxx11::basic_string, " "std::allocator >", - eFormatterMatchExact, - cxx11_string_summary_sp); + eFormatterMatchExact, string_summary_sp); // making sure we force-pick the summary for printing wstring (_M_p is a // wchar_t*) @@ -1395,11 +1388,11 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) { eFormatterMatchExact, std_wstring_summary_sp); cpp_category_sp->AddTypeSummary("std::__cxx11::wstring", eFormatterMatchExact, - cxx11_wstring_summary_sp); + string_summary_sp); cpp_category_sp->AddTypeSummary( "std::__cxx11::basic_string, " "std::allocator >", - eFormatterMatchExact, cxx11_wstring_summary_sp); + eFormatterMatchExact, string_summary_sp); SyntheticChildren::Flags stl_synth_flags; stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences( diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp index 77e0755607a06..28b7c01ab1b5b 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp @@ -239,122 +239,12 @@ VectorIteratorSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) { bool lldb_private::formatters::LibStdcppStringSummaryProvider( ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) { - const bool scalar_is_load_addr = true; - auto [ad
[Lldb-commits] [lldb] [lldb][test] Consolidate generic and libcxx std::deque formatter tests (PR #146697)
https://github.com/adrian-prantl approved this pull request. https://github.com/llvm/llvm-project/pull/146697 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] e324392 - [lldb][test] Consolidate generic and libcxx std::deque formatter tests (#146697)
Author: Michael Buch Date: 2025-07-02T16:05:09+01:00 New Revision: e32439249d8af2b1d0654e01472506d7e0c92f7b URL: https://github.com/llvm/llvm-project/commit/e32439249d8af2b1d0654e01472506d7e0c92f7b DIFF: https://github.com/llvm/llvm-project/commit/e32439249d8af2b1d0654e01472506d7e0c92f7b.diff LOG: [lldb][test] Consolidate generic and libcxx std::deque formatter tests (#146697) The plan is to move all STL formatter API tests into a single directory. The `std::deque` test is currently the only test that is duplicated between the `libcxx` and `generic` directories. This patch moves the libcxx deque tests into `generic` (moving over any functionality that wasn't tested in the `generic` tests, mainly formatting pointers/references to `std::deque`). Added: Modified: lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/main.cpp Removed: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/Makefile lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/TestDataFormatterLibcxxDeque.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py index abe2a2b7895de..f52f6f7ec3ffb 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py @@ -21,9 +21,44 @@ def check_size(self, var_name, size): var = self.findVariable(var_name) self.assertEqual(var.GetNumChildren(), size) +def check_numbers(self, var_name, show_ptr=False): +patterns = [] +substrs = [ +"[0] = 1", +"[1] = 12", +"[2] = 123", +"[3] = 1234", +"[4] = 12345", +"[5] = 123456", +"[6] = 1234567", +"}", +] +if show_ptr: +patterns = [var_name + " = 0x.* size=7"] +else: +substrs.insert(0, var_name + " = size=7") +self.expect( +"frame variable " + var_name, +patterns=patterns, +substrs=substrs, +) +self.expect_expr( +var_name, +result_summary="size=7", +result_children=[ +ValueCheck(value="1"), +ValueCheck(value="12"), +ValueCheck(value="123"), +ValueCheck(value="1234"), +ValueCheck(value="12345"), +ValueCheck(value="123456"), +ValueCheck(value="1234567"), +], +) + def do_test(self, stdlib_type): self.build(dictionary={stdlib_type: "1"}) -lldbutil.run_to_source_breakpoint( +(_, process, _, bkpt) = lldbutil.run_to_source_breakpoint( self, "break here", lldb.SBFileSpec("main.cpp") ) @@ -83,6 +118,21 @@ def do_test(self, stdlib_type): ], ) +lldbutil.continue_to_breakpoint(process, bkpt) + +# first value added +self.expect("frame variable empty", substrs=["empty = size=1", "[0] = 1", "}"]) + +# add remaining values +lldbutil.continue_to_breakpoint(process, bkpt) + +self.check_numbers("empty") + +# clear out the deque +lldbutil.continue_to_breakpoint(process, bkpt) + +self.expect_expr("empty", result_children=[]) + @add_test_categories(["libstdcxx"]) def test_libstdcpp(self): self.do_test(USE_LIBSTDCPP) @@ -90,3 +140,25 @@ def test_libstdcpp(self): @add_test_categories(["libc++"]) def test_libcpp(self): self.do_test(USE_LIBCPP) + +def do_test_ref_and_ptr(self, stdlib_type: str): +"""Test formatting of std::deque& and std::deque*""" +self.build(dictionary={stdlib_type: "1"}) +(self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( +self, "stop here", lldb.SBFileSpec("main.cpp", False) +) + +# The reference should display the same was as the value did +self.check_numbers("ref", True) + +# The pointer should just show the right number of elements: +self.expect("frame variable ptr", substrs=["ptr =", " size=7"]) +self.expect("expression ptr", substrs=["$", "size=7"]) + +@add_test_categories(["libstdcxx"]) +def test_libstdcpp_ref_and_ptr(self): +self.do_test_ref_and_ptr(USE_LIBSTDCPP) + +@add_test_categories
[Lldb-commits] [lldb] [lldb][test] Consolidate generic and libcxx std::deque formatter tests (PR #146697)
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/146697 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests (PR #146740)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/146740 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests (PR #146740)
https://github.com/adrian-prantl approved this pull request. https://github.com/llvm/llvm-project/pull/146740 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][mcp] Fix unix domain socket protocol server addresses (PR #146603)
https://github.com/aperez updated https://github.com/llvm/llvm-project/pull/146603 >From 8ffabe86dd320880736c691e45e71611988ceb38 Mon Sep 17 00:00:00 2001 From: Alexandre Perez Date: Tue, 1 Jul 2025 14:19:45 -0700 Subject: [PATCH 1/2] [lldb][mcp] Fix unix domain socket protocol server addresses --- lldb/source/Commands/CommandObjectProtocolServer.cpp | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lldb/source/Commands/CommandObjectProtocolServer.cpp b/lldb/source/Commands/CommandObjectProtocolServer.cpp index 55bd42ed1a533..4cafd2266e235 100644 --- a/lldb/source/Commands/CommandObjectProtocolServer.cpp +++ b/lldb/source/Commands/CommandObjectProtocolServer.cpp @@ -75,9 +75,12 @@ class CommandObjectProtocolServerStart : public CommandObjectParsed { ProtocolServer::Connection connection; connection.protocol = protocol_and_mode->first; -connection.name = -formatv("[{0}]:{1}", uri->hostname.empty() ? "0.0.0.0" : uri->hostname, -uri->port.value_or(0)); +if (connection.protocol == Socket::SocketProtocol::ProtocolUnixDomain) + connection.name = uri->path; +else + connection.name = formatv( + "[{0}]:{1}", uri->hostname.empty() ? "0.0.0.0" : uri->hostname, + uri->port.value_or(0)); if (llvm::Error error = server->Start(connection)) { result.AppendErrorWithFormatv("{0}", llvm::fmt_consume(std::move(error))); >From 42150df6829d641756aa5bfc060ac579447c0391 Mon Sep 17 00:00:00 2001 From: Alexandre Perez Date: Wed, 2 Jul 2025 10:14:09 -0700 Subject: [PATCH 2/2] Add test --- .../Commands/CommandObjectProtocolServer.cpp | 1 + .../commands/protocol/TestMCPUnixSocket.py| 23 +++ 2 files changed, 24 insertions(+) create mode 100644 lldb/test/API/commands/protocol/TestMCPUnixSocket.py diff --git a/lldb/source/Commands/CommandObjectProtocolServer.cpp b/lldb/source/Commands/CommandObjectProtocolServer.cpp index 4cafd2266e235..f11e27f01c8a8 100644 --- a/lldb/source/Commands/CommandObjectProtocolServer.cpp +++ b/lldb/source/Commands/CommandObjectProtocolServer.cpp @@ -93,6 +93,7 @@ class CommandObjectProtocolServerStart : public CommandObjectParsed { result.AppendMessageWithFormatv( "{0} server started with connection listeners: {1}", protocol, address); + result.SetStatus(eReturnStatusSuccessFinishNoResult); } } }; diff --git a/lldb/test/API/commands/protocol/TestMCPUnixSocket.py b/lldb/test/API/commands/protocol/TestMCPUnixSocket.py new file mode 100644 index 0..6f5405b82666d --- /dev/null +++ b/lldb/test/API/commands/protocol/TestMCPUnixSocket.py @@ -0,0 +1,23 @@ +import os +import tempfile + +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * + + +class MCPUnixSocketCommandTestCase(TestBase): +@skipIfWindows +@no_debug_info_test +def test_unix_socket(self): +""" +Test if we can start an MCP protocol-server accepting unix sockets +""" + +temp_directory = tempfile.TemporaryDirectory() +socket_file = os.path.join(temp_directory.name, "mcp.sock") + +self.expect( +f"protocol-server start MCP accept://{socket_file}", +startstr="MCP server started with connection listeners:", +substrs=[f"unix-connect://{socket_file}"], +) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][mcp] Fix unix domain socket protocol server addresses (PR #146603)
aperez wrote: @kusmour @JDevlieghere I added a test for this. Since my change is in command parsing I created a test in `lldb/test/API/commands/protocol/` rather than extend `lldb/unittests/Protocol/ProtocolMCPServerTest.cpp`. LMK what you think. https://github.com/llvm/llvm-project/pull/146603 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb][NFC][MachO] Clean up LC_THREAD reading code, remove i386 corefile (PR #146480)
https://github.com/jasonmolenda closed https://github.com/llvm/llvm-project/pull/146480 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use correct size when dumping DWARF64 DW_FORM_ref_addr (PR #146686)
DavidSpickett wrote: @HemangGadhavi (can't add you to reviewers for whatever reason) https://github.com/llvm/llvm-project/pull/146686 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Consolidate generic and libcxx std::deque formatter tests (PR #146697)
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/146697 The plan is to move all STL formatter API tests into a single directory. The `std::deque` test is currently the only test that is duplicated between the `libcxx` and `generic` directories. This patch moves the libcxx deque tests into `generic` (moving over any functionality that wasn't tested in the `generic` tests, mainly formatting pointers/references to `std::deque`). >From 168f2c960757ad0203391724836d021b8bf89b5b Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 2 Jul 2025 14:51:04 +0100 Subject: [PATCH] [lldb][test] Consolidate generic and libcxx std::deque formatter tests The plan is to move all STL formatter API tests into a single directory. The `std::deque` test is currently the only test that is duplicated between the `libcxx` and `generic` directories. This patch moves the libcxx deque tests into `generic` (moving over any functionality that wasn't tested in the `generic` tests, mainly formatting pointers/references to `std::deque`). --- .../deque/TestDataFormatterGenericDeque.py| 76 +++- .../data-formatter-stl/generic/deque/main.cpp | 25 +- .../data-formatter-stl/libcxx/deque/Makefile | 4 - .../deque/TestDataFormatterLibcxxDeque.py | 87 --- .../data-formatter-stl/libcxx/deque/main.cpp | 30 --- 5 files changed, 99 insertions(+), 123 deletions(-) delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/Makefile delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/TestDataFormatterLibcxxDeque.py delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py index abe2a2b7895de..cf6b339a111c1 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py @@ -21,9 +21,44 @@ def check_size(self, var_name, size): var = self.findVariable(var_name) self.assertEqual(var.GetNumChildren(), size) +def check_numbers(self, var_name, show_ptr=False): +patterns = [] +substrs = [ +"[0] = 1", +"[1] = 12", +"[2] = 123", +"[3] = 1234", +"[4] = 12345", +"[5] = 123456", +"[6] = 1234567", +"}", +] +if show_ptr: +patterns = [var_name + " = 0x.* size=7"] +else: +substrs.insert(0, var_name + " = size=7") +self.expect( +"frame variable " + var_name, +patterns=patterns, +substrs=substrs, +) +self.expect_expr( +var_name, +result_summary="size=7", +result_children=[ +ValueCheck(value="1"), +ValueCheck(value="12"), +ValueCheck(value="123"), +ValueCheck(value="1234"), +ValueCheck(value="12345"), +ValueCheck(value="123456"), +ValueCheck(value="1234567"), +], +) + def do_test(self, stdlib_type): self.build(dictionary={stdlib_type: "1"}) -lldbutil.run_to_source_breakpoint( +(_, process, _, bkpt) = lldbutil.run_to_source_breakpoint( self, "break here", lldb.SBFileSpec("main.cpp") ) @@ -83,6 +118,23 @@ def do_test(self, stdlib_type): ], ) +lldbutil.continue_to_breakpoint(process, bkpt) + +# first value added +self.expect( +"frame variable empty", substrs=["empty = size=1", "[0] = 1", "}"] +) + +# add remaining values +lldbutil.continue_to_breakpoint(process, bkpt) + +self.check_numbers("empty") + +# clear out the deque +lldbutil.continue_to_breakpoint(process, bkpt) + +self.expect_expr("empty", result_children=[]) + @add_test_categories(["libstdcxx"]) def test_libstdcpp(self): self.do_test(USE_LIBSTDCPP) @@ -90,3 +142,25 @@ def test_libstdcpp(self): @add_test_categories(["libc++"]) def test_libcpp(self): self.do_test(USE_LIBCPP) + +def do_test_ref_and_ptr(self, stdlib_type: str): +"""Test formatting of std::deque& and std::deque*""" +self.build(dictionary={stdlib_type: "1"}) +(self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( +self, "stop here", lldb.SBFileSpec("main.cpp", False) +) + +# The reference should display the same was as the value d
[Lldb-commits] [lldb] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests (PR #146740)
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/146740 This patch moves all the data-formatter tests that were only run for libc++ to the generic directory. There's nothing libc++ specific about these tests. For aynthing tied to libcxx we can have a dedicated subdirectory. But for now lets move as much into `generic` as possible. This involved renaming a bunch of files and passing the `USE_LIBCPP` and `USE_LIBSTDCPP` Makefile variables from within the python test-cases instead of the Makefiles. This is how the existing `generic` tests already worked. The only tests I haven't turned into "generic" ones are the ones for `std::string`. Next steps: 1. Move libstdcpp tests into the `generic` directory 2. Move as much of the `std::string` libc++ tests into `generic` >From 80c6190d2f874f7af1b039befe7121577d7741cb Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 2 Jul 2025 15:01:27 +0100 Subject: [PATCH] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests This patch moves all the data-formatter tests that were only run for libc++ to the generic directory. There's nothing libc++ specific about these tests. For aynthing tied to libcxx we can have a dedicated subdirectory. But for now lets move as much into `generic` as possible. This involved renaming a bunch of files and passing the `USE_LIBCPP` and `USE_LIBSTDCPP` Makefile variables from within the python test-cases instead of the Makefiles. This is how the existing `generic` tests already worked. The only tests I haven't turned into "generic" ones are the ones for `std::string`. Next steps: 1. Move libstdcpp tests into the `generic` directory 2. Move as much of the `std::string` libc++ tests into `generic` --- .../{libcxx => generic}/atomic/Makefile | 1 - .../atomic/TestDataFormatterStdAtomic.py} | 18 +++-- .../{libcxx => generic}/atomic/main.cpp | 0 .../{libcxx => generic}/chrono/Makefile | 2 - .../chrono/TestDataFormatterStdChrono.py} | 16 +++- .../{libcxx => generic}/chrono/main.cpp | 0 .../{libcxx => generic}/function/Makefile | 1 - .../function/TestDataFormatterStdFunction.py} | 18 +++-- .../{libcxx => generic}/function/main.cpp | 0 .../initializerlist}/Makefile | 1 - .../TestDataFormatterStdInitializerList.py} | 15 +++- .../initializerlist/main.cpp | 0 .../iterator}/Makefile| 2 - .../iterator/TestDataFormatterIterator.py}| 18 +++-- .../{libcxx => generic}/iterator/main.cpp | 0 .../{libcxx/tuple => generic/map}/Makefile| 1 - .../map/TestDataFormatterMap.py} | 16 +++- .../{libcxx => generic}/map/main.cpp | 0 .../{libcxx/vbool => generic/queue}/Makefile | 3 +- .../queue/TestDataFormatterStdQueue.py} | 16 +++- .../{libcxx => generic}/queue/main.cpp| 0 .../span => generic/ranges/ref_view}/Makefile | 3 - .../TestDataFormatterLibcxxRangesRefView.py | 16 +++- .../TestDataFormatterStdRangesRefView.py | 79 +++ .../ranges/ref_view/main.cpp | 0 .../{libcxx => generic}/shared_ptr/Makefile | 2 - .../TestDataFormatterStdSharedPtr.py} | 17 ++-- .../{libcxx => generic}/shared_ptr/main.cpp | 0 .../ranges/ref_view => generic/span}/Makefile | 3 +- .../span/TestDataFormatterStdSpan.py} | 32 ++-- .../{libcxx => generic}/span/main.cpp | 0 .../{libcxx => generic}/string_view/Makefile | 2 - .../TestDataFormatterStdStringView.py}| 26 -- .../{libcxx => generic}/string_view/main.cpp | 0 .../valarray => generic/tuple}/Makefile | 2 - .../tuple/TestDataFormatterTuple.py} | 16 +++- .../{libcxx => generic}/tuple/main.cpp| 0 .../{libcxx => generic}/unique_ptr/Makefile | 2 - .../unique_ptr/TestDataFormatterUniquePtr.py} | 17 ++-- .../{libcxx => generic}/unique_ptr/main.cpp | 0 .../generic/unordered_map-iterator/Makefile | 3 + ...stDataFormatterStdUnorderedMapIterator.py} | 16 +++- .../unordered_map-iterator/main.cpp | 0 .../generic/valarray/Makefile | 3 + .../valarray/TestDataFormatterStdValarray.py} | 16 +++- .../{libcxx => generic}/valarray/main.cpp | 0 .../{libcxx => generic}/variant/Makefile | 2 - .../variant/TestDataFormatterStdVariant.py} | 16 +++- .../{libcxx => generic}/variant/main.cpp | 0 .../data-formatter-stl/generic/vbool/Makefile | 3 + .../vbool/TestDataFormatterVBool.py} | 16 +++- .../{libcxx => generic}/vbool/main.cpp| 0 .../generic/vector/Makefile | 3 + .../vector/TestDataFormatterVector.py}| 28 +-- .../{libcxx => generic}/vector/main.cpp | 0 .../libcxx/initializerlist/Makefile | 6 -- .../libcxx/iterator/Makefile | 6 -- .../data-formatter-stl/libcxx/map/Makefile| 6 -- .../data-formatter-stl/libcxx/vector/Makefile | 6 --
[Lldb-commits] [lldb] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests (PR #146740)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/146740 >From 8e2f7ff404eaf048179ad43b65d53ef1617cefb9 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 2 Jul 2025 15:01:27 +0100 Subject: [PATCH] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests This patch moves all the data-formatter tests that were only run for libc++ to the generic directory. There's nothing libc++ specific about these tests. For aynthing tied to libcxx we can have a dedicated subdirectory. But for now lets move as much into `generic` as possible. This involved renaming a bunch of files and passing the `USE_LIBCPP` and `USE_LIBSTDCPP` Makefile variables from within the python test-cases instead of the Makefiles. This is how the existing `generic` tests already worked. The only tests I haven't turned into "generic" ones are the ones for `std::string`. Next steps: 1. Move libstdcpp tests into the `generic` directory 2. Move as much of the `std::string` libc++ tests into `generic` --- .../{libcxx => generic}/atomic/Makefile | 1 - .../atomic/TestDataFormatterStdAtomic.py} | 18 +++-- .../{libcxx => generic}/atomic/main.cpp | 0 .../{libcxx => generic}/chrono/Makefile | 2 - .../chrono/TestDataFormatterStdChrono.py} | 16 +++- .../{libcxx => generic}/chrono/main.cpp | 0 .../{libcxx => generic}/function/Makefile | 1 - .../function/TestDataFormatterStdFunction.py} | 18 +++-- .../{libcxx => generic}/function/main.cpp | 0 .../initializerlist}/Makefile | 1 - .../TestDataFormatterStdInitializerList.py} | 16 +++- .../initializerlist/main.cpp | 0 .../iterator}/Makefile| 2 - .../iterator/TestDataFormatterIterator.py}| 18 +++-- .../{libcxx => generic}/iterator/main.cpp | 0 .../{libcxx/tuple => generic/map}/Makefile| 1 - .../map/TestDataFormatterMap.py} | 16 +++- .../{libcxx => generic}/map/main.cpp | 0 .../{libcxx/vbool => generic/queue}/Makefile | 3 +- .../queue/TestDataFormatterStdQueue.py} | 16 +++- .../{libcxx => generic}/queue/main.cpp| 0 .../span => generic/ranges/ref_view}/Makefile | 3 - .../TestDataFormatterLibcxxRangesRefView.py | 16 +++- .../TestDataFormatterStdRangesRefView.py | 79 +++ .../ranges/ref_view/main.cpp | 0 .../{libcxx => generic}/shared_ptr/Makefile | 2 - .../TestDataFormatterStdSharedPtr.py} | 17 ++-- .../{libcxx => generic}/shared_ptr/main.cpp | 0 .../ranges/ref_view => generic/span}/Makefile | 3 +- .../span/TestDataFormatterStdSpan.py} | 32 ++-- .../{libcxx => generic}/span/main.cpp | 0 .../{libcxx => generic}/string_view/Makefile | 2 - .../TestDataFormatterStdStringView.py}| 26 -- .../{libcxx => generic}/string_view/main.cpp | 0 .../valarray => generic/tuple}/Makefile | 2 - .../tuple/TestDataFormatterTuple.py} | 16 +++- .../{libcxx => generic}/tuple/main.cpp| 0 .../{libcxx => generic}/unique_ptr/Makefile | 2 - .../unique_ptr/TestDataFormatterUniquePtr.py} | 17 ++-- .../{libcxx => generic}/unique_ptr/main.cpp | 0 .../generic/unordered_map-iterator/Makefile | 3 + ...stDataFormatterStdUnorderedMapIterator.py} | 16 +++- .../unordered_map-iterator/main.cpp | 0 .../generic/valarray/Makefile | 3 + .../valarray/TestDataFormatterStdValarray.py} | 16 +++- .../{libcxx => generic}/valarray/main.cpp | 0 .../{libcxx => generic}/variant/Makefile | 2 - .../variant/TestDataFormatterStdVariant.py} | 16 +++- .../{libcxx => generic}/variant/main.cpp | 0 .../data-formatter-stl/generic/vbool/Makefile | 3 + .../vbool/TestDataFormatterVBool.py} | 16 +++- .../{libcxx => generic}/vbool/main.cpp| 0 .../generic/vector/Makefile | 3 + .../vector/TestDataFormatterVector.py}| 28 +-- .../{libcxx => generic}/vector/main.cpp | 0 .../libcxx/initializerlist/Makefile | 6 -- .../libcxx/iterator/Makefile | 6 -- .../data-formatter-stl/libcxx/map/Makefile| 6 -- .../data-formatter-stl/libcxx/vector/Makefile | 6 -- 59 files changed, 341 insertions(+), 135 deletions(-) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/atomic/Makefile (82%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/atomic/TestLibCxxAtomic.py => generic/atomic/TestDataFormatterStdAtomic.py} (85%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/atomic/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/chrono/Makefile (82%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/chrono/TestDataFormatterLibcxxChrono.py => generic/chrono/TestDataFormatterStd
[Lldb-commits] [lldb] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests (PR #146740)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/146740 >From 66a4fdb156d493bf994fd5c0050cfd2d7352732d Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 2 Jul 2025 15:01:27 +0100 Subject: [PATCH] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests This patch moves all the data-formatter tests that were only run for libc++ to the generic directory. There's nothing libc++ specific about these tests. For aynthing tied to libcxx we can have a dedicated subdirectory. But for now lets move as much into `generic` as possible. This involved renaming a bunch of files and passing the `USE_LIBCPP` and `USE_LIBSTDCPP` Makefile variables from within the python test-cases instead of the Makefiles. This is how the existing `generic` tests already worked. The only tests I haven't turned into "generic" ones are the ones for `std::string`. Next steps: 1. Move libstdcpp tests into the `generic` directory 2. Move as much of the `std::string` libc++ tests into `generic` --- .../{libcxx => generic}/atomic/Makefile | 1 - .../atomic/TestDataFormatterStdAtomic.py} | 18 +++-- .../{libcxx => generic}/atomic/main.cpp | 0 .../{libcxx => generic}/chrono/Makefile | 2 - .../chrono/TestDataFormatterStdChrono.py} | 16 +++- .../{libcxx => generic}/chrono/main.cpp | 0 .../{libcxx => generic}/function/Makefile | 1 - .../function/TestDataFormatterStdFunction.py} | 18 +++-- .../{libcxx => generic}/function/main.cpp | 0 .../initializerlist}/Makefile | 1 - .../TestDataFormatterStdInitializerList.py} | 16 +++- .../initializerlist/main.cpp | 0 .../iterator}/Makefile| 2 - .../iterator/TestDataFormatterIterator.py}| 18 +++-- .../{libcxx => generic}/iterator/main.cpp | 0 .../{libcxx/tuple => generic/map}/Makefile| 1 - .../map/TestDataFormatterMap.py} | 16 +++- .../{libcxx => generic}/map/main.cpp | 0 .../{libcxx/vbool => generic/queue}/Makefile | 3 +- .../queue/TestDataFormatterStdQueue.py} | 16 +++- .../{libcxx => generic}/queue/main.cpp| 0 .../span => generic/ranges/ref_view}/Makefile | 3 - .../TestDataFormatterLibcxxRangesRefView.py | 16 +++- .../TestDataFormatterStdRangesRefView.py | 79 +++ .../ranges/ref_view/main.cpp | 0 .../set/TestDataFormatterGenericSet.py| 2 +- .../{libcxx => generic}/shared_ptr/Makefile | 2 - .../TestDataFormatterStdSharedPtr.py} | 17 ++-- .../{libcxx => generic}/shared_ptr/main.cpp | 0 .../ranges/ref_view => generic/span}/Makefile | 3 +- .../span/TestDataFormatterStdSpan.py} | 32 ++-- .../{libcxx => generic}/span/main.cpp | 0 .../{libcxx => generic}/string_view/Makefile | 2 - .../TestDataFormatterStdStringView.py}| 26 -- .../{libcxx => generic}/string_view/main.cpp | 0 .../valarray => generic/tuple}/Makefile | 2 - .../tuple/TestDataFormatterTuple.py} | 16 +++- .../{libcxx => generic}/tuple/main.cpp| 0 .../{libcxx => generic}/unique_ptr/Makefile | 2 - .../unique_ptr/TestDataFormatterUniquePtr.py} | 17 ++-- .../{libcxx => generic}/unique_ptr/main.cpp | 0 .../generic/unordered_map-iterator/Makefile | 3 + ...stDataFormatterStdUnorderedMapIterator.py} | 16 +++- .../unordered_map-iterator/main.cpp | 0 .../generic/valarray/Makefile | 3 + .../valarray/TestDataFormatterStdValarray.py} | 16 +++- .../{libcxx => generic}/valarray/main.cpp | 0 .../{libcxx => generic}/variant/Makefile | 2 - .../variant/TestDataFormatterStdVariant.py} | 16 +++- .../{libcxx => generic}/variant/main.cpp | 0 .../data-formatter-stl/generic/vbool/Makefile | 3 + .../vbool/TestDataFormatterVBool.py} | 16 +++- .../{libcxx => generic}/vbool/main.cpp| 0 .../generic/vector/Makefile | 3 + .../vector/TestDataFormatterVector.py}| 28 +-- .../{libcxx => generic}/vector/main.cpp | 0 .../libcxx/initializerlist/Makefile | 6 -- .../libcxx/iterator/Makefile | 6 -- .../data-formatter-stl/libcxx/map/Makefile| 6 -- .../data-formatter-stl/libcxx/vector/Makefile | 6 -- 60 files changed, 342 insertions(+), 136 deletions(-) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/atomic/Makefile (82%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/atomic/TestLibCxxAtomic.py => generic/atomic/TestDataFormatterStdAtomic.py} (85%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/atomic/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/chrono/Makefile (82%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/chrono/TestDataFormatter
[Lldb-commits] [lldb] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests (PR #146740)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions cpp -- lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/initializerlist/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/map/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string_view/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/tuple/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unique_ptr/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/valarray/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/main.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/main.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/main.cpp index 760d2384a..ee77a880a 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/main.cpp +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/main.cpp @@ -6,28 +6,26 @@ struct Child { // This should point to the parent which in turn owns this // child instance. This cycle should not cause LLDB to infinite loop // during printing. - std::atomic parent{nullptr}; + std::atomic parent{nullptr}; }; struct Parent { Child child; }; struct S { -int x = 1; -int y = 2; + int x = 1; + int y = 2; }; -int main () -{ -std::atomic s; -s.store(S()); -std::atomic i; -i.store(5); +int main() { + std::atomic s; + s.store(S()); + std::atomic i; + i.store(5); -Parent p; -// Let the child node know what its parent is. -p.child.parent = &p; + Parent p; + // Let the child node know what its parent is. + p.child.parent = &p; -return 0; // Set break point at this line. + return 0; // Set break point at this line. } - diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/main.cpp index ef7c97470..86ab18fd9 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/main.cpp +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/main.cpp @@ -1,51 +1,43 @@ #include -int foo(int x, int y) { - return x + y - 1; -} +int foo(int x, int y) { return x + y - 1; } struct Bar { - int operator()() { - return 66 ; - } - int add_num(int i) const { return i + 3 ; } - int add_num2(int i) { - std::function add_num2_f = [](int x) { - return x+1; - }; - - return add_num2_f(i); // Set break point at this line. - } -} ; + int operator()() { return 66; } + int add_num(int i) const { return i + 3; } + int add_num2(int i) { +std::function add_num2_f = [](int x) { return x + 1; }; + +return add_num2_f(i); // Set break point at this line. + } +}; int foo2() { - auto f = [](int x) { - return x+1; - }; + auto f = [](int x) { return x + 1; }; - std::function foo2_f = f; + std::function foo2_f = f; - return foo2_f(10); // Set break point at this line. + return foo2_f(10); // Set break point at this line. } -int main (int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { int acc = 42; - std::function f1 = foo; - std::function f2 = [acc,f1] (int x) -> int { -return x+f1(acc,x); + std::function f1 = foo; + std::function f2 = [acc, f1](int x) -> int { +return x + f1(acc, x); }; auto f = [](int x, int y) { return x + y; }; - auto g = [](int x, int y) { return x * y; } ; -
[Lldb-commits] [lldb] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests (PR #146740)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r HEAD~1...HEAD lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterStdRangesRefView.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/set/TestDataFormatterGenericSet.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/TestDataFormatterStdChrono.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/TestDataFormatterStdFunction.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/initializerlist/TestDataFormatterStdInitializerList.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/TestDataFormatterIterator.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/map/TestDataFormatterMap.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/TestDataFormatterStdQueue.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterLibcxxRangesRefView.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/TestDataFormatterStdSharedPtr.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/TestDataFormatterStdSpan.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string_view/TestDataFormatterStdStringView.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/tuple/TestDataFormatterTuple.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unique_ptr/TestDataFormatterUniquePtr.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/unordered_map-iterator/TestDataFormatterStdUnorderedMapIterator.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/valarray/TestDataFormatterStdValarray.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/variant/TestDataFormatterStdVariant.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vbool/TestDataFormatterVBool.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/vector/TestDataFormatterVector.py `` View the diff from darker here. ``diff --- atomic/TestDataFormatterStdAtomic.py2025-07-02 16:15:56.00 + +++ atomic/TestDataFormatterStdAtomic.py2025-07-02 16:18:53.181837 + @@ -65,12 +65,12 @@ "frame var p.child.parent", substrs=["p.child.parent = {\n Value = 0x"] ) @add_test_categories(["libc++"]) def test_libcxx(self): -self.build(dictionary={"USE_LIBCPP" : 1}) +self.build(dictionary={"USE_LIBCPP": 1}) self.do_test() @add_test_categories(["libstdcxx"]) def test_libstdcxx(self): -self.build(dictionary={"USE_LIBSTDCPP" : 1}) +self.build(dictionary={"USE_LIBSTDCPP": 1}) self.do_test() --- chrono/TestDataFormatterStdChrono.py2025-07-02 16:15:56.00 + +++ chrono/TestDataFormatterStdChrono.py2025-07-02 16:18:53.306122 + @@ -432,12 +432,12 @@ ], ) @add_test_categories(["libc++"]) def test_libcxx(self): -self.build(dictionary={"USE_LIBCPP" : 1}) +self.build(dictionary={"USE_LIBCPP": 1}) self.do_test() @add_test_categories(["libstdcxx"]) def test_libstdcxx(self): -self.build(dictionary={"USE_LIBSTDCPP" : 1}) +self.build(dictionary={"USE_LIBSTDCPP": 1}) self.do_test() --- function/TestDataFormatterStdFunction.py2025-07-02 16:15:56.00 + +++ function/TestDataFormatterStdFunction.py2025-07-02 16:18:53.335679 + @@ -81,12 +81,12 @@ "frame variable f5", substrs=["f5 = Function = Bar::add_num(int) const"] ) @add_test_categories(["libc++"]) def test_libcxx(self): -self.build(dictionary={"USE_LIBCPP" : 1}) +self.build(dictionary={"USE_LIBCPP": 1}) self.do_test() @add_test_categories(["libstdcxx"]) def test_libstdcxx(self): -self.build(dictionary={"USE_LIBSTDCPP" : 1}) +self.build(dictionary={"USE_LIBSTDCPP": 1}) self.do_test() --- initializerlist/TestDataFormatterStdInitializerList.py 2025-07-02 16:15:56.00 + +++ initializerlist/TestDataFormatterStdInitializerList.py 2025-07-02 16:18:53.353665 + @@ -38,12 +38,12 @@ substrs=['[4] = "surprise it is a long string!! yay!!"'], ) @add_test_categories(["libc++"]) def test_libcxx(self): -self.build(dictionary={"USE_LIBCPP" : 1}) +self.build(dictio
[Lldb-commits] [lldb] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests (PR #146740)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/146740 >From 66a4fdb156d493bf994fd5c0050cfd2d7352732d Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 2 Jul 2025 15:01:27 +0100 Subject: [PATCH 1/3] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests This patch moves all the data-formatter tests that were only run for libc++ to the generic directory. There's nothing libc++ specific about these tests. For aynthing tied to libcxx we can have a dedicated subdirectory. But for now lets move as much into `generic` as possible. This involved renaming a bunch of files and passing the `USE_LIBCPP` and `USE_LIBSTDCPP` Makefile variables from within the python test-cases instead of the Makefiles. This is how the existing `generic` tests already worked. The only tests I haven't turned into "generic" ones are the ones for `std::string`. Next steps: 1. Move libstdcpp tests into the `generic` directory 2. Move as much of the `std::string` libc++ tests into `generic` --- .../{libcxx => generic}/atomic/Makefile | 1 - .../atomic/TestDataFormatterStdAtomic.py} | 18 +++-- .../{libcxx => generic}/atomic/main.cpp | 0 .../{libcxx => generic}/chrono/Makefile | 2 - .../chrono/TestDataFormatterStdChrono.py} | 16 +++- .../{libcxx => generic}/chrono/main.cpp | 0 .../{libcxx => generic}/function/Makefile | 1 - .../function/TestDataFormatterStdFunction.py} | 18 +++-- .../{libcxx => generic}/function/main.cpp | 0 .../initializerlist}/Makefile | 1 - .../TestDataFormatterStdInitializerList.py} | 16 +++- .../initializerlist/main.cpp | 0 .../iterator}/Makefile| 2 - .../iterator/TestDataFormatterIterator.py}| 18 +++-- .../{libcxx => generic}/iterator/main.cpp | 0 .../{libcxx/tuple => generic/map}/Makefile| 1 - .../map/TestDataFormatterMap.py} | 16 +++- .../{libcxx => generic}/map/main.cpp | 0 .../{libcxx/vbool => generic/queue}/Makefile | 3 +- .../queue/TestDataFormatterStdQueue.py} | 16 +++- .../{libcxx => generic}/queue/main.cpp| 0 .../span => generic/ranges/ref_view}/Makefile | 3 - .../TestDataFormatterLibcxxRangesRefView.py | 16 +++- .../TestDataFormatterStdRangesRefView.py | 79 +++ .../ranges/ref_view/main.cpp | 0 .../set/TestDataFormatterGenericSet.py| 2 +- .../{libcxx => generic}/shared_ptr/Makefile | 2 - .../TestDataFormatterStdSharedPtr.py} | 17 ++-- .../{libcxx => generic}/shared_ptr/main.cpp | 0 .../ranges/ref_view => generic/span}/Makefile | 3 +- .../span/TestDataFormatterStdSpan.py} | 32 ++-- .../{libcxx => generic}/span/main.cpp | 0 .../{libcxx => generic}/string_view/Makefile | 2 - .../TestDataFormatterStdStringView.py}| 26 -- .../{libcxx => generic}/string_view/main.cpp | 0 .../valarray => generic/tuple}/Makefile | 2 - .../tuple/TestDataFormatterTuple.py} | 16 +++- .../{libcxx => generic}/tuple/main.cpp| 0 .../{libcxx => generic}/unique_ptr/Makefile | 2 - .../unique_ptr/TestDataFormatterUniquePtr.py} | 17 ++-- .../{libcxx => generic}/unique_ptr/main.cpp | 0 .../generic/unordered_map-iterator/Makefile | 3 + ...stDataFormatterStdUnorderedMapIterator.py} | 16 +++- .../unordered_map-iterator/main.cpp | 0 .../generic/valarray/Makefile | 3 + .../valarray/TestDataFormatterStdValarray.py} | 16 +++- .../{libcxx => generic}/valarray/main.cpp | 0 .../{libcxx => generic}/variant/Makefile | 2 - .../variant/TestDataFormatterStdVariant.py} | 16 +++- .../{libcxx => generic}/variant/main.cpp | 0 .../data-formatter-stl/generic/vbool/Makefile | 3 + .../vbool/TestDataFormatterVBool.py} | 16 +++- .../{libcxx => generic}/vbool/main.cpp| 0 .../generic/vector/Makefile | 3 + .../vector/TestDataFormatterVector.py}| 28 +-- .../{libcxx => generic}/vector/main.cpp | 0 .../libcxx/initializerlist/Makefile | 6 -- .../libcxx/iterator/Makefile | 6 -- .../data-formatter-stl/libcxx/map/Makefile| 6 -- .../data-formatter-stl/libcxx/vector/Makefile | 6 -- 60 files changed, 342 insertions(+), 136 deletions(-) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/atomic/Makefile (82%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/atomic/TestLibCxxAtomic.py => generic/atomic/TestDataFormatterStdAtomic.py} (85%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/atomic/main.cpp (100%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx => generic}/chrono/Makefile (82%) rename lldb/test/API/functionalities/data-formatter/data-formatter-stl/{libcxx/chrono/TestDataForma
[Lldb-commits] [lldb] [lldb][test] Turn (most) libcxx data-formatters tests into generic tests (PR #146740)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Michael Buch (Michael137) Changes This patch moves all the data-formatter tests that were only run for libc++ to the generic directory. There's nothing libc++ specific about these tests. For aynthing tied to libcxx we can have a dedicated subdirectory. But for now lets move as much into `generic` as possible. This involved renaming a bunch of files and passing the `USE_LIBCPP` and `USE_LIBSTDCPP` Makefile variables from within the python test-cases instead of the Makefiles. This is how the existing `generic` tests already worked. The only tests I haven't turned into "generic" ones are the ones for `std::string`. Next steps: 1. Move libstdcpp tests into the `generic` directory 2. Move as much of the `std::string` libc++ tests into `generic` --- Patch is 61.76 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/146740.diff 59 Files Affected: - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/Makefile (-1) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py (+13-5) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/main.cpp () - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/Makefile (-2) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/TestDataFormatterStdChrono.py (+12-4) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/chrono/main.cpp () - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/Makefile (-1) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/TestDataFormatterStdFunction.py (+13-5) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/function/main.cpp () - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/initializerlist/Makefile (-1) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/initializerlist/TestDataFormatterStdInitializerList.py (+12-3) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/initializerlist/main.cpp () - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/Makefile (-2) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/TestDataFormatterIterator.py (+13-5) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/iterator/main.cpp () - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/map/Makefile (-1) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/map/TestDataFormatterMap.py (+12-4) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/map/main.cpp () - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/Makefile (+1-2) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/TestDataFormatterStdQueue.py (+12-4) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/queue/main.cpp () - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/Makefile (-3) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterLibcxxRangesRefView.py (+12-4) - (added) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/TestDataFormatterStdRangesRefView.py (+79) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/ranges/ref_view/main.cpp () - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/Makefile (-2) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/TestDataFormatterStdSharedPtr.py (+12-5) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/shared_ptr/main.cpp () - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/Makefile (+1-2) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/TestDataFormatterStdSpan.py (+25-7) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/span/main.cpp () - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string_view/Makefile (-2) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string_view/TestDataFormatterStdStringView.py (+18-8) - (renamed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string_view/ma
[Lldb-commits] [lldb] [lldb][RPC] Upstream RPC server interface emitters (PR #138032)
@@ -0,0 +1,15 @@ +# Disabling until the lldb-rpc-gen tool lands. +UNSUPPORTED: system-windows, system-linux, system-darwin chelcassanova wrote: The unsupported can probably be removed actually, these tests still need to test after the tool lands however. https://github.com/llvm/llvm-project/pull/138032 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fc00256 - [lldb][test][NFC] Rename libcxx unordered_map tests to unordered_map-iterator
Author: Michael Buch Date: 2025-07-02T14:36:41+01:00 New Revision: fc00256b2b4d7a5328b775b51240258e0d28701c URL: https://github.com/llvm/llvm-project/commit/fc00256b2b4d7a5328b775b51240258e0d28701c DIFF: https://github.com/llvm/llvm-project/commit/fc00256b2b4d7a5328b775b51240258e0d28701c.diff LOG: [lldb][test][NFC] Rename libcxx unordered_map tests to unordered_map-iterator The actual `unordered_map` tests live in `data-formatter-stl/generic/unordered`. The tests here are only testing `std::unordered_map::iterator`. This patch renames the directory accordingly. This is in preparation for moving all of the STL tests into the `generic` directory. Added: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/Makefile lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/main.cpp Modified: Removed: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/Makefile lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/Makefile b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/Makefile similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/Makefile rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/Makefile diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/TestDataFormatterLibccUnorderedMap.py rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/TestDataFormatterLibccUnorderedMap.py diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/main.cpp similarity index 100% rename from lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map/main.cpp rename to lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered_map-iterator/main.cpp ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Consolidate generic and libcxx std::deque formatter tests (PR #146697)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Michael Buch (Michael137) Changes The plan is to move all STL formatter API tests into a single directory. The `std::deque` test is currently the only test that is duplicated between the `libcxx` and `generic` directories. This patch moves the libcxx deque tests into `generic` (moving over any functionality that wasn't tested in the `generic` tests, mainly formatting pointers/references to `std::deque`). --- Full diff: https://github.com/llvm/llvm-project/pull/146697.diff 5 Files Affected: - (modified) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py (+75-1) - (modified) lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/main.cpp (+24-1) - (removed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/Makefile (-4) - (removed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/TestDataFormatterLibcxxDeque.py (-87) - (removed) lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/main.cpp (-30) ``diff diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py index abe2a2b7895de..cf6b339a111c1 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py @@ -21,9 +21,44 @@ def check_size(self, var_name, size): var = self.findVariable(var_name) self.assertEqual(var.GetNumChildren(), size) +def check_numbers(self, var_name, show_ptr=False): +patterns = [] +substrs = [ +"[0] = 1", +"[1] = 12", +"[2] = 123", +"[3] = 1234", +"[4] = 12345", +"[5] = 123456", +"[6] = 1234567", +"}", +] +if show_ptr: +patterns = [var_name + " = 0x.* size=7"] +else: +substrs.insert(0, var_name + " = size=7") +self.expect( +"frame variable " + var_name, +patterns=patterns, +substrs=substrs, +) +self.expect_expr( +var_name, +result_summary="size=7", +result_children=[ +ValueCheck(value="1"), +ValueCheck(value="12"), +ValueCheck(value="123"), +ValueCheck(value="1234"), +ValueCheck(value="12345"), +ValueCheck(value="123456"), +ValueCheck(value="1234567"), +], +) + def do_test(self, stdlib_type): self.build(dictionary={stdlib_type: "1"}) -lldbutil.run_to_source_breakpoint( +(_, process, _, bkpt) = lldbutil.run_to_source_breakpoint( self, "break here", lldb.SBFileSpec("main.cpp") ) @@ -83,6 +118,23 @@ def do_test(self, stdlib_type): ], ) +lldbutil.continue_to_breakpoint(process, bkpt) + +# first value added +self.expect( +"frame variable empty", substrs=["empty = size=1", "[0] = 1", "}"] +) + +# add remaining values +lldbutil.continue_to_breakpoint(process, bkpt) + +self.check_numbers("empty") + +# clear out the deque +lldbutil.continue_to_breakpoint(process, bkpt) + +self.expect_expr("empty", result_children=[]) + @add_test_categories(["libstdcxx"]) def test_libstdcpp(self): self.do_test(USE_LIBSTDCPP) @@ -90,3 +142,25 @@ def test_libstdcpp(self): @add_test_categories(["libc++"]) def test_libcpp(self): self.do_test(USE_LIBCPP) + +def do_test_ref_and_ptr(self, stdlib_type: str): +"""Test formatting of std::deque& and std::deque*""" +self.build(dictionary={stdlib_type: "1"}) +(self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( +self, "stop here", lldb.SBFileSpec("main.cpp", False) +) + +# The reference should display the same was as the value did +self.check_numbers("ref", True) + +# The pointer should just show the right number of elements: +self.expect("frame variable ptr", substrs=["ptr =", " size=7"]) +self.expect("expression ptr", substrs=["$", "size=7"]) + +@add_test_categories(["libstdcxx"]) +def test_libstdcpp_ref_and_ptr(self): +self.do_test_ref_and_ptr(USE_LIBSTDCPP) + +@add_test_categories(["libc++"]) +def test_libcpp_ref_and_ptr(self): +self.do_test_ref_and_ptr(USE_LIBCPP) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/main.c
[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)
@@ -0,0 +1,120 @@ +# coding=utf8 +""" +Test std::*string summaries with MSVC's STL. +""" Michael137 wrote: https://github.com/llvm/llvm-project/pull/146740 https://github.com/llvm/llvm-project/pull/143177 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Adding pipe support to lldb_private::MainLoopWindows. (PR #145621)
ashgti wrote: I'll update my PR to add `#include ` https://github.com/llvm/llvm-project/pull/145621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixing warnings / win32 builds in MainLoop. (PR #146632)
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/146632 >From 3e0129934a74f9300a7d386797b63304a02b855f Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 1 Jul 2025 20:55:32 -0700 Subject: [PATCH 1/3] [lldb] Fixing warnings / win32 builds in MainLoop. Commit 1a7b7e24bcc1041ae0fb90abcfb73d36d76f4a07 introduced a few casting warnings and a build issue in Win32 platforms. Trying to correct the casts to c++ style casts instead of C style casts. --- .../lldb/Host/windows/MainLoopWindows.h | 8 ++-- lldb/include/lldb/lldb-types.h| 12 +++-- lldb/source/Host/common/JSONTransport.cpp | 3 +- .../posix/ConnectionFileDescriptorPosix.cpp | 10 ++-- lldb/source/Host/windows/MainLoopWindows.cpp | 48 +++ lldb/source/Utility/SelectHelper.cpp | 2 +- 6 files changed, 49 insertions(+), 34 deletions(-) diff --git a/lldb/include/lldb/Host/windows/MainLoopWindows.h b/lldb/include/lldb/Host/windows/MainLoopWindows.h index 53df815255c3d..705e7e78ba48a 100644 --- a/lldb/include/lldb/Host/windows/MainLoopWindows.h +++ b/lldb/include/lldb/Host/windows/MainLoopWindows.h @@ -17,6 +17,8 @@ namespace lldb_private { +using handle_t = void *; + // Windows-specific implementation of the MainLoopBase class. It can monitor // socket descriptors for readability using WSAEventSelect. Non-socket file // descriptors are not supported. @@ -33,15 +35,15 @@ class MainLoopWindows : public MainLoopBase { class IOEvent { public: -IOEvent(IOObject::WaitableHandle event) : m_event(event) {} +IOEvent(handle_t event) : m_event(event) {} virtual ~IOEvent() {} virtual void WillPoll() {} virtual void DidPoll() {} virtual void Disarm() {} -IOObject::WaitableHandle GetHandle() { return m_event; } +handle_t GetHandle() { return m_event; } protected: -IOObject::WaitableHandle m_event; +handle_t m_event; }; using IOEventUP = std::unique_ptr; diff --git a/lldb/include/lldb/lldb-types.h b/lldb/include/lldb/lldb-types.h index 15781ad626efb..cef43892c8efa 100644 --- a/lldb/include/lldb/lldb-types.h +++ b/lldb/include/lldb/lldb-types.h @@ -42,12 +42,15 @@ typedef void *rwlock_t; typedef void *process_t; // Process type is HANDLE typedef void *thread_t; // Host thread type typedef void *file_t; // Host file type -typedef unsigned int __w64 socket_t; // Host socket type +typedef uintptr_t socket_t; // Host socket type typedef void *thread_arg_t; // Host thread argument type typedef unsigned thread_result_t; // Host thread result type typedef thread_result_t (*thread_func_t)(void *); // Host thread function type typedef void *pipe_t; // Host pipe type is HANDLE +// printf macro for file_t +#define PRIuFT PRIuPTR + #else #include @@ -63,11 +66,14 @@ typedef void *thread_result_t; // Host thread result type typedef void *(*thread_func_t)(void *); // Host thread function type typedef int pipe_t; // Host pipe type +// printf macro for file_t +#define PRIuFT PRIi32 + #endif // _WIN32 -#define LLDB_INVALID_PROCESS ((lldb::process_t)-1) +#define LLDB_INVALID_PROCESS ((lldb::process_t) - 1) #define LLDB_INVALID_HOST_THREAD ((lldb::thread_t)NULL) -#define LLDB_INVALID_PIPE ((lldb::pipe_t)-1) +#define LLDB_INVALID_PIPE ((lldb::pipe_t) - 1) #define LLDB_INVALID_CALLBACK_TOKEN ((lldb::callback_token_t) - 1) typedef void (*LogOutputCallback)(const char *, void *baton); diff --git a/lldb/source/Host/common/JSONTransport.cpp b/lldb/source/Host/common/JSONTransport.cpp index bf269ffa45966..546c12c8f7114 100644 --- a/lldb/source/Host/common/JSONTransport.cpp +++ b/lldb/source/Host/common/JSONTransport.cpp @@ -42,7 +42,8 @@ ReadFull(IOObject &descriptor, size_t length, if (timeout && timeout_supported) { SelectHelper sh; sh.SetTimeout(*timeout); -sh.FDSetRead((lldb::socket_t)descriptor.GetWaitableHandle()); +sh.FDSetRead( +reinterpret_cast(descriptor.GetWaitableHandle())); Status status = sh.Select(); if (status.Fail()) { // Convert timeouts into a specific error. diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index 44a3ed2e59d5f..83eb0c56853b3 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -273,10 +273,10 @@ size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len, if (log) { LLDB_LOGF(log, - "%p ConnectionFileDescriptor::Read() fd = %" PRIu64 + "%p ConnectionFileDescriptor::Read() fd = %" PRIuFT ", dst = %p, dst_len = %" PRIu64 ") => %" PRIu64 ", error = %s", static_cast(this), - st
[Lldb-commits] [lldb] [lldb] Add DWARFExpressionEntry and GetExpressionEntryAtAddress() to … (PR #144238)
https://github.com/UltimateForce21 updated https://github.com/llvm/llvm-project/pull/144238 >From 8ed8c540e7600d720a63bc2882a81a2c65c11d41 Mon Sep 17 00:00:00 2001 From: ultimateforce21 Date: Wed, 11 Jun 2025 00:11:09 -0400 Subject: [PATCH 01/10] [lldb] Add DWARFExpressionEntry and GetExpressionEntryAtAddress() to DWARFExpressionList This introduces a new API for retrieving DWARF expression metadata associated with variable location entries at a given PC address. It provides the base, end, and expression pointer for downstream consumers such as disassembler annotations. Intended for use in richer instruction annotations in Instruction::Dump(). --- .../lldb/Expression/DWARFExpressionList.h | 12 +++ .../source/Expression/DWARFExpressionList.cpp | 21 +++ 2 files changed, 33 insertions(+) diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h b/lldb/include/lldb/Expression/DWARFExpressionList.h index d8f8ec247ed56..a329b37393018 100644 --- a/lldb/include/lldb/Expression/DWARFExpressionList.h +++ b/lldb/include/lldb/Expression/DWARFExpressionList.h @@ -59,6 +59,18 @@ class DWARFExpressionList { lldb::addr_t GetFuncFileAddress() { return m_func_file_addr; } + /// Represents an entry in the DWARFExpressionList with all needed metadata + struct DWARFExpressionEntry { +lldb::addr_t base; +lldb::addr_t end; +const DWARFExpression *expr; + }; + + /// Returns the entry (base, end, data) for a given PC address + llvm::Expected + GetExpressionEntryAtAddress(lldb::addr_t func_load_addr, + lldb::addr_t load_addr) const; + const DWARFExpression *GetExpressionAtAddress(lldb::addr_t func_load_addr, lldb::addr_t load_addr) const; diff --git a/lldb/source/Expression/DWARFExpressionList.cpp b/lldb/source/Expression/DWARFExpressionList.cpp index 04592a1eb7ff4..b55bc7120c4af 100644 --- a/lldb/source/Expression/DWARFExpressionList.cpp +++ b/lldb/source/Expression/DWARFExpressionList.cpp @@ -53,6 +53,27 @@ bool DWARFExpressionList::ContainsAddress(lldb::addr_t func_load_addr, return GetExpressionAtAddress(func_load_addr, addr) != nullptr; } +llvm::Expected +DWARFExpressionList::GetExpressionEntryAtAddress(lldb::addr_t func_load_addr, + lldb::addr_t load_addr) const { + if (const DWARFExpression *expr = GetAlwaysValidExpr()) { +return DWARFExpressionEntry{0, LLDB_INVALID_ADDRESS, expr}; + } + + if (func_load_addr == LLDB_INVALID_ADDRESS) +func_load_addr = m_func_file_addr; + + addr_t addr = load_addr - func_load_addr + m_func_file_addr; + uint32_t index = m_exprs.FindEntryIndexThatContains(addr); + if (index == UINT32_MAX) { +return llvm::createStringError(llvm::inconvertibleErrorCode(), + "No DWARF expression found for address 0x%llx", addr); + } + + const Entry &entry = *m_exprs.GetEntryAtIndex(index); + return DWARFExpressionEntry{entry.base, entry.GetRangeEnd(), &entry.data}; +} + const DWARFExpression * DWARFExpressionList::GetExpressionAtAddress(lldb::addr_t func_load_addr, lldb::addr_t load_addr) const { >From 1db5002a69dba4f88aaac56d61520b7b4b214b01 Mon Sep 17 00:00:00 2001 From: Abdullah Mohammad Amin <67847674+ultimateforc...@users.noreply.github.com> Date: Thu, 19 Jun 2025 11:55:35 -0400 Subject: [PATCH 02/10] Update lldb/include/lldb/Expression/DWARFExpressionList.h Co-authored-by: Jonas Devlieghere --- lldb/include/lldb/Expression/DWARFExpressionList.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h b/lldb/include/lldb/Expression/DWARFExpressionList.h index a329b37393018..89e55ffc07659 100644 --- a/lldb/include/lldb/Expression/DWARFExpressionList.h +++ b/lldb/include/lldb/Expression/DWARFExpressionList.h @@ -59,7 +59,7 @@ class DWARFExpressionList { lldb::addr_t GetFuncFileAddress() { return m_func_file_addr; } - /// Represents an entry in the DWARFExpressionList with all needed metadata + /// Represents an entry in the DWARFExpressionList with all needed metadata. struct DWARFExpressionEntry { lldb::addr_t base; lldb::addr_t end; >From a26010b06e5067b8b3b223cbd76e8848ecb9a289 Mon Sep 17 00:00:00 2001 From: Abdullah Mohammad Amin <67847674+ultimateforc...@users.noreply.github.com> Date: Thu, 19 Jun 2025 11:58:28 -0400 Subject: [PATCH 03/10] Update lldb/include/lldb/Expression/DWARFExpressionList.h Updated comment for GetExpressionEntryAtAddress to directly refer to struct DWARFExpressionEntry Co-authored-by: Jonas Devlieghere --- lldb/include/lldb/Expression/DWARFExpressionList.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h b/lldb/include/lldb/Expression/DWARFExpressionList.h index 89e55ffc07659..f6a269809decc 100644 --- a/lld
[Lldb-commits] [lldb] [lldb][mcp] Fix unix domain socket protocol server addresses (PR #146603)
https://github.com/JDevlieghere approved this pull request. https://github.com/llvm/llvm-project/pull/146603 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use correct size when dumping DWARF64 DW_FORM_ref_addr (PR #146686)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: David Spickett (DavidSpickett) Changes Not that we ever do that, because this is unused code, but if someone was debugging lldb I guess they'd call this. Was missed in https://github.com/llvm/llvm-project/pull/145645 Relates to https://github.com/llvm/llvm-project/issues/135208 --- Full diff: https://github.com/llvm/llvm-project/pull/146686.diff 1 Files Affected: - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (+1-2) ``diff diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index 2e98e3c33acaf..40e2a9669e258 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -420,8 +420,7 @@ void DWARFFormValue::Dump(Stream &s) const { DumpAddress(s.AsRawOstream(), uvalue, sizeof(uint64_t) * 2); else DumpAddress(s.AsRawOstream(), uvalue, - 4 * 2); // 4 for DWARF32, 8 for DWARF64, but we don't - // support DWARF64 yet + m_unit->GetFormParams().getRefAddrByteSize()); break; } case DW_FORM_ref1: `` https://github.com/llvm/llvm-project/pull/146686 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use correct size when dumping DWARF64 DW_FORM_ref_addr (PR #146686)
https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/146686 Not that we ever do that, because this is unused code, but if someone was debugging lldb I guess they'd call this. Was missed in https://github.com/llvm/llvm-project/pull/145645 Relates to https://github.com/llvm/llvm-project/issues/135208 >From 3d19a8f5069e0741a2605829adc291cf6c673eeb Mon Sep 17 00:00:00 2001 From: David Spickett Date: Wed, 2 Jul 2025 13:06:09 + Subject: [PATCH] [lldb] Use correct size when dumping DWARF64 DW_FORM_ref_addr Not that we ever do that, because this is unused code, but if someone was debugging lldb I guess they'd call this. Was missed in https://github.com/llvm/llvm-project/pull/145645 Relates to https://github.com/llvm/llvm-project/issues/135208 --- lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index 2e98e3c33acaf..40e2a9669e258 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -420,8 +420,7 @@ void DWARFFormValue::Dump(Stream &s) const { DumpAddress(s.AsRawOstream(), uvalue, sizeof(uint64_t) * 2); else DumpAddress(s.AsRawOstream(), uvalue, - 4 * 2); // 4 for DWARF32, 8 for DWARF64, but we don't - // support DWARF64 yet + m_unit->GetFormParams().getRefAddrByteSize()); break; } case DW_FORM_ref1: ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Consolidate generic and libcxx std::deque formatter tests (PR #146697)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/146697 >From 168f2c960757ad0203391724836d021b8bf89b5b Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Wed, 2 Jul 2025 14:51:04 +0100 Subject: [PATCH 1/2] [lldb][test] Consolidate generic and libcxx std::deque formatter tests The plan is to move all STL formatter API tests into a single directory. The `std::deque` test is currently the only test that is duplicated between the `libcxx` and `generic` directories. This patch moves the libcxx deque tests into `generic` (moving over any functionality that wasn't tested in the `generic` tests, mainly formatting pointers/references to `std::deque`). --- .../deque/TestDataFormatterGenericDeque.py| 76 +++- .../data-formatter-stl/generic/deque/main.cpp | 25 +- .../data-formatter-stl/libcxx/deque/Makefile | 4 - .../deque/TestDataFormatterLibcxxDeque.py | 87 --- .../data-formatter-stl/libcxx/deque/main.cpp | 30 --- 5 files changed, 99 insertions(+), 123 deletions(-) delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/Makefile delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/TestDataFormatterLibcxxDeque.py delete mode 100644 lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/main.cpp diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py index abe2a2b7895de..cf6b339a111c1 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/deque/TestDataFormatterGenericDeque.py @@ -21,9 +21,44 @@ def check_size(self, var_name, size): var = self.findVariable(var_name) self.assertEqual(var.GetNumChildren(), size) +def check_numbers(self, var_name, show_ptr=False): +patterns = [] +substrs = [ +"[0] = 1", +"[1] = 12", +"[2] = 123", +"[3] = 1234", +"[4] = 12345", +"[5] = 123456", +"[6] = 1234567", +"}", +] +if show_ptr: +patterns = [var_name + " = 0x.* size=7"] +else: +substrs.insert(0, var_name + " = size=7") +self.expect( +"frame variable " + var_name, +patterns=patterns, +substrs=substrs, +) +self.expect_expr( +var_name, +result_summary="size=7", +result_children=[ +ValueCheck(value="1"), +ValueCheck(value="12"), +ValueCheck(value="123"), +ValueCheck(value="1234"), +ValueCheck(value="12345"), +ValueCheck(value="123456"), +ValueCheck(value="1234567"), +], +) + def do_test(self, stdlib_type): self.build(dictionary={stdlib_type: "1"}) -lldbutil.run_to_source_breakpoint( +(_, process, _, bkpt) = lldbutil.run_to_source_breakpoint( self, "break here", lldb.SBFileSpec("main.cpp") ) @@ -83,6 +118,23 @@ def do_test(self, stdlib_type): ], ) +lldbutil.continue_to_breakpoint(process, bkpt) + +# first value added +self.expect( +"frame variable empty", substrs=["empty = size=1", "[0] = 1", "}"] +) + +# add remaining values +lldbutil.continue_to_breakpoint(process, bkpt) + +self.check_numbers("empty") + +# clear out the deque +lldbutil.continue_to_breakpoint(process, bkpt) + +self.expect_expr("empty", result_children=[]) + @add_test_categories(["libstdcxx"]) def test_libstdcpp(self): self.do_test(USE_LIBSTDCPP) @@ -90,3 +142,25 @@ def test_libstdcpp(self): @add_test_categories(["libc++"]) def test_libcpp(self): self.do_test(USE_LIBCPP) + +def do_test_ref_and_ptr(self, stdlib_type: str): +"""Test formatting of std::deque& and std::deque*""" +self.build(dictionary={stdlib_type: "1"}) +(self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( +self, "stop here", lldb.SBFileSpec("main.cpp", False) +) + +# The reference should display the same was as the value did +self.check_numbers("ref", True) + +# The pointer should just show the right number of elements: +self.expect("frame variable ptr", substrs=["ptr =", " size=7"]) +self.expect("expression ptr", substrs=["$", "size=7"]) + +@add_test_categories(["libstdcxx"]) +def test_libstdcpp_ref_and_ptr(self): +self.do_test_ref_and_ptr(US
[Lldb-commits] [lldb] [lldb] Fixing warnings / win32 builds in MainLoop. (PR #146632)
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/146632 >From 3e0129934a74f9300a7d386797b63304a02b855f Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 1 Jul 2025 20:55:32 -0700 Subject: [PATCH 1/2] [lldb] Fixing warnings / win32 builds in MainLoop. Commit 1a7b7e24bcc1041ae0fb90abcfb73d36d76f4a07 introduced a few casting warnings and a build issue in Win32 platforms. Trying to correct the casts to c++ style casts instead of C style casts. --- .../lldb/Host/windows/MainLoopWindows.h | 8 ++-- lldb/include/lldb/lldb-types.h| 12 +++-- lldb/source/Host/common/JSONTransport.cpp | 3 +- .../posix/ConnectionFileDescriptorPosix.cpp | 10 ++-- lldb/source/Host/windows/MainLoopWindows.cpp | 48 +++ lldb/source/Utility/SelectHelper.cpp | 2 +- 6 files changed, 49 insertions(+), 34 deletions(-) diff --git a/lldb/include/lldb/Host/windows/MainLoopWindows.h b/lldb/include/lldb/Host/windows/MainLoopWindows.h index 53df815255c3d..705e7e78ba48a 100644 --- a/lldb/include/lldb/Host/windows/MainLoopWindows.h +++ b/lldb/include/lldb/Host/windows/MainLoopWindows.h @@ -17,6 +17,8 @@ namespace lldb_private { +using handle_t = void *; + // Windows-specific implementation of the MainLoopBase class. It can monitor // socket descriptors for readability using WSAEventSelect. Non-socket file // descriptors are not supported. @@ -33,15 +35,15 @@ class MainLoopWindows : public MainLoopBase { class IOEvent { public: -IOEvent(IOObject::WaitableHandle event) : m_event(event) {} +IOEvent(handle_t event) : m_event(event) {} virtual ~IOEvent() {} virtual void WillPoll() {} virtual void DidPoll() {} virtual void Disarm() {} -IOObject::WaitableHandle GetHandle() { return m_event; } +handle_t GetHandle() { return m_event; } protected: -IOObject::WaitableHandle m_event; +handle_t m_event; }; using IOEventUP = std::unique_ptr; diff --git a/lldb/include/lldb/lldb-types.h b/lldb/include/lldb/lldb-types.h index 15781ad626efb..cef43892c8efa 100644 --- a/lldb/include/lldb/lldb-types.h +++ b/lldb/include/lldb/lldb-types.h @@ -42,12 +42,15 @@ typedef void *rwlock_t; typedef void *process_t; // Process type is HANDLE typedef void *thread_t; // Host thread type typedef void *file_t; // Host file type -typedef unsigned int __w64 socket_t; // Host socket type +typedef uintptr_t socket_t; // Host socket type typedef void *thread_arg_t; // Host thread argument type typedef unsigned thread_result_t; // Host thread result type typedef thread_result_t (*thread_func_t)(void *); // Host thread function type typedef void *pipe_t; // Host pipe type is HANDLE +// printf macro for file_t +#define PRIuFT PRIuPTR + #else #include @@ -63,11 +66,14 @@ typedef void *thread_result_t; // Host thread result type typedef void *(*thread_func_t)(void *); // Host thread function type typedef int pipe_t; // Host pipe type +// printf macro for file_t +#define PRIuFT PRIi32 + #endif // _WIN32 -#define LLDB_INVALID_PROCESS ((lldb::process_t)-1) +#define LLDB_INVALID_PROCESS ((lldb::process_t) - 1) #define LLDB_INVALID_HOST_THREAD ((lldb::thread_t)NULL) -#define LLDB_INVALID_PIPE ((lldb::pipe_t)-1) +#define LLDB_INVALID_PIPE ((lldb::pipe_t) - 1) #define LLDB_INVALID_CALLBACK_TOKEN ((lldb::callback_token_t) - 1) typedef void (*LogOutputCallback)(const char *, void *baton); diff --git a/lldb/source/Host/common/JSONTransport.cpp b/lldb/source/Host/common/JSONTransport.cpp index bf269ffa45966..546c12c8f7114 100644 --- a/lldb/source/Host/common/JSONTransport.cpp +++ b/lldb/source/Host/common/JSONTransport.cpp @@ -42,7 +42,8 @@ ReadFull(IOObject &descriptor, size_t length, if (timeout && timeout_supported) { SelectHelper sh; sh.SetTimeout(*timeout); -sh.FDSetRead((lldb::socket_t)descriptor.GetWaitableHandle()); +sh.FDSetRead( +reinterpret_cast(descriptor.GetWaitableHandle())); Status status = sh.Select(); if (status.Fail()) { // Convert timeouts into a specific error. diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index 44a3ed2e59d5f..83eb0c56853b3 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -273,10 +273,10 @@ size_t ConnectionFileDescriptor::Read(void *dst, size_t dst_len, if (log) { LLDB_LOGF(log, - "%p ConnectionFileDescriptor::Read() fd = %" PRIu64 + "%p ConnectionFileDescriptor::Read() fd = %" PRIuFT ", dst = %p, dst_len = %" PRIu64 ") => %" PRIu64 ", error = %s", static_cast(this), - st
[Lldb-commits] [lldb] [lldb] Add SB API to make a breakpoint a hardware breakpoint (PR #146602)
jimingham wrote: It would be good to test the response to enabling a HW breakpoint or trying to set it to HW when you've exhausted the number of HW breakpoint resources. For some reason we have SBProcess::GetNumSupportedHardwareWatchpoints but not SBProcess::GetNumSupportedHardwareBreakpoints. But you could just keep setting HW breakpoints till you get an error. https://github.com/llvm/llvm-project/pull/146602 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Commands][NFC] image lookup: remove unused local variable (PR #146554)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/146554 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lld] [lldb] [llvm] [AArch64] Support TLS variables in debug info (PR #146572)
xgupta wrote: Thanks, we can wait for the ABI change. https://github.com/llvm/llvm-project/pull/146572 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lld] [lldb] [llvm] [AArch64] Support TLS variables in debug info (PR #146572)
@@ -0,0 +1,37 @@ +; RUN: llc -O0 -mtriple=aarch64-linux-gnu -filetype=obj < %s \ +; RUN: | llvm-objdump -r - | FileCheck %s DavidSpickett wrote: indent the second line a bit so it's clear it's a continuation: ``` ; RUN: | llvm... ``` https://github.com/llvm/llvm-project/pull/146572 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lld] [lldb] [llvm] [AArch64] Support TLS variables in debug info (PR #146572)
@@ -1,8 +1,14 @@ -; RUN: llc -filetype=obj -mtriple=aarch64--linux-gnu -o - %s | llvm-dwarfdump -v - | FileCheck %s -; +; RUN: llc -O0 -mtriple=aarch64-non-linux-gnu -filetype=obj < %s \ +; RUN: | llvm-dwarfdump - | FileCheck %s DavidSpickett wrote: indent the continuation https://github.com/llvm/llvm-project/pull/146572 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lld] [lldb] [llvm] [AArch64] Support TLS variables in debug info (PR #146572)
@@ -30,7 +30,7 @@ void AArch64_ELFTargetObjectFile::Initialize(MCContext &Ctx, // AARCH64 ELF ABI does not define static relocation type for TLS offset // within a module. Do not generate AT_location for TLS variables. DavidSpickett wrote: This comment should be removed. https://github.com/llvm/llvm-project/pull/146572 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lld] [lldb] [llvm] [AArch64] Support TLS variables in debug info (PR #146572)
@@ -0,0 +1,37 @@ +; RUN: llc -O0 -mtriple=aarch64-linux-gnu -filetype=obj < %s \ +; RUN: | llvm-objdump -r - | FileCheck %s + +; CHECK: R_AARCH64_TLS_DTPREL64 DavidSpickett wrote: What does the full output look like? Because this check looks a bit non-specific. I know it's basically "do we produce this at all" but is there anything else we can check to make sure it is in fact for "var" not something else? https://github.com/llvm/llvm-project/pull/146572 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lld] [lldb] [llvm] [AArch64] Support TLS variables in debug info (PR #146572)
https://github.com/DavidSpickett requested changes to this pull request. Just requesting changes so we don't forget about the ABI change. Might need to coordinate with other toolchains, we can deal with that after ABI discussions. https://github.com/llvm/llvm-project/pull/146572 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Adding pipe support to lldb_private::MainLoopWindows. (PR #145621)
mstorsjo wrote: This broke compilation on mingw (for 64 bit targets, a 32 bit test build is still pending): ``` ../../lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp:455:29: error: cast from pointer to smaller type 'lldb::socket_t' (aka 'unsigned int') loses information 455 | select_helper.FDSetRead((lldb::socket_t)handle); | ^~ ../../lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp:497:39: error: cast from pointer to smaller type 'lldb::socket_t' (aka 'unsigned int') loses information 497 | if (select_helper.FDIsSetRead((lldb::socket_t)handle)) | ^~ 2 warnings and 2 errors generated. ``` https://github.com/llvm/llvm-project/pull/145621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Adding pipe support to lldb_private::MainLoopWindows. (PR #145621)
DavidSpickett wrote: They put up https://github.com/llvm/llvm-project/pull/146632 to fix it, if one of you wants to check it works. https://github.com/llvm/llvm-project/pull/145621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use llvm::erase_if (NFC) (PR #146624)
https://github.com/DavidSpickett approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/146624 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use llvm::erase_if (NFC) (PR #146624)
https://github.com/DavidSpickett closed https://github.com/llvm/llvm-project/pull/146624 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 7ead20d - [lldb] Use llvm::erase_if (NFC) (#146624)
Author: Kazu Hirata Date: 2025-07-02T11:00:58+01:00 New Revision: 7ead20db28425b81ae56f27928af909f518d7c60 URL: https://github.com/llvm/llvm-project/commit/7ead20db28425b81ae56f27928af909f518d7c60 DIFF: https://github.com/llvm/llvm-project/commit/7ead20db28425b81ae56f27928af909f518d7c60.diff LOG: [lldb] Use llvm::erase_if (NFC) (#146624) Note that erase_if combines erase and remove_if. Added: Modified: lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp Removed: diff --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp index c22d5bbdb6924..2adde02aca3a1 100644 --- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp +++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp @@ -1891,11 +1891,8 @@ RISCVSingleStepBreakpointLocationsPredictor::HandleAtomicSequence( // Set breakpoints at the jump addresses of the forward branches that points // after the end of the atomic sequence. - bp_addrs.erase(llvm::remove_if(bp_addrs, - [exit_pc](lldb::addr_t bp_addr) { - return exit_pc >= bp_addr; - }), - bp_addrs.end()); + llvm::erase_if( + bp_addrs, [exit_pc](lldb::addr_t bp_addr) { return exit_pc >= bp_addr; }); // Set breakpoint at the end of atomic sequence. bp_addrs.push_back(exit_pc); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 5fe63ae - [lldb-dap] Fix flaky test TestDAP_server (#145231)
Author: DrSergei Date: 2025-07-02T12:16:48+01:00 New Revision: 5fe63ae9a3fb7502ce7ed076ea14def97d79e85e URL: https://github.com/llvm/llvm-project/commit/5fe63ae9a3fb7502ce7ed076ea14def97d79e85e DIFF: https://github.com/llvm/llvm-project/commit/5fe63ae9a3fb7502ce7ed076ea14def97d79e85e.diff LOG: [lldb-dap] Fix flaky test TestDAP_server (#145231) This patch fixes a possible data race between main and event handler threads. Terminated event can be sent from `Disconnect` function or event handler. Consequently, there are some possible sequences of events. We must check events twice, because without getting an exited event, `exit_status` will be None. But, we don't know the order of events (for example, we can get terminated event before exited event), so we check events by filter. It is correct, because terminated event will be sent only once (guarded by `llvm::call_once`). This patch moved from [145010](https://github.com/llvm/llvm-project/pull/145010) and based on idea from this [comment](https://github.com/llvm/llvm-project/pull/145010#discussion_r2159637210). Added: Modified: lldb/test/API/tools/lldb-dap/server/TestDAP_server.py lldb/tools/lldb-dap/tool/lldb-dap.cpp Removed: diff --git a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py index 592a4cfb0a88b..e01320c25b155 100644 --- a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py +++ b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py @@ -101,7 +101,9 @@ def test_server_interrupt(self): # Interrupt the server which should disconnect all clients. process.send_signal(signal.SIGINT) -self.dap_server.wait_for_terminated() +# Wait for both events since they can happen in any order. +self.dap_server.wait_for_event(["terminated", "exited"]) +self.dap_server.wait_for_event(["terminated", "exited"]) self.assertIsNotNone( self.dap_server.exit_status, "Process exited before interrupting lldb-dap server", diff --git a/lldb/tools/lldb-dap/tool/lldb-dap.cpp b/lldb/tools/lldb-dap/tool/lldb-dap.cpp index 2799d10ae84ba..8bba4162aa7bf 100644 --- a/lldb/tools/lldb-dap/tool/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/tool/lldb-dap.cpp @@ -351,8 +351,6 @@ serveConnection(const Socket::SocketProtocol &protocol, const std::string &name, << " disconnected failed: " << llvm::toString(std::move(error)) << "\n"; } - // Close the socket to ensure the DAP::Loop read finishes. - sock->Close(); } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix flaky test (PR #145231)
https://github.com/da-viper closed https://github.com/llvm/llvm-project/pull/145231 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Prevent using an implicit `step-in`. (PR #143644)
https://github.com/da-viper updated https://github.com/llvm/llvm-project/pull/143644 >From 24e8bbe12758773ef9ca55c3c4022a610db434e9 Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Wed, 11 Jun 2025 02:14:12 +0100 Subject: [PATCH 1/2] [lldb-dap] Prevent using an implicit `step-in`. When there is a function that is inlined at the current program counter. If you get the current `line_entry` using the program counter's address it will point to the location of the inline function that may be in another file. (this is in implicit step-in and should not happen what step over is called). Use the current frame to get the correct `line_entry` --- .../test/tools/lldb-dap/lldbdap_testcase.py | 7 +++- .../API/tools/lldb-dap/step/TestDAP_step.py | 37 +++ lldb/test/API/tools/lldb-dap/step/main.cpp| 14 ++- lldb/test/API/tools/lldb-dap/step/other.h | 7 lldb/tools/lldb-dap/DAP.cpp | 11 ++ lldb/tools/lldb-dap/DAP.h | 11 ++ lldb/tools/lldb-dap/JSONUtils.cpp | 7 +--- 7 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/step/other.h diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py index 3b54d598c3509..6299caf7631af 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py @@ -344,7 +344,12 @@ def stepOver( granularity="statement", timeout=DEFAULT_TIMEOUT, ): -self.dap_server.request_next(threadId=threadId, granularity=granularity) +response = self.dap_server.request_next( +threadId=threadId, granularity=granularity +) +self.assertTrue( +response["success"], f"next request failed: response {response}" +) if waitForStop: return self.dap_server.wait_for_stopped(timeout) return None diff --git a/lldb/test/API/tools/lldb-dap/step/TestDAP_step.py b/lldb/test/API/tools/lldb-dap/step/TestDAP_step.py index 42a39e3c8c080..5339e0bab1d5e 100644 --- a/lldb/test/API/tools/lldb-dap/step/TestDAP_step.py +++ b/lldb/test/API/tools/lldb-dap/step/TestDAP_step.py @@ -83,3 +83,40 @@ def test_step(self): # only step one thread that is at the breakpoint and stop break + +def test_step_over(self): +""" +Test stepping over when the program counter is in another file. +""" +program = self.getBuildArtifact("a.out") +self.build_and_launch(program) +source = "main.cpp" +breakpoint1_line = line_number(source, "// breakpoint 2") +step_over_pos = line_number(source, "// position_after_step_over") +lines = [breakpoint1_line] +breakpoint_ids = self.set_source_breakpoints(source, lines) +self.assertEqual( +len(breakpoint_ids), len(lines), "expect correct number of breakpoints." +) +self.continue_to_breakpoints(breakpoint_ids) + +thread_id = self.dap_server.get_thread_id() +self.stepOver(thread_id) +levels = 1 +frames = self.get_stackFrames(thread_id, 0, levels) +self.assertEqual(len(frames), levels, "expect current number of frame levels.") +top_frame = frames[0] +self.assertEqual( +top_frame["source"]["name"], source, "expect we are in the same file." +) +self.assertTrue( +top_frame["source"]["path"].endswith(source), +f"expect path ending with '{source}'.", +) +self.assertEqual( +top_frame["line"], +step_over_pos, +f"expect step_over on line {step_over_pos}", +) + +self.continue_to_exit() diff --git a/lldb/test/API/tools/lldb-dap/step/main.cpp b/lldb/test/API/tools/lldb-dap/step/main.cpp index 8905beb5e7eff..7320e83154f5b 100644 --- a/lldb/test/API/tools/lldb-dap/step/main.cpp +++ b/lldb/test/API/tools/lldb-dap/step/main.cpp @@ -1,3 +1,5 @@ +#include "other.h" + int function(int x) { if ((x % 2) == 0) return function(x - 1) + x; // breakpoint 1 @@ -5,4 +7,14 @@ int function(int x) { return x; } -int main(int argc, char const *argv[]) { return function(2); } +int function2() { + int volatile value = 3; // breakpoint 2 + inlined_fn(); // position_after_step_over + + return value; +} + +int main(int argc, char const *argv[]) { + int func_result = function2(); + return function(2) - func_result; // returns 0 +} diff --git a/lldb/test/API/tools/lldb-dap/step/other.h b/lldb/test/API/tools/lldb-dap/step/other.h new file mode 100644 index 0..c71cc373fbdff --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/step/other.h @@ -0,0 +1,7 @@ +#ifndef OTHER_H +#define OTHER_H + +__attribute__((noinline)) void not
[Lldb-commits] [lldb] [lldb] Adding pipe support to lldb_private::MainLoopWindows. (PR #145621)
mstorsjo wrote: > They put up #146632 to fix it, if one of you wants to check it works. Thanks - it looks like that does fix some issues, but it only lets the build proceed slightly further to hit other errors caused by this patch: ``` ../../lldb/source/Host/windows/MainLoopWindows.cpp:120:3: error: no type named 'thread' in namespace 'std'; did you mean 'Thread'? 120 | std::thread m_monitor_thread; | ^~~ | Thread ../../lldb/include/lldb/lldb-forward.h:241:7: note: 'Thread' declared here 241 | class Thread; | ^ ../../lldb/source/Host/windows/MainLoopWindows.cpp:67:31: error: no member named 'thread' in namespace 'std' 67 | m_monitor_thread = std::thread(&PipeEvent::Monitor, this); | ^~ ../../lldb/source/Host/windows/MainLoopWindows.cpp:213:33: error: no viable overloaded '=' 213 | m_read_fds[waitable_handle] = { | ~~~ ^ ~ 214 | std::make_unique((HANDLE)waitable_handle), callback}; | ~~~ ../../lldb/include/lldb/Host/windows/MainLoopWindows.h:56:10: note: candidate function (the implicit copy assignment operator) not viable: cannot convert initializer list argument to 'const FdInfo' 56 | struct FdInfo { | ^~ ../../lldb/include/lldb/Host/windows/MainLoopWindows.h:56:10: note: candidate function (the implicit move assignment operator) not viable: cannot convert initializer list argument to 'FdInfo' 56 | struct FdInfo { | ^~ ``` That seems to be easy to fix with a plain `#include ` in `MainLoopWindows.cpp` though. https://github.com/llvm/llvm-project/pull/145621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adjust variable display values. (PR #146754)
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/146754 This corrects a mistake I made when I previously tried to add support for obj-c/swift variables in lldb-dap. This should call into `GetObjectDescription` if there is no summary of the type available and the description is not empty. I also added a unit test to verify this. >From d6ff227ad69c4bc2de8bf975755c333d25a0258c Mon Sep 17 00:00:00 2001 From: John Harrison Date: Wed, 2 Jul 2025 11:08:17 -0700 Subject: [PATCH] [lldb-dap] Adjust variable display values. This corrects a mistake I made when I previously tried to add support for obj-c/swift variables in lldb-dap. This should call into `GetObjectDescription` if there is no summary of the type available and the description is not empty. I also added a unit test to verify this. --- .../tools/lldb-dap/variables/objc/Makefile| 9 .../variables/objc/TestDAP_variables_objc.py | 31 + .../API/tools/lldb-dap/variables/objc/main.m | 45 +++ lldb/tools/lldb-dap/JSONUtils.cpp | 20 + lldb/tools/lldb-dap/JSONUtils.h | 3 ++ 5 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/variables/objc/Makefile create mode 100644 lldb/test/API/tools/lldb-dap/variables/objc/TestDAP_variables_objc.py create mode 100644 lldb/test/API/tools/lldb-dap/variables/objc/main.m diff --git a/lldb/test/API/tools/lldb-dap/variables/objc/Makefile b/lldb/test/API/tools/lldb-dap/variables/objc/Makefile new file mode 100644 index 0..71d7ec417633f --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/variables/objc/Makefile @@ -0,0 +1,9 @@ +OBJC_SOURCES := main.m + +CFLAGS_EXTRAS := -w -fobjc-arc + +USE_SYSTEM_STDLIB := 1 + +LD_EXTRAS := -framework Foundation + +include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/variables/objc/TestDAP_variables_objc.py b/lldb/test/API/tools/lldb-dap/variables/objc/TestDAP_variables_objc.py new file mode 100644 index 0..9dcbed50987b9 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/variables/objc/TestDAP_variables_objc.py @@ -0,0 +1,31 @@ +""" +Test 'variables' requests for obj-c types. +""" + +import lldbdap_testcase +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * + + +class TestDAP_variables_objc(lldbdap_testcase.DAPTestCaseBase): +@skipUnlessDarwin +def test_objc_description(self): +"""Test that we can get the description of an Objective-C object.""" +program = self.getBuildArtifact("a.out") +self.build_and_launch( +program, +) +source = "main.m" +breakpoint_ids = self.set_source_breakpoints( +source, [line_number(source, "// breakpoint")] +) +self.continue_to_breakpoints(breakpoint_ids) + +greeter_var = self.dap_server.get_local_variable(name="greeter") +self.assertIsNotNone(greeter_var, "greeter variable should not be None") +self.assertEqual(greeter_var["type"], "Greeter *") +self.assertEqual(greeter_var["evaluateName"], "greeter") +self.assertRegexpMatches( +greeter_var["value"], r"" +) +self.continue_to_exit() diff --git a/lldb/test/API/tools/lldb-dap/variables/objc/main.m b/lldb/test/API/tools/lldb-dap/variables/objc/main.m new file mode 100644 index 0..aeafa0019af8c --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/variables/objc/main.m @@ -0,0 +1,45 @@ +#import + +@interface Greeter : NSObject + +@property(nonatomic, strong) NSString *name; + +- (void)greet:(NSString *)other; + +@end + +@implementation Greeter + +- (instancetype)initWithName:(NSString *)name { + if ((self = [super init])) { +_name = [name copy]; + } + return self; +} + +- (void)greet:(NSString *)other { + NSLog(@"Hello %@, from %@", other, _name); +} + +- (NSString *)description { + return + [NSString stringWithFormat:@"", (void *)self, _name]; +} + +- (NSString *)debugDescription { + return [NSString stringWithFormat:@"", +(void *)self, _name]; +} + +@end + +int main(int argc, char *argv[]) { + Greeter *greeter = [[Greeter alloc] initWithName:@"Bob"]; + if (argc > 1) { +[greeter greet:@(argv[1])]; + } else { +[greeter greet:@"World"]; + } + + return 0; // breakpoint +} diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp index 08e65ab835a57..a42b4af05d782 100644 --- a/lldb/tools/lldb-dap/JSONUtils.cpp +++ b/lldb/tools/lldb-dap/JSONUtils.cpp @@ -836,6 +836,7 @@ VariableDescription::VariableDescription(lldb::SBValue v, os_display_value << ""; } else { value = llvm::StringRef(v.GetValue()).str(); +object_description = llvm::StringRef(v.GetObjectDescription()).str(); summary = llvm::StringRef(v.GetSummary()).str(); if (summary.empty() && auto_variable_summaries) auto_summary = TryCreateAutoSummary(v); @@ -8
[Lldb-commits] [lldb] ab0fa6c - [lldb] Fix else-after-return in Breakpoint (NFC)
Author: Jonas Devlieghere Date: 2025-07-02T12:07:20-07:00 New Revision: ab0fa6c5dc725ef6f839ac8cea9b3a41aa3a5b75 URL: https://github.com/llvm/llvm-project/commit/ab0fa6c5dc725ef6f839ac8cea9b3a41aa3a5b75 DIFF: https://github.com/llvm/llvm-project/commit/ab0fa6c5dc725ef6f839ac8cea9b3a41aa3a5b75.diff LOG: [lldb] Fix else-after-return in Breakpoint (NFC) The LLVM Coding Standards [1] discourages the use of 'else' or 'else if' after something that interrupts control flow. Bulk fix all instances as I'm working on this part of LLDB. [1] https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return Added: Modified: lldb/include/lldb/Breakpoint/BreakpointResolver.h lldb/source/Breakpoint/Breakpoint.cpp lldb/source/Breakpoint/BreakpointIDList.cpp lldb/source/Breakpoint/BreakpointLocation.cpp lldb/source/Breakpoint/BreakpointLocationList.cpp lldb/source/Breakpoint/BreakpointOptions.cpp lldb/source/Breakpoint/BreakpointResolverName.cpp lldb/source/Breakpoint/Watchpoint.cpp lldb/source/Breakpoint/WatchpointOptions.cpp Removed: diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolver.h b/lldb/include/lldb/Breakpoint/BreakpointResolver.h index a0b37c94ac2b4..52cd70e934e6d 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolver.h +++ b/lldb/include/lldb/Breakpoint/BreakpointResolver.h @@ -148,8 +148,7 @@ class BreakpointResolver : public Searcher { enum ResolverTy GetResolverTy() { if (SubclassID > ResolverTy::LastKnownResolverType) return ResolverTy::UnknownResolver; -else - return (enum ResolverTy)SubclassID; +return (enum ResolverTy)SubclassID; } const char *GetResolverName() { return ResolverTyToName(GetResolverTy()); } diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index 2ed0c9314e3e1..b308644825dad 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -347,8 +347,7 @@ void Breakpoint::SetThreadID(lldb::tid_t thread_id) { lldb::tid_t Breakpoint::GetThreadID() const { if (m_options.GetThreadSpecNoCreate() == nullptr) return LLDB_INVALID_THREAD_ID; - else -return m_options.GetThreadSpecNoCreate()->GetTID(); + return m_options.GetThreadSpecNoCreate()->GetTID(); } void Breakpoint::SetThreadIndex(uint32_t index) { @@ -362,8 +361,7 @@ void Breakpoint::SetThreadIndex(uint32_t index) { uint32_t Breakpoint::GetThreadIndex() const { if (m_options.GetThreadSpecNoCreate() == nullptr) return 0; - else -return m_options.GetThreadSpecNoCreate()->GetIndex(); + return m_options.GetThreadSpecNoCreate()->GetIndex(); } void Breakpoint::SetThreadName(const char *thread_name) { @@ -378,8 +376,7 @@ void Breakpoint::SetThreadName(const char *thread_name) { const char *Breakpoint::GetThreadName() const { if (m_options.GetThreadSpecNoCreate() == nullptr) return nullptr; - else -return m_options.GetThreadSpecNoCreate()->GetName(); + return m_options.GetThreadSpecNoCreate()->GetName(); } void Breakpoint::SetQueueName(const char *queue_name) { @@ -394,8 +391,7 @@ void Breakpoint::SetQueueName(const char *queue_name) { const char *Breakpoint::GetQueueName() const { if (m_options.GetThreadSpecNoCreate() == nullptr) return nullptr; - else -return m_options.GetThreadSpecNoCreate()->GetQueueName(); + return m_options.GetThreadSpecNoCreate()->GetQueueName(); } void Breakpoint::SetCondition(const char *condition) { @@ -851,8 +847,8 @@ void Breakpoint::GetDescription(Stream *s, lldb::DescriptionLevel level, if (level == eDescriptionLevelBrief) { s->PutCString(GetBreakpointKind()); return; -} else - s->Printf("Kind: %s\n", GetBreakpointKind()); +} +s->Printf("Kind: %s\n", GetBreakpointKind()); } const size_t num_locations = GetNumLocations(); @@ -1085,8 +1081,7 @@ Breakpoint::BreakpointEventData::GetBreakpointEventTypeFromEvent( if (data == nullptr) return eBreakpointEventTypeInvalidType; - else -return data->GetBreakpointEventType(); + return data->GetBreakpointEventType(); } BreakpointSP Breakpoint::BreakpointEventData::GetBreakpointFromEvent( diff --git a/lldb/source/Breakpoint/BreakpointIDList.cpp b/lldb/source/Breakpoint/BreakpointIDList.cpp index 5fc9f95a75db1..8dde2c31e64a2 100644 --- a/lldb/source/Breakpoint/BreakpointIDList.cpp +++ b/lldb/source/Breakpoint/BreakpointIDList.cpp @@ -99,8 +99,8 @@ llvm::Error BreakpointIDList::FindAndReplaceIDRanges( new_args.Clear(); return llvm::createStringError(llvm::inconvertibleErrorCode(), error.AsCString()); - } else -names_found.insert(std::string(current_arg)); + } + names_found.insert(std::string(current_arg)); } else if ((i + 2 < old_args.size()) && BreakpointID::IsRangeIdent
[Lldb-commits] [lldb] [llvm] [lldb][NFC][MachO] Clean up LC_THREAD reading code, remove i386 corefile (PR #146480)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-remote-linux-ubuntu` running on `as-builder-9` while building `lldb,llvm` at step 7 "build-default". Full details are available at: https://lab.llvm.org/buildbot/#/builders/195/builds/11272 Here is the relevant piece of the build log for the reference ``` Step 7 (build-default) failure: cmake (failure) ... 18.930 [891/12/4586] Linking CXX static library lib/libLLVMObjCopy.a 18.950 [890/12/4587] Linking CXX static library lib/libLLVMDebugInfoDWARF.a 18.981 [889/12/4588] Linking CXX static library lib/libLLVMObjectYAML.a 19.004 [888/12/4589] Linking CXX static library lib/libLLVMLibDriver.a 19.009 [887/12/4590] Linking CXX static library lib/libLLVMJITLink.a 19.011 [886/12/4591] Linking CXX static library lib/libLLVMDebugInfoPDB.a 19.019 [885/12/4592] Linking CXX static library lib/libLLVMXRay.a 19.055 [884/12/4593] Linking CXX static library lib/liblldbHost.a 19.083 [883/12/4594] Linking CXX static library lib/libLLVMDebugInfoGSYM.a 19.088 [882/12/4595] Building CXX object tools/lldb/source/Plugins/ObjectFile/Mach-O/CMakeFiles/lldbPluginObjectFileMachO.dir/ObjectFileMachO.cpp.o FAILED: tools/lldb/source/Plugins/ObjectFile/Mach-O/CMakeFiles/lldbPluginObjectFileMachO.dir/ObjectFileMachO.cpp.o ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/source/Plugins/ObjectFile/Mach-O -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/source/Plugins/ObjectFile/Mach-O -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/include -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/include -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/llvm/include -I/usr/include/python3.12 -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/llvm/../clang/include -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/../clang/include -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/source -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/source -D__OPTIMIZE__ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-stringop-truncation -O3 -DNDEBUG -std=c++17 -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/lldb/source/Plugins/ObjectFile/Mach-O/CMakeFiles/lldbPluginObjectFileMachO.dir/ObjectFileMachO.cpp.o -MF tools/lldb/source/Plugins/ObjectFile/Mach-O/CMakeFiles/lldbPluginObjectFileMachO.dir/ObjectFileMachO.cpp.o.d -o tools/lldb/source/Plugins/ObjectFile/Mach-O/CMakeFiles/lldbPluginObjectFileMachO.dir/ObjectFileMachO.cpp.o -c /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp: In member function ‘void RegisterContextDarwin_arm_Mach::SetRegisterDataFrom_LC_THREAD(const lldb_private::DataExtractor&)’: /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:415:7: error: expected primary-expression before ‘}’ token 415 | } | ^ /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp: In member function ‘void RegisterContextDarwin_arm64_Mach::SetRegisterDataFrom_LC_THREAD(const lldb_private::DataExtractor&)’: /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:536:7: error: expected primary-expression before ‘}’ token 536 | } | ^ /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp: In member function ‘void RegisterContextDarwin_riscv32_Mach::SetRegisterDataFrom_LC_THREAD(const lldb_private::DataExtractor&)’: /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:672:7: error: expected primary-expression
[Lldb-commits] [lldb] [llvm] [lldb][NFC][MachO] Clean up LC_THREAD reading code, remove i386 corefile (PR #146480)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `publish-sphinx-docs` running on `as-worker-4` while building `lldb,llvm` at step 5 "build-docs-llvm-html-docs-clang-html-docs-clang...". Full details are available at: https://lab.llvm.org/buildbot/#/builders/45/builds/13922 Here is the relevant piece of the build log for the reference ``` Step 5 (build-docs-llvm-html-docs-clang-html-docs-clang...) failure: build (failure) ... 1580.272 [638/24/4825] Building CXX object tools/lldb/source/Plugins/ObjectFile/COFF/CMakeFiles/lldbPluginObjectFileCOFF.dir/ObjectFileCOFF.cpp.o 1580.644 [637/24/4826] Building CXX object tools/lldb/source/Plugins/ObjectFile/PECOFF/CMakeFiles/lldbPluginObjectFilePECOFF.dir/PECallFrameInfo.cpp.o 1581.540 [636/24/4827] Building CXX object tools/lldb/source/Plugins/ObjectFile/PDB/CMakeFiles/lldbPluginObjectFilePDB.dir/ObjectFilePDB.cpp.o 1581.837 [635/24/4828] Building CXX object tools/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeFiles/lldbPluginAppleObjCRuntime.dir/AppleObjCTypeEncodingParser.cpp.o 1581.961 [634/24/4829] Building CXX object tools/lldb/source/Plugins/ObjectFile/Minidump/CMakeFiles/lldbPluginObjectFileMinidump.dir/ObjectFileMinidump.cpp.o 1582.242 [633/24/4830] Building CXX object tools/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeFiles/lldbPluginAppleObjCRuntime.dir/AppleObjCTrampolineHandler.cpp.o 1582.311 [632/24/4831] Building CXX object tools/lldb/source/Plugins/LanguageRuntime/ObjC/GNUstepObjCRuntime/CMakeFiles/lldbPluginGNUstepObjCRuntime.dir/GNUstepObjCRuntime.cpp.o 1582.921 [631/24/4832] Building CXX object tools/lldb/source/Plugins/ObjectFile/PECOFF/CMakeFiles/lldbPluginObjectFilePECOFF.dir/WindowsMiniDump.cpp.o 1583.073 [630/24/4833] Building CXX object tools/lldb/source/Plugins/Platform/Android/CMakeFiles/lldbPluginPlatformAndroid.dir/AdbClient.cpp.o 1583.308 [629/24/4834] Building CXX object tools/lldb/source/Plugins/ObjectFile/Mach-O/CMakeFiles/lldbPluginObjectFileMachO.dir/ObjectFileMachO.cpp.o FAILED: tools/lldb/source/Plugins/ObjectFile/Mach-O/CMakeFiles/lldbPluginObjectFileMachO.dir/ObjectFileMachO.cpp.o /usr/bin/c++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/as-worker-4/publish-sphinx-docs/build/tools/lldb/source/Plugins/ObjectFile/Mach-O -I/home/buildbot/as-worker-4/publish-sphinx-docs/llvm-project/lldb/source/Plugins/ObjectFile/Mach-O -I/home/buildbot/as-worker-4/publish-sphinx-docs/llvm-project/lldb/include -I/home/buildbot/as-worker-4/publish-sphinx-docs/build/tools/lldb/include -I/home/buildbot/as-worker-4/publish-sphinx-docs/build/include -I/home/buildbot/as-worker-4/publish-sphinx-docs/llvm-project/llvm/include -I/usr/include/python3.8 -I/home/buildbot/as-worker-4/publish-sphinx-docs/llvm-project/llvm/../clang/include -I/home/buildbot/as-worker-4/publish-sphinx-docs/build/tools/lldb/../clang/include -I/home/buildbot/as-worker-4/publish-sphinx-docs/llvm-project/lldb/source -I/home/buildbot/as-worker-4/publish-sphinx-docs/build/tools/lldb/source -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-stringop-truncation -O3 -DNDEBUG -fno-exceptions -funwind-tables -fno-rtti -std=c++17 -MD -MT tools/lldb/source/Plugins/ObjectFile/Mach-O/CMakeFiles/lldbPluginObjectFileMachO.dir/ObjectFileMachO.cpp.o -MF tools/lldb/source/Plugins/ObjectFile/Mach-O/CMakeFiles/lldbPluginObjectFileMachO.dir/ObjectFileMachO.cpp.o.d -o tools/lldb/source/Plugins/ObjectFile/Mach-O/CMakeFiles/lldbPluginObjectFileMachO.dir/ObjectFileMachO.cpp.o -c /home/buildbot/as-worker-4/publish-sphinx-docs/llvm-project/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp /home/buildbot/as-worker-4/publish-sphinx-docs/llvm-project/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp: In member function ‘void RegisterContextDarwin_arm_Mach::SetRegisterDataFrom_LC_THREAD(const lldb_private::DataExtractor&)’: /home/buildbot/as-worker-4/publish-sphinx-docs/llvm-project/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:415:7: error: expected primary-expression before ‘}’ token 415 | } | ^ /home/buildbot/as-worker-4/publish-sphinx-docs/llvm-project/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp: In member function ‘void RegisterContextDarwin_arm64_Mach::SetRegisterDataFrom_LC_THREAD(const lldb_private::DataExtractor&)’: /home/buildbot/as-worker-4/publish-sphinx-docs/llvm-project/lldb/
[Lldb-commits] [libcxx] [lldb] [libcxx] adds size-based `__split_buffer` representation to unstable ABI (PR #139632)
@@ -78,23 +80,232 @@ public: __split_buffer, void>; - pointer __first_; - pointer __begin_; - pointer __end_; - _LIBCPP_COMPRESSED_PAIR(pointer, __cap_, allocator_type, __alloc_); + struct __data { cjdb wrote: I decided to keep it as a member of `__split_buffer` to simplify the implementation, but defined it outside so that it resembled the spirit of this request. I was also able to put `invariants()` back into `__split_buffer::__invariants()`. https://github.com/llvm/llvm-project/pull/139632 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxx] [lldb] [libcxx] adds size-based `__split_buffer` representation to unstable ABI (PR #139632)
@@ -431,52 +599,61 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::shrink_to_fi template template _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_front(_Args&&... __args) { - if (__begin_ == __first_) { -if (__end_ < __cap_) { - difference_type __d = __cap_ - __end_; + if (__data_.__begin_ == __data_.__first_) { +pointer __end = __data_.end(); +if (__data_.__front_spare() != 0) { + difference_type __d = __data_.__back_spare(); __d = (__d + 1) / 2; - __begin_= std::move_backward(__begin_, __end_, __end_ + __d); - __end_ += __d; + __data_.__begin_= std::move_backward(__data_.__begin_, __end, __end + __d); +#ifdef _LIBCPP_ABI_SIZE_BASED_CONTAINERS + // TODO: explain why there isn't a size-based analogue +#else + __data_.__end_ += __d; +#endif cjdb wrote: Comments added. I consider this resolved for now, but am leaving open in case you want to discuss it further. https://github.com/llvm/llvm-project/pull/139632 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxx] [lldb] [libcxx] adds size-based `__split_buffer` representation to unstable ABI (PR #139632)
cjdb wrote: I still think that `_LIBCPP_SIZE_BASED_VECTOR` is the most appropriate name, since this work was entirely motivated by size-based vector, and this PR is a precursor to enabling size-based vector in libc++. The changes to `std::deque` are only happenstance, and if I could get away with not making them, then I would. https://github.com/llvm/llvm-project/pull/139632 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [libcxx] [lldb] [libcxx] adds size-based `__split_buffer` representation to unstable ABI (PR #139632)
@@ -253,30 +436,35 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::__construct_ template _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) { - _ConstructTransaction __tx(std::addressof(this->__end_), __n); + _ConstructTransaction __tx(this, __data_.end(), __n); for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { -__alloc_traits::construct(__alloc_, std::__to_address(__tx.__pos_), __x); +__alloc_traits::construct(__data_.__alloc_, std::__to_address(__tx.__pos_), __x); } } -template -template +template +template _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::__construct_at_end_with_sentinel(_Iterator __first, _Sentinel __last) { - __alloc_rr& __a = __alloc_; + __alloc_rr& __a = __data_.__alloc_; for (; __first != __last; ++__first) { -if (__end_ == __cap_) { - size_type __old_cap = __cap_ - __first_; +if (__data_.__back_spare() == 0) { + size_type __old_cap = __data_.capacity(); size_type __new_cap = std::max(2 * __old_cap, 8); __split_buffer __buf(__new_cap, 0, __a); - for (pointer __p = __begin_; __p != __end_; ++__p, (void)++__buf.__end_) -__alloc_traits::construct(__buf.__alloc_, std::__to_address(__buf.__end_), std::move(*__p)); + pointer __buf_end = __buf.__data_.end(); + pointer __end = __data_.end(); + for (pointer __p = __data_.__begin_; __p != __end; ++__p, (void)++__buf_end) +__alloc_traits::construct(__buf.__data_.__alloc_, std::__to_address(__buf_end), std::move(*__p)); + __buf.__data_.__update_sentinel(__buf_end); swap(__buf); } -__alloc_traits::construct(__a, std::__to_address(this->__end_), *__first); -++this->__end_; + +__alloc_traits::construct(__a, std::__to_address(__data_.end()), *__first); +__data_.__update_sentinel(size() + 1); cjdb wrote: We can't do that here because `__buf_end` depends on `__buf`, which really shouldn't be moved out of its current scope. https://github.com/llvm/llvm-project/pull/139632 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add DWARFExpressionEntry and GetExpressionEntryAtAddress() to … (PR #144238)
https://github.com/UltimateForce21 updated https://github.com/llvm/llvm-project/pull/144238 >From 8ed8c540e7600d720a63bc2882a81a2c65c11d41 Mon Sep 17 00:00:00 2001 From: ultimateforce21 Date: Wed, 11 Jun 2025 00:11:09 -0400 Subject: [PATCH 01/11] [lldb] Add DWARFExpressionEntry and GetExpressionEntryAtAddress() to DWARFExpressionList This introduces a new API for retrieving DWARF expression metadata associated with variable location entries at a given PC address. It provides the base, end, and expression pointer for downstream consumers such as disassembler annotations. Intended for use in richer instruction annotations in Instruction::Dump(). --- .../lldb/Expression/DWARFExpressionList.h | 12 +++ .../source/Expression/DWARFExpressionList.cpp | 21 +++ 2 files changed, 33 insertions(+) diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h b/lldb/include/lldb/Expression/DWARFExpressionList.h index d8f8ec247ed56..a329b37393018 100644 --- a/lldb/include/lldb/Expression/DWARFExpressionList.h +++ b/lldb/include/lldb/Expression/DWARFExpressionList.h @@ -59,6 +59,18 @@ class DWARFExpressionList { lldb::addr_t GetFuncFileAddress() { return m_func_file_addr; } + /// Represents an entry in the DWARFExpressionList with all needed metadata + struct DWARFExpressionEntry { +lldb::addr_t base; +lldb::addr_t end; +const DWARFExpression *expr; + }; + + /// Returns the entry (base, end, data) for a given PC address + llvm::Expected + GetExpressionEntryAtAddress(lldb::addr_t func_load_addr, + lldb::addr_t load_addr) const; + const DWARFExpression *GetExpressionAtAddress(lldb::addr_t func_load_addr, lldb::addr_t load_addr) const; diff --git a/lldb/source/Expression/DWARFExpressionList.cpp b/lldb/source/Expression/DWARFExpressionList.cpp index 04592a1eb7ff4..b55bc7120c4af 100644 --- a/lldb/source/Expression/DWARFExpressionList.cpp +++ b/lldb/source/Expression/DWARFExpressionList.cpp @@ -53,6 +53,27 @@ bool DWARFExpressionList::ContainsAddress(lldb::addr_t func_load_addr, return GetExpressionAtAddress(func_load_addr, addr) != nullptr; } +llvm::Expected +DWARFExpressionList::GetExpressionEntryAtAddress(lldb::addr_t func_load_addr, + lldb::addr_t load_addr) const { + if (const DWARFExpression *expr = GetAlwaysValidExpr()) { +return DWARFExpressionEntry{0, LLDB_INVALID_ADDRESS, expr}; + } + + if (func_load_addr == LLDB_INVALID_ADDRESS) +func_load_addr = m_func_file_addr; + + addr_t addr = load_addr - func_load_addr + m_func_file_addr; + uint32_t index = m_exprs.FindEntryIndexThatContains(addr); + if (index == UINT32_MAX) { +return llvm::createStringError(llvm::inconvertibleErrorCode(), + "No DWARF expression found for address 0x%llx", addr); + } + + const Entry &entry = *m_exprs.GetEntryAtIndex(index); + return DWARFExpressionEntry{entry.base, entry.GetRangeEnd(), &entry.data}; +} + const DWARFExpression * DWARFExpressionList::GetExpressionAtAddress(lldb::addr_t func_load_addr, lldb::addr_t load_addr) const { >From 1db5002a69dba4f88aaac56d61520b7b4b214b01 Mon Sep 17 00:00:00 2001 From: Abdullah Mohammad Amin <67847674+ultimateforc...@users.noreply.github.com> Date: Thu, 19 Jun 2025 11:55:35 -0400 Subject: [PATCH 02/11] Update lldb/include/lldb/Expression/DWARFExpressionList.h Co-authored-by: Jonas Devlieghere --- lldb/include/lldb/Expression/DWARFExpressionList.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h b/lldb/include/lldb/Expression/DWARFExpressionList.h index a329b37393018..89e55ffc07659 100644 --- a/lldb/include/lldb/Expression/DWARFExpressionList.h +++ b/lldb/include/lldb/Expression/DWARFExpressionList.h @@ -59,7 +59,7 @@ class DWARFExpressionList { lldb::addr_t GetFuncFileAddress() { return m_func_file_addr; } - /// Represents an entry in the DWARFExpressionList with all needed metadata + /// Represents an entry in the DWARFExpressionList with all needed metadata. struct DWARFExpressionEntry { lldb::addr_t base; lldb::addr_t end; >From a26010b06e5067b8b3b223cbd76e8848ecb9a289 Mon Sep 17 00:00:00 2001 From: Abdullah Mohammad Amin <67847674+ultimateforc...@users.noreply.github.com> Date: Thu, 19 Jun 2025 11:58:28 -0400 Subject: [PATCH 03/11] Update lldb/include/lldb/Expression/DWARFExpressionList.h Updated comment for GetExpressionEntryAtAddress to directly refer to struct DWARFExpressionEntry Co-authored-by: Jonas Devlieghere --- lldb/include/lldb/Expression/DWARFExpressionList.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h b/lldb/include/lldb/Expression/DWARFExpressionList.h index 89e55ffc07659..f6a269809decc 100644 --- a/lld
[Lldb-commits] [lldb] [lldb] Add DWARFExpressionEntry and GetExpressionEntryAtAddress() to … (PR #144238)
@@ -53,6 +54,30 @@ bool DWARFExpressionList::ContainsAddress(lldb::addr_t func_load_addr, return GetExpressionAtAddress(func_load_addr, addr) != nullptr; } +std::optional +DWARFExpressionList::GetExpressionEntryAtAddress(lldb::addr_t func_load_addr, +lldb::addr_t load_addr) const { + if (const DWARFExpression *always = GetAlwaysValidExpr()) { +AddressRange full_range(m_func_file_addr, /*size=*/LLDB_INVALID_ADDRESS); +return DWARFExpressionEntry{full_range, always}; + } + + if (func_load_addr == LLDB_INVALID_ADDRESS) +func_load_addr = m_func_file_addr; + + // translate to file-relative PC + lldb::addr_t file_pc = load_addr - func_load_addr + m_func_file_addr; UltimateForce21 wrote: I dug into MathExtras and found that its AddOverflow and SubOverflow helpers are only defined for signed types. I they rely on two’s-complement signed overflow semantics and return the truncated signed result. Since lldb::addr_t is an unsigned address, I think using those helpers would either fail to compile or silently convert to signed semantics. So I tried to implement the signed overflow check into the function. Please let me know if you think it is alright. https://github.com/llvm/llvm-project/pull/144238 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)
https://github.com/chelcassanova updated https://github.com/llvm/llvm-project/pull/138031 >From e87953011acc6052c0ced1911e578347b66a2dc0 Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Wed, 30 Apr 2025 14:15:39 -0700 Subject: [PATCH] [lldb][RPC] Upstream lldb-rpc-gen tool This commit upstreams the `lldb-rpc-gen` tool, a ClangTool that generates the LLDB RPC client and server interfaces. https://discourse.llvm.org/t/rfc-upstreaming-lldb-rpc/85804 --- lldb/cmake/modules/LLDBConfig.cmake | 2 + lldb/test/CMakeLists.txt | 7 +- .../Tests/CheckRPCGenToolByproducts.test | 11 + lldb/test/Shell/RPC/Generator/lit.local.cfg | 3 + lldb/test/Shell/helper/toolchain.py | 8 + lldb/test/Shell/lit.site.cfg.py.in| 1 + lldb/tools/CMakeLists.txt | 3 + lldb/tools/lldb-rpc/CMakeLists.txt| 22 + lldb/tools/lldb-rpc/LLDBRPCGeneration.cmake | 60 +++ lldb/tools/lldb-rpc/LLDBRPCHeaders.cmake | 101 .../lldb-rpc/lldb-rpc-gen/CMakeLists.txt | 21 + .../tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp | 501 ++ lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.h | 108 .../lldb-rpc/lldb-rpc-gen/lldb-rpc-gen.cpp| 341 14 files changed, 1188 insertions(+), 1 deletion(-) create mode 100644 lldb/test/Shell/RPC/Generator/Tests/CheckRPCGenToolByproducts.test create mode 100644 lldb/test/Shell/RPC/Generator/lit.local.cfg create mode 100644 lldb/tools/lldb-rpc/CMakeLists.txt create mode 100644 lldb/tools/lldb-rpc/LLDBRPCGeneration.cmake create mode 100644 lldb/tools/lldb-rpc/LLDBRPCHeaders.cmake create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/CMakeLists.txt create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.h create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/lldb-rpc-gen.cpp diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index 37b823feb584b..069b5412d03f8 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -322,4 +322,6 @@ else() set(LLDB_CAN_USE_DEBUGSERVER OFF) endif() +set(LLDB_BUILD_LLDBRPC ON CACHE BOOL "") + include(LLDBGenerateConfig) diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt index 6449ac5a9247f..7cf239c7f95ab 100644 --- a/lldb/test/CMakeLists.txt +++ b/lldb/test/CMakeLists.txt @@ -132,6 +132,10 @@ if(TARGET lldb-framework) add_lldb_test_dependency(lldb-framework) endif() +if (LLDB_BUILD_LLDBRPC) + add_lldb_test_dependency(lldb-rpc-generate-sources) +endif() + # Add dependencies that are not exported targets when building standalone. if(NOT LLDB_BUILT_STANDALONE) add_lldb_test_dependency( @@ -249,7 +253,8 @@ llvm_canonicalize_cmake_booleans( LLDB_TEST_SHELL_DISABLE_REMOTE LLDB_TOOL_LLDB_SERVER_BUILD LLDB_USE_SYSTEM_DEBUGSERVER - LLDB_IS_64_BITS) + LLDB_IS_64_BITS + LLDB_BUILD_LLDBRPC) # Configure the individual test suites. add_subdirectory(API) diff --git a/lldb/test/Shell/RPC/Generator/Tests/CheckRPCGenToolByproducts.test b/lldb/test/Shell/RPC/Generator/Tests/CheckRPCGenToolByproducts.test new file mode 100644 index 0..be3eefc69b20a --- /dev/null +++ b/lldb/test/Shell/RPC/Generator/Tests/CheckRPCGenToolByproducts.test @@ -0,0 +1,11 @@ +# For this test, we're not checking any specific output from a generated file, +# but we do need a file to pass into lldb-rpc-gen so use SBAddress.h from source. +RUN: %lldb-rpc-gen --output-dir=%t %S/../../../../../include/lldb/API/SBAddress.h + +RUN: ls %t | FileCheck %s + +# We're just making sure that the tool emits the class names, +# methods and skipped methods file in the output directory. +CHECK: SBAPI.def +CHECK: SBClasses.def +CHECK: SkippedMethods.txt diff --git a/lldb/test/Shell/RPC/Generator/lit.local.cfg b/lldb/test/Shell/RPC/Generator/lit.local.cfg new file mode 100644 index 0..db9494781c00c --- /dev/null +++ b/lldb/test/Shell/RPC/Generator/lit.local.cfg @@ -0,0 +1,3 @@ +# All tests for the tool need lldb-rpc-gen to be built. +if not config.lldb_has_lldbrpc: + config.unsupported = True diff --git a/lldb/test/Shell/helper/toolchain.py b/lldb/test/Shell/helper/toolchain.py index 42968128f2702..95437dba55b7d 100644 --- a/lldb/test/Shell/helper/toolchain.py +++ b/lldb/test/Shell/helper/toolchain.py @@ -156,6 +156,14 @@ def use_lldb_substitutions(config): extra_args=["platform"], unresolved="ignore", ), +ToolSubst( +"%lldb-rpc-gen", +command=FindTool("lldb-rpc-gen"), +extra_args=[ +'--extra-arg="-resource-dir=' + config.clang_resource_dir + '"' +], +unresolved="ignore", +), "lldb-test", "lldb-dap", ToolSubst( diff --git a/lldb/test/Shell/lit.site.cfg.py.in b/lldb/test/Shell/lit.site.cfg.py.in index 5be5359217769
[Lldb-commits] [lldb] [LLDB] Simplify libstdc++ string summaries (PR #146562)
https://github.com/Michael137 approved this pull request. thanks! https://github.com/llvm/llvm-project/pull/146562 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RPC] Upstream RPC server interface emitters (PR #138032)
https://github.com/chelcassanova updated https://github.com/llvm/llvm-project/pull/138032 >From 5b5ba0f552715cd68e82aa03adadb5323e5c6eff Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Wed, 30 Apr 2025 14:24:03 -0700 Subject: [PATCH] [lldb[RPC] Upstream RPC server interface emitters This commit upstreams the LLDB RPC server interface emitters. These emitters generate the server-side API interfaces for RPC, which communicate directly with liblldb itself out of process using the SB API. https://discourse.llvm.org/t/rfc-upstreaming-lldb-rpc/85804 --- .../Inputs/Server/CheckBasicIncludesEmit.h| 6 + .../Inputs/Server/CheckConstCharPointer.h | 14 + .../Tests/Server/CheckBasicIncludesEmit.test | 15 + .../Tests/Server/CheckConstCharPointer.test | 11 + .../lldb-rpc/lldb-rpc-gen/lldb-rpc-gen.cpp| 414 + .../server/RPCServerHeaderEmitter.cpp | 75 +++ .../server/RPCServerHeaderEmitter.h | 47 ++ .../server/RPCServerSourceEmitter.cpp | 584 ++ .../server/RPCServerSourceEmitter.h | 81 +++ 9 files changed, 1247 insertions(+) create mode 100644 lldb/test/Shell/RPC/Generator/Inputs/Server/CheckBasicIncludesEmit.h create mode 100644 lldb/test/Shell/RPC/Generator/Inputs/Server/CheckConstCharPointer.h create mode 100644 lldb/test/Shell/RPC/Generator/Tests/Server/CheckBasicIncludesEmit.test create mode 100644 lldb/test/Shell/RPC/Generator/Tests/Server/CheckConstCharPointer.test create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/lldb-rpc-gen.cpp create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/server/RPCServerHeaderEmitter.cpp create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/server/RPCServerHeaderEmitter.h create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/server/RPCServerSourceEmitter.cpp create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/server/RPCServerSourceEmitter.h diff --git a/lldb/test/Shell/RPC/Generator/Inputs/Server/CheckBasicIncludesEmit.h b/lldb/test/Shell/RPC/Generator/Inputs/Server/CheckBasicIncludesEmit.h new file mode 100644 index 0..77394aba12f7a --- /dev/null +++ b/lldb/test/Shell/RPC/Generator/Inputs/Server/CheckBasicIncludesEmit.h @@ -0,0 +1,6 @@ +// This ia a basic header file used to check that the server-side emitter +// for rpc-gen emits an expected set of includes in a generated source file. +#ifndef LLDB_API_SBRPC_CHECKBASICINCLUDE_H +#define LLDB_API_SBRPC_CHECKBASICINCLUDE_H + +#endif // LLDB_API_SBRPC_CHECKBASICINCLUDE_H diff --git a/lldb/test/Shell/RPC/Generator/Inputs/Server/CheckConstCharPointer.h b/lldb/test/Shell/RPC/Generator/Inputs/Server/CheckConstCharPointer.h new file mode 100644 index 0..37121cd445267 --- /dev/null +++ b/lldb/test/Shell/RPC/Generator/Inputs/Server/CheckConstCharPointer.h @@ -0,0 +1,14 @@ +#ifndef LLDB_API_SBRPC_CHECKCONSTCHARPOINTER_H +#define LLDB_API_SBRPC_CHECKCONSTCHARPOINTER_H + +namespace lldb { +class LLDB_API SBRPC_CHECKCONSTCHARPOINTER { +public: + // const char * parameters must decoded as rpc_common::ConstCharPointer in server side + // source files. + int CheckConstCharPointer(char *string); + +}; // class SBRPC_CHECKCONSTCHARPOINTER +} // namespace lldb + +#endif // LLDB_API_SBRPC_CHECKCONSTCHARPOINTER_H diff --git a/lldb/test/Shell/RPC/Generator/Tests/Server/CheckBasicIncludesEmit.test b/lldb/test/Shell/RPC/Generator/Tests/Server/CheckBasicIncludesEmit.test new file mode 100644 index 0..2283fe8c66530 --- /dev/null +++ b/lldb/test/Shell/RPC/Generator/Tests/Server/CheckBasicIncludesEmit.test @@ -0,0 +1,15 @@ +# Disabling until the lldb-rpc-gen tool lands. +UNSUPPORTED: system-windows, system-linux, system-darwin +RUN: mkdir -p %t/server +RUN: mkdir -p %t/lib +RUN: %lldb-rpc-gen --output-dir=%t %S/../../Inputs/CheckBasicIncludesEmit.h + +RUN: cat %t/lib/CheckBasicIncludesEmit.cpp | FileCheck %s + +# All server-side source files must have these includes at the top of their files. +CHECK: #include "RPCUserServer.h" +CHECK: #include "SBAPI.h" +CHECK: #include +CHECK: #include +CHECK: #include +CHECK: #include diff --git a/lldb/test/Shell/RPC/Generator/Tests/Server/CheckConstCharPointer.test b/lldb/test/Shell/RPC/Generator/Tests/Server/CheckConstCharPointer.test new file mode 100644 index 0..77eadd2fed132 --- /dev/null +++ b/lldb/test/Shell/RPC/Generator/Tests/Server/CheckConstCharPointer.test @@ -0,0 +1,11 @@ +# Disabling until the lldb-rpc-gen tool lands. +UNSUPPORTED: system-windows, system-linux, system-darwin +RUN: mkdir -p %t/server +RUN: mkdir -p %t/lib +RUN: %lldb-rpc-gen --output-dir=%t %S/../../Inputs/CheckConstCharPointer.h + +RUN: cat %t/lib/CheckConstCharPointer.cpp | FileCheck %s + +# const char * pointers must be decoded as rpc_common::ConstCharPointer objects +# in server side source files. +CHECK: rpc_common::ConstCharPointer string diff --git a/lldb/tools/lldb-rpc/lldb-rpc-gen/lldb-rpc-gen.cpp b/lldb/tools/lldb-rpc/lldb-rpc-gen/lldb-rpc-gen.cpp new f
[Lldb-commits] [lldb] [lldb-dap] Adjust variable display values. (PR #146754)
ashgti wrote: > If you can ensure that the expression you are running can safely be executed > by running only the current thread, it's only a performance problem to run > expressions behind the user's back. But otherwise, we really should only run > expressions when the user explicitly asks us to. I thought, but didn't check, that this wouldn't run the target if the `target.prefer-dynamic-value` was set to `no-run-target`. Maybe we could use this if only for `context="repl"` requests. If you try to print something and it just prints ` @ `, that doesn't seem as useful as getting the object description, if its possible. https://github.com/llvm/llvm-project/pull/146754 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)
chelcassanova wrote: > I expect not because the compilation database only deals with sources, .cpp, > .cc etc. not headers. So it should be trying to load something like `compile_commands.json`? Which is in the root of the build dir so when the tool needs to load it's going to try and do some from the test dir which is not where that file would be. https://github.com/llvm/llvm-project/pull/138031 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adjust variable display values. (PR #146754)
jimingham wrote: Remember, running code is NOT a risk free operation. If I am stopped on a thread in code that has acquired a non-recursive lock A, and I run an expression by hand that ends up first successfully acquiring a lock B and then trying to acquire A, that expression will deadlock. The only thing lldb can do is interrupt it and tear down the expression stack. But that means that now lock B is permanently locked, nothing is ever going to release it, and your debug session is pretty much toast. So it is a feature we should use judiciously, and the best way to ensure that is to always make it an explicitly user-directed action. https://github.com/llvm/llvm-project/pull/146754 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adjust variable display values. (PR #146754)
jimingham wrote: There are exceptions to this, for instance we run functions automatically to gather the various Sanitizer report results. But those functions have been written with this use in mind, so they don't take locks or do anything that might be unsafe. https://github.com/llvm/llvm-project/pull/146754 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Improving 'variables' hover requests. (PR #146773)
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/146773 This partially fixes https://github.com/llvm/llvm-project/issues/146559. When hovering over variables while debugging with lldb-dap we are receiving hover requests that include symbols. For example, if you have: ``` MyClass *foo; ``` and hover over 'foo', the request will contain the expression `expression="*foo"` and we're evaluating the dereference, so you end up with different hover results vs the variables view. A more complete solution would be to implement an [EvaluatableExpressionProvider](https://code.visualstudio.com/api/references/vscode-api#EvaluatableExpressionProvider) in the VS Code extension. For example, if you have a declaration without any whitespace like ```c char*foo = "bar"; ``` And try to hover over 'foo', the request will be `expression="char*foo"`. >From 2674e5af817e1e6b06521c7b7f39b23150aed747 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Wed, 2 Jul 2025 13:05:31 -0700 Subject: [PATCH] [lldb-dap] Improving 'variables' hover requests. This partially fixes https://github.com/llvm/llvm-project/issues/146559. When hovering over variables while debugging with lldb-dap we are receiving hover requests that include symbols. For example, if you have: ``` MyClass *foo; ``` and hover over 'foo', the request will contain the expression `expression="*foo"` and we're evaluating the dereference, so you end up with different hover results vs the variables view. A more complete solution would be to implement an [EvaluatableExpressionProvider](https://code.visualstudio.com/api/references/vscode-api#EvaluatableExpressionProvider) in the VS Code extension. For example, if you have a declaration without any whitespace like ```c char*foo = "bar"; ``` And try to hover over 'foo', the request will be `expression="char*foo"`. --- lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py | 2 +- lldb/tools/lldb-dap/Handler/EvaluateRequestHandler.cpp | 10 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py index 55fb4a961e783..30ee7a1631e29 100644 --- a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py +++ b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py @@ -92,7 +92,7 @@ def test_readMemory(self): ) self.continue_to_next_stop() -ptr_deref = self.dap_server.request_evaluate("*rawptr")["body"] +ptr_deref = self.dap_server.request_evaluate("*rawptr", context="repl")["body"] memref = ptr_deref["memoryReference"] # We can read the complete string diff --git a/lldb/tools/lldb-dap/Handler/EvaluateRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/EvaluateRequestHandler.cpp index e1556846dff19..e2161eb999e82 100644 --- a/lldb/tools/lldb-dap/Handler/EvaluateRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/EvaluateRequestHandler.cpp @@ -181,7 +181,17 @@ void EvaluateRequestHandler::operator()( expression = dap.last_nonempty_var_expression; else dap.last_nonempty_var_expression = expression; +} else { + // If this isn't a REPL context, trim leading pointer/reference characters + // to ensure we return the actual value of the expression. + // This can come up if you hover over a pointer or reference declaration + // like 'MyType *foo;' or `void fn(std::string &arg)`, which results in + // the hover request sending '*foo' or `&arg`. When we're not in the REPL, + // we should trim these characters to get to the actual variable, which + // should have the proper type encoded by the compiler. + expression = llvm::StringRef(expression).ltrim("*&").str(); } + // Always try to get the answer from the local variables if possible. If // this fails, then if the context is not "hover", actually evaluate an // expression using the expression parser. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Improving 'variables' hover requests. (PR #146773)
https://github.com/ashgti edited https://github.com/llvm/llvm-project/pull/146773 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Improving 'variables' hover requests. (PR #146773)
https://github.com/ashgti ready_for_review https://github.com/llvm/llvm-project/pull/146773 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Improving 'variables' hover requests. (PR #146773)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: John Harrison (ashgti) Changes This partially fixes https://github.com/llvm/llvm-project/issues/146559. When hovering over variables while debugging with lldb-dap we are receiving hover requests that include symbols. For example, if you have: ``` MyClass *foo; ``` and hover over 'foo', the request will contain the expression `expression="*foo"` and we're evaluating the dereference, so you end up with different hover results vs the variables view. A more complete solution would be to implement an [EvaluatableExpressionProvider](https://code.visualstudio.com/api/references/vscode-api#EvaluatableExpressionProvider) in the VS Code extension. For example, if you have a declaration without any whitespace like ```c char*foo = "bar"; ``` And try to hover over 'foo', the request will be `expression="char*foo"`, which won't evaluate correctly in lldb. --- Full diff: https://github.com/llvm/llvm-project/pull/146773.diff 2 Files Affected: - (modified) lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py (+1-1) - (modified) lldb/tools/lldb-dap/Handler/EvaluateRequestHandler.cpp (+10) ``diff diff --git a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py index 55fb4a961e783..30ee7a1631e29 100644 --- a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py +++ b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py @@ -92,7 +92,7 @@ def test_readMemory(self): ) self.continue_to_next_stop() -ptr_deref = self.dap_server.request_evaluate("*rawptr")["body"] +ptr_deref = self.dap_server.request_evaluate("*rawptr", context="repl")["body"] memref = ptr_deref["memoryReference"] # We can read the complete string diff --git a/lldb/tools/lldb-dap/Handler/EvaluateRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/EvaluateRequestHandler.cpp index e1556846dff19..e2161eb999e82 100644 --- a/lldb/tools/lldb-dap/Handler/EvaluateRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/EvaluateRequestHandler.cpp @@ -181,7 +181,17 @@ void EvaluateRequestHandler::operator()( expression = dap.last_nonempty_var_expression; else dap.last_nonempty_var_expression = expression; +} else { + // If this isn't a REPL context, trim leading pointer/reference characters + // to ensure we return the actual value of the expression. + // This can come up if you hover over a pointer or reference declaration + // like 'MyType *foo;' or `void fn(std::string &arg)`, which results in + // the hover request sending '*foo' or `&arg`. When we're not in the REPL, + // we should trim these characters to get to the actual variable, which + // should have the proper type encoded by the compiler. + expression = llvm::StringRef(expression).ltrim("*&").str(); } + // Always try to get the answer from the local variables if possible. If // this fails, then if the context is not "hover", actually evaluate an // expression using the expression parser. `` https://github.com/llvm/llvm-project/pull/146773 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adjust variable display values. (PR #146754)
ashgti wrote: We can add a button to the variables UI or a context menu entry for running the description. I can switch to that instead. https://github.com/llvm/llvm-project/pull/146754 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adjust variable display values. (PR #146754)
https://github.com/ashgti converted_to_draft https://github.com/llvm/llvm-project/pull/146754 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits