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

Michał Górny via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 3 06:19:24 PDT 2022


Author: Michał Górny
Date: 2022-06-03T15:19:09+02:00
New Revision: aed179f5f557664d6deb26ef6fdc6aa944af41af

URL: https://github.com/llvm/llvm-project/commit/aed179f5f557664d6deb26ef6fdc6aa944af41af
DIFF: https://github.com/llvm/llvm-project/commit/aed179f5f557664d6deb26ef6fdc6aa944af41af.diff

LOG: [lldb] [Process/FreeBSD] Do not send SIGSTOP to stopped process

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 is necessary for non-stop protocol patches to land.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D126770

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
index 21c9ead0eca41..5d73ec3457e37 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
@@ -497,6 +497,10 @@ Status NativeProcessFreeBSD::Resume(const ResumeActionList &resume_actions) {
 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;


        


More information about the lldb-commits mailing list