[Lldb-commits] [PATCH] D126770: [lldb] [Process/FreeBSD] Do not send SIGSTOP to stopped process

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 1 04:45:44 PDT 2022


mgorny created this revision.
mgorny added reviewers: labath, krytarowski, emaste.
Herald added a subscriber: arichardson.
Herald added a project: All.
mgorny requested review of this revision.

Do not send SIGSTOP when requested to halt a process that's already
stopped.  This results in the signal being queued for delivery once
the process is resumed, and unexpectedly stopping it again.

This fixes TestBreakpointSetRestart failure right now, and is necessary
for non-stop protocol patches to land.

Sponsored by: The FreeBSD Foundation


https://reviews.llvm.org/D126770

Files:
  lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp


Index: lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
===================================================================
--- lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
+++ lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
@@ -497,6 +497,10 @@
 Status NativeProcessFreeBSD::Halt() {
   Status error;
 
+  // Do not try to stop a process that's already stopped, this may cause
+  // the SIGSTOP to get queued and stop the process again once resumed.
+  if (StateIsStoppedState(m_state, false))
+    return error;
   if (kill(GetID(), SIGSTOP) != 0)
     error.SetErrorToErrno();
   return error;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126770.433355.patch
Type: text/x-patch
Size: 638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220601/ecd6d87c/attachment.bin>


More information about the lldb-commits mailing list