summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectProcess.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2011-01-29 01:49:25 +0000
committerJim Ingham <jingham@apple.com>2011-01-29 01:49:25 +0000
commitbb3a283b3e8bc2cc4157ef1b73b7d5e6cda40775 (patch)
tree4890e20c8264e99f4def0d2265ed4d8c9c0fe3d6 /lldb/source/Commands/CommandObjectProcess.cpp
parentd4eff314760090c196bf90ea7d750f322ed849da (diff)
downloadbcm5719-llvm-bb3a283b3e8bc2cc4157ef1b73b7d5e6cda40775.tar.gz
bcm5719-llvm-bb3a283b3e8bc2cc4157ef1b73b7d5e6cda40775.zip
Added a completion action class to the Process events so that we can make things like Attach and later Launch start their job, and then return to the event loop while waiting for the work to be done.
llvm-svn: 124520
Diffstat (limited to 'lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 5239b7bf2d6..42bc4af3bb2 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -536,7 +536,8 @@ public:
CommandReturnObject &result)
{
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
-
+ bool synchronous_execution = m_interpreter.GetSynchronous ();
+
Process *process = m_interpreter.GetDebugger().GetExecutionContext().process;
if (process)
{
@@ -636,6 +637,24 @@ public:
result.SetStatus (eReturnStatusFailed);
return false;
}
+ // If we're synchronous, wait for the stopped event and report that.
+ // Otherwise just return.
+ // FIXME: in the async case it will now be possible to get to the command
+ // interpreter with a state eStateAttaching. Make sure we handle that correctly.
+ if (synchronous_execution)
+ {
+ StateType state = process->WaitForProcessToStop (NULL);
+
+ result.SetDidChangeProcessState (true);
+ result.AppendMessageWithFormat ("Process %i %s\n", process->GetID(), StateAsCString (state));
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
+ }
+ else
+ {
+ result.SetDidChangeProcessState (true);
+ result.AppendMessageWithFormat ("Starting to attach to process.");
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
+ }
}
else
{
@@ -681,6 +700,21 @@ public:
error.AsCString());
result.SetStatus (eReturnStatusFailed);
}
+ // See comment for synchronous_execution above.
+ if (synchronous_execution)
+ {
+ StateType state = process->WaitForProcessToStop (NULL);
+
+ result.SetDidChangeProcessState (true);
+ result.AppendMessageWithFormat ("Process %i %s\n", process->GetID(), StateAsCString (state));
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
+ }
+ else
+ {
+ result.SetDidChangeProcessState (true);
+ result.AppendMessageWithFormat ("Starting to attach to process.");
+ result.SetStatus (eReturnStatusSuccessFinishNoResult);
+ }
}
else
{
OpenPOWER on IntegriCloud