[Lldb-commits] [lldb] r139764 - /lldb/trunk/source/Commands/CommandObjectProcess.cpp
Jim Ingham
jingham at apple.com
Wed Sep 14 18:08:57 PDT 2011
Author: jingham
Date: Wed Sep 14 20:08:57 2011
New Revision: 139764
URL: http://llvm.org/viewvc/llvm-project?rev=139764&view=rev
Log:
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.
Modified:
lldb/trunk/source/Commands/CommandObjectProcess.cpp
Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=139764&r1=139763&r2=139764&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Wed Sep 14 20:08:57 2011
@@ -562,7 +562,9 @@
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 @@
// 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 @@
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
{
More information about the lldb-commits
mailing list