Author: Dmitry Vasilyev Date: 2024-07-21T15:59:41+04:00 New Revision: f6eb89cdd02d73a3c9a0da858c3100986282aceb
URL: https://github.com/llvm/llvm-project/commit/f6eb89cdd02d73a3c9a0da858c3100986282aceb DIFF: https://github.com/llvm/llvm-project/commit/f6eb89cdd02d73a3c9a0da858c3100986282aceb.diff LOG: [lldb][Windows] Fixed Host::Kill() (#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. This patch fixes #51793 Added: Modified: lldb/source/Host/windows/Host.cpp lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py Removed: ################################################################################ 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; } diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py b/lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py index 46cda4d66b488..430f1871d3b30 100644 --- a/lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py +++ b/lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py @@ -8,7 +8,6 @@ class TestPlatformKill(GDBRemoteTestBase): @skipIfRemote - @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr52451") def test_kill_ diff erent_platform(self): """Test connecting to a remote linux platform""" _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits