user_debugger: Adjust handling of continue request.

- B_DEBUG_MESSAGE_CONTINUE_THREAD now checks if the thread in question
  is in a suspended state rather than waiting on the debug nub port, and
  if so, handles resuming it automatically. This allows the continue message
  to be used on the main thread of a team that was freshly created under
  debug control without the API user having to be cognizant of the distinction.
This commit is contained in:
Rene Gollent
2015-07-31 17:28:00 -04:00
parent 20ed88dd96
commit 27dec4bb1e
+13
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2005-2011, Ingo Weinhold, [email protected].
* Copyright 2015, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License.
*/
@@ -1854,6 +1855,18 @@ debug_nub_thread(void *)
result = write_port(threadDebugPort,
B_DEBUGGED_THREAD_MESSAGE_CONTINUE,
&commandMessage, sizeof(commandMessage));
} else if (result == B_BAD_THREAD_STATE) {
Thread* thread = Thread::GetAndLock(threadID);
if (thread == NULL)
break;
BReference<Thread> threadReference(thread, true);
ThreadLocker threadLocker(thread, true);
if (thread->state == B_THREAD_SUSPENDED) {
threadLocker.Unlock();
resume_thread(threadID);
break;
}
}
break;