Make the "synchronous" mode actually work without race conditions.

There were many issues with synchronous mode that we discovered when started to try and add a "batch" mode. There was a race condition where the event handling thread might consume events when in sync mode and other times the Process::WaitForProcessToStop() would consume them. This also led to places where the Process IO handler might or might not get popped when it needed to be.

llvm-svn: 220254
This commit is contained in:
Greg Clayton
2014-10-21 01:00:42 +00:00
parent f16a66973c
commit dc6224e0a3
13 changed files with 355 additions and 248 deletions

View File

@@ -710,15 +710,11 @@ SBThread::ResumeNewPlan (ExecutionContext &exe_ctx, ThreadPlan *new_plan)
// Why do we need to set the current thread by ID here???
process->GetThreadList().SetSelectedThreadByID (thread->GetID());
sb_error.ref() = process->Resume();
if (sb_error.Success())
{
// If we are doing synchronous mode, then wait for the
// process to stop yet again!
if (process->GetTarget().GetDebugger().GetAsyncExecution () == false)
process->WaitForProcessToStop (NULL);
}
if (process->GetTarget().GetDebugger().GetAsyncExecution ())
sb_error.ref() = process->Resume ();
else
sb_error.ref() = process->ResumeSynchronous (NULL);
return sb_error;
}