https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/99721
HostProcessWindows::Terminate() correctly uses m_process which type is process_t (HANDLE) to call ::TerminateProcess(). But Host::Kill() uses a cast from pid, which is wrong. >From 0712380a0ef60fae0a3035ac1e572bf9b1ea3bae Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev <dvassil...@accesssoftek.com> Date: Sat, 20 Jul 2024 03:48:12 +0400 Subject: [PATCH] [lldb][Windows] Fixed Host::Kill() HostProcessWindows::Terminate() correctly uses m_process which type is process_t (HANDLE) to call ::TerminateProcess(). But Host::Kill() uses a cast from pid, which is wrong. --- lldb/source/Host/windows/Host.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lldb/source/Host/windows/Host.cpp b/lldb/source/Host/windows/Host.cpp index 6908f0003eaf7..642092f61d924 100644 --- a/lldb/source/Host/windows/Host.cpp +++ b/lldb/source/Host/windows/Host.cpp @@ -103,7 +103,9 @@ lldb::thread_t Host::GetCurrentThread() { } void Host::Kill(lldb::pid_t pid, int signo) { - TerminateProcess((HANDLE)pid, 1); + AutoHandle handle(::OpenProcess(PROCESS_TERMINATE, FALSE, pid), nullptr); + if (handle.IsValid()) + ::TerminateProcess(handle.get(), 1); } const char *Host::GetSignalAsCString(int signo) { return NULL; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits