rdar://problem/11140741

For "process attach", make the success criterion as the inferior changes its state to eStateStopped.
Otherwise, mark it as a failure and say so.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157036 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectProcess.cpp b/source/Commands/CommandObjectProcess.cpp
index 0dbf54f..3958af5 100644
--- a/source/Commands/CommandObjectProcess.cpp
+++ b/source/Commands/CommandObjectProcess.cpp
@@ -541,8 +541,18 @@
                     StateType state = process->WaitForProcessToStop (NULL);
                     
                     result.SetDidChangeProcessState (true);
-                    result.AppendMessageWithFormat ("Process %llu %s\n", process->GetID(), StateAsCString (state));
-                    result.SetStatus (eReturnStatusSuccessFinishNoResult);
+
+                    if (state == eStateStopped)
+                    {
+                        result.AppendMessageWithFormat ("Process %llu %s\n", process->GetID(), StateAsCString (state));
+                        result.SetStatus (eReturnStatusSuccessFinishNoResult);
+                    }
+                    else
+                    {
+                        result.AppendError ("attach failed: process did not stop (no such process or permission problem?)");
+                        result.SetStatus (eReturnStatusFailed);
+                        return false;                
+                    }
                 }
             }
         }