summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Process.cpp
diff options
context:
space:
mode:
authorDaniel Malea <daniel.malea@gmail.com>2013-10-09 16:56:28 +0000
committerDaniel Malea <daniel.malea@gmail.com>2013-10-09 16:56:28 +0000
commit9e9919f0431cc2ddc297813bdb772c776d14281c (patch)
tree9fc64172e8c060981cd91d805054733d2f4fdd3c /lldb/source/Target/Process.cpp
parenta25c79e7045fa1d92e9777a3dce8902a7963eb4c (diff)
downloadbcm5719-llvm-9e9919f0431cc2ddc297813bdb772c776d14281c.tar.gz
bcm5719-llvm-9e9919f0431cc2ddc297813bdb772c776d14281c.zip
Allow Process::WaitForProcessToStop to return immediately if process is already in the stopped state
- By default, the above function will wait for at least one event - Set wait_always=false to make the function return immediately if the process is already stopped llvm-svn: 192301
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r--lldb/source/Target/Process.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 3c9fea377e9..93159fcae99 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1230,7 +1230,7 @@ Process::GetNextEvent (EventSP &event_sp)
StateType
-Process::WaitForProcessToStop (const TimeValue *timeout, lldb::EventSP *event_sp_ptr)
+Process::WaitForProcessToStop (const TimeValue *timeout, lldb::EventSP *event_sp_ptr, bool wait_always)
{
// We can't just wait for a "stopped" event, because the stopped event may have restarted the target.
// We have to actually check each event, and in the case of a stopped event check the restarted flag
@@ -1243,6 +1243,19 @@ Process::WaitForProcessToStop (const TimeValue *timeout, lldb::EventSP *event_sp
if (state == eStateDetached || state == eStateExited)
return state;
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
+ if (log)
+ log->Printf ("Process::%s (timeout = %p)", __FUNCTION__, timeout);
+
+ if (!wait_always &&
+ StateIsStoppedState(state, true) &&
+ StateIsStoppedState(GetPrivateState(), true)) {
+ if (log)
+ log->Printf("Process::%s returning without waiting for events; process private and public states are already 'stopped'.",
+ __FUNCTION__);
+ return state;
+ }
+
while (state != eStateInvalid)
{
EventSP event_sp;
OpenPOWER on IntegriCloud