Skip to content

[lldb] Fix compilation errors from #138896 #139711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025
Merged

[lldb] Fix compilation errors from #138896 #139711

merged 1 commit into from
May 13, 2025

Conversation

labath
Copy link
Collaborator

@labath labath commented May 13, 2025

  • s/size_t/SIZE_T to match the windows API
  • case HANDLE to int64_t to avoid cast-to-int-of-different-size errors/warnings

@labath labath requested review from mstorsjo and slydiman May 13, 2025 11:30
@labath labath requested a review from JDevlieghere as a code owner May 13, 2025 11:30
@llvmbot llvmbot added the lldb label May 13, 2025
@llvmbot
Copy link
Member

llvmbot commented May 13, 2025

@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)

Changes
  • s/size_t/SIZE_T to match the windows API
  • case HANDLE to int64_t to avoid cast-to-int-of-different-size errors/warnings

Full diff: https://github.com/llvm/llvm-project/pull/139711.diff

3 Files Affected:

  • (modified) lldb/source/Host/windows/ProcessLauncherWindows.cpp (+1-1)
  • (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (+1-1)
  • (modified) lldb/tools/lldb-server/lldb-platform.cpp (+2-2)
diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
index bc35667ea9a23..f5adadaf061bf 100644
--- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp
+++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
@@ -99,7 +99,7 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
   if (startupinfo.hStdOutput)
     inherited_handles.push_back(startupinfo.hStdOutput);
 
-  size_t attributelist_size = 0;
+  SIZE_T attributelist_size = 0;
   InitializeProcThreadAttributeList(/*lpAttributeList=*/nullptr,
                                     /*dwAttributeCount=*/1, /*dwFlags=*/0,
                                     &attributelist_size);
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 332b9255f226f..b37b35d3a50f8 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -924,7 +924,7 @@ Status GDBRemoteCommunication::StartDebugserverProcess(
     debugserver_args.AppendArgument(fd_arg.GetString());
     // Send "pass_comm_fd" down to the inferior so it can use it to
     // communicate back with this process. Ignored on Windows.
-    launch_info.AppendDuplicateFileAction((int)pass_comm_fd, (int)pass_comm_fd);
+    launch_info.AppendDuplicateFileAction((int64_t)pass_comm_fd, (int64_t)pass_comm_fd);
   }
 
   // use native registers, not the GDB registers
diff --git a/lldb/tools/lldb-server/lldb-platform.cpp b/lldb/tools/lldb-server/lldb-platform.cpp
index 5b0a8ade01025..37ec8455c63a7 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -274,8 +274,8 @@ static Status spawn_process(const char *progname, const FileSpec &prog,
   self_args.AppendArgument(llvm::StringRef("platform"));
   self_args.AppendArgument(llvm::StringRef("--child-platform-fd"));
   self_args.AppendArgument(llvm::to_string(shared_socket.GetSendableFD()));
-  launch_info.AppendDuplicateFileAction((int)shared_socket.GetSendableFD(),
-                                        (int)shared_socket.GetSendableFD());
+  launch_info.AppendDuplicateFileAction((int64_t)shared_socket.GetSendableFD(),
+                                        (int64_t)shared_socket.GetSendableFD());
   if (gdb_port) {
     self_args.AppendArgument(llvm::StringRef("--gdbserver-port"));
     self_args.AppendArgument(llvm::to_string(gdb_port));

Copy link

github-actions bot commented May 13, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

- s/size_t/SIZE_T to match the windows API
- case HANDLE to int64_t to avoid cast-to-int-of-different-size
  errors/warnings
Copy link
Member

@mstorsjo mstorsjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! I can confirm that this fixes compilation on mingw targets, on both 32 and 64 bit.

@labath labath merged commit 89826f0 into llvm:main May 13, 2025
8 of 9 checks passed
@labath labath deleted the win branch May 13, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants