diff options
author | Jim Ingham <jingham@apple.com> | 2011-09-15 01:08:57 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2011-09-15 01:08:57 +0000 |
commit | 31412642a6ac750440fb8b64a8a3cd39786c1c67 (patch) | |
tree | 8a2b08c8dea8d04265f8bde5f4ecee833c9e6d99 /lldb/source/Commands/CommandObjectProcess.cpp | |
parent | 3a769bd996470056b0d337c67f5339e596ea852f (diff) | |
download | llvm-31412642a6ac750440fb8b64a8a3cd39786c1c67.zip llvm-31412642a6ac750440fb8b64a8a3cd39786c1c67.tar.gz llvm-31412642a6ac750440fb8b64a8a3cd39786c1c67.tar.bz2 |
Change the "attach" command to always wait synchronously for the target to stop. It's not very useful to return the prompt in mid-attach, and it makes reporting the result of the attach hard to do.
llvm-svn: 139764
Diffstat (limited to 'lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectProcess.cpp | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 4a15ecd1..2f5c1b2 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -562,7 +562,9 @@ public: CommandReturnObject &result) { Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); - bool synchronous_execution = m_interpreter.GetSynchronous (); + // N.B. The attach should be synchronous. It doesn't help much to get the prompt back between initiating the attach + // and the target actually stopping. So even if the interpreter is set to be asynchronous, we wait for the stop + // ourselves here. Process *process = m_interpreter.GetExecutionContext().process; StateType state = eStateInvalid; @@ -671,19 +673,11 @@ public: // 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); + 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.SetStatus (eReturnStatusSuccessFinishNoResult); - } + result.SetDidChangeProcessState (true); + result.AppendMessageWithFormat ("Process %i %s\n", process->GetID(), StateAsCString (state)); + result.SetStatus (eReturnStatusSuccessFinishNoResult); } else { @@ -731,20 +725,11 @@ public: error.AsCString()); result.SetStatus (eReturnStatusFailed); } - // See comment for synchronous_execution above. - if (synchronous_execution) - { - StateType state = process->WaitForProcessToStop (NULL); + 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.SetStatus (eReturnStatusSuccessFinishNoResult); - } + result.SetDidChangeProcessState (true); + result.AppendMessageWithFormat ("Process %i %s\n", process->GetID(), StateAsCString (state)); + result.SetStatus (eReturnStatusSuccessFinishNoResult); } else { |