[Lldb-commits] [lldb] [lldb-dap] Fix format string on Mac OS (PR #169933)

Nicolas Miller via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 28 08:16:46 PST 2025


https://github.com/npmiller created https://github.com/llvm/llvm-project/pull/169933

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.

>From 3ba244c0b68902eb4b158429cb63d92f37dcf2b0 Mon Sep 17 00:00:00 2001
From: Nicolas Miller <nmiller at modular.com>
Date: Fri, 28 Nov 2025 16:06:14 +0000
Subject: [PATCH] [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);



More information about the lldb-commits mailing list