Skip to content

Commit f6eb89c

Browse files
authored
[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
1 parent cbebace commit f6eb89c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lldb/source/Host/windows/Host.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ lldb::thread_t Host::GetCurrentThread() {
103103
}
104104

105105
void Host::Kill(lldb::pid_t pid, int signo) {
106-
TerminateProcess((HANDLE)pid, 1);
106+
AutoHandle handle(::OpenProcess(PROCESS_TERMINATE, FALSE, pid), nullptr);
107+
if (handle.IsValid())
108+
::TerminateProcess(handle.get(), 1);
107109
}
108110

109111
const char *Host::GetSignalAsCString(int signo) { return NULL; }

lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
class TestPlatformKill(GDBRemoteTestBase):
1010
@skipIfRemote
11-
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr52451")
1211
def test_kill_different_platform(self):
1312
"""Test connecting to a remote linux platform"""
1413

0 commit comments

Comments
 (0)