Skip to content

Commit aed179f

Browse files
committed
[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
1 parent 1896df1 commit aed179f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,10 @@ Status NativeProcessFreeBSD::Resume(const ResumeActionList &resume_actions) {
497497
Status NativeProcessFreeBSD::Halt() {
498498
Status error;
499499

500+
// Do not try to stop a process that's already stopped, this may cause
501+
// the SIGSTOP to get queued and stop the process again once resumed.
502+
if (StateIsStoppedState(m_state, false))
503+
return error;
500504
if (kill(GetID(), SIGSTOP) != 0)
501505
error.SetErrorToErrno();
502506
return error;

0 commit comments

Comments
 (0)