[Lldb-commits] [lldb] r200226 - Fix group stop signal handling issue on Linux.
Todd Fiala
tfiala at google.com
Mon Jan 27 09:03:57 PST 2014
Author: tfiala
Date: Mon Jan 27 11:03:57 2014
New Revision: 200226
URL: http://llvm.org/viewvc/llvm-project?rev=200226&view=rev
Log:
Fix group stop signal handling issue on Linux.
This patch addresses a bug where in a multi-threaded program a new
signal from the inferior may be received before all group-stop
messages from an earlier signal have been handled.
Patch by Andrew MacPherson
Modified:
lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=200226&r1=200225&r2=200226&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Mon Jan 27 11:03:57 2014
@@ -1798,14 +1798,23 @@ ProcessMonitor::StopThread(lldb::tid_t t
int ptrace_err;
if (!GetSignalInfo(wait_pid, &info, ptrace_err))
{
- if (log)
+ // another signal causing a StopAllThreads may have been received
+ // before wait_pid's group-stop was processed, handle it now
+ if (ptrace_err == EINVAL)
{
- log->Printf ("ProcessMonitor::%s() GetSignalInfo failed.", __FUNCTION__);
+ assert(WIFSTOPPED(status) && WSTOPSIG(status) == SIGSTOP);
- // This would be a particularly interesting case
- if (ptrace_err == EINVAL)
- log->Printf ("ProcessMonitor::%s() in group-stop", __FUNCTION__);
+ if (log)
+ log->Printf ("ProcessMonitor::%s() resuming from group-stop", __FUNCTION__);
+ // inferior process is in 'group-stop', so deliver SIGSTOP signal
+ if (!Resume(wait_pid, SIGSTOP)) {
+ assert(0 && "SIGSTOP delivery failed while in 'group-stop' state");
+ }
+ continue;
}
+
+ if (log)
+ log->Printf ("ProcessMonitor::%s() GetSignalInfo failed.", __FUNCTION__);
return false;
}
More information about the lldb-commits
mailing list