[Lldb-commits] [PATCH] D113184: [lldb] Fix cross-platform kills

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 4 05:35:17 PDT 2021


labath created this revision.
labath added reviewers: JDevlieghere, jingham.
labath requested review of this revision.
Herald added a project: LLDB.

This patch fixes an amusing bug where a Platform::Kill operation would
happily terminate a proces on a completely different platform, as long
as they have the same process ID. This was due to the fact that the
implementation was iterating through all known (debugged) processes in
order terminate them directly.

This patch just deletes that logic, and makes everything go through the
OS process termination APIs. While it would be possible to fix the logic
to check for a platform match, it seemed to me that the implementation
was being too smart for its own good -- accessing random Process
objects without knowing anything about their state is risky at best.
Going through the os ensures we avoid any races.

I also "upgrade" the termination signal to a SIGKILL to ensure the
process really dies after this operation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113184

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/source/Target/Platform.cpp
  lldb/test/API/functionalities/gdb_remote_client/Makefile
  lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py
  lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
  lldb/test/API/functionalities/gdb_remote_client/sleep.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113184.384719.patch
Type: text/x-patch
Size: 4996 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211104/fa69a768/attachment-0001.bin>


More information about the lldb-commits mailing list