From 741c80c0b18252702c7a922837c852536300ed13 Mon Sep 17 00:00:00 2001 From: Nicolas Miller Date: Fri, 28 Nov 2025 16:06:14 +0000 Subject: [PATCH 1/2] [lldb-dap] Fix format string on Mac OS On Mac `unsigned long long` corresponds to `uint64_t` so `%llu` is needed. Simply always using `%llu` and upcasting to `unsigned long long` should make it work fine. --- lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp index 24c0ca2111f40..3e7de5d055837 100644 --- a/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp @@ -87,8 +87,8 @@ Error AttachRequestHandler::Run(const AttachRequestArguments &args) const { // Use the unique target ID to get the target. target = dap.debugger.FindTargetByGloballyUniqueID(*target_id); if (!target.IsValid()) { - error.SetErrorStringWithFormat("invalid target_id %lu in attach config", - *target_id); + error.SetErrorStringWithFormat("invalid target_id %llu in attach config", + (unsigned long long)*target_id); } } else { target = dap.CreateTarget(error); From a2a40773b00c20f68e5c1df577a9dd44ec0a5329 Mon Sep 17 00:00:00 2001 From: Nicolas Miller Date: Tue, 2 Dec 2025 09:58:17 +0000 Subject: [PATCH 2/2] [lldb-dap] Use llvm::formatv for error string formatting Co-authored-by: Jonas Devlieghere --- lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp index 3e7de5d055837..f0996eb3ff0f4 100644 --- a/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp @@ -87,8 +87,10 @@ Error AttachRequestHandler::Run(const AttachRequestArguments &args) const { // Use the unique target ID to get the target. target = dap.debugger.FindTargetByGloballyUniqueID(*target_id); if (!target.IsValid()) { - error.SetErrorStringWithFormat("invalid target_id %llu in attach config", - (unsigned long long)*target_id); + error.SetErrorString( + llvm::formatv("invalid target_id {0} in attach config", *target_id) + .str() + .c_str()); } } else { target = dap.CreateTarget(error);