Don't retry the Connect when starting up debugserver if the reason for the previous failure was
EINTR.  That means the user was trying to interrupt us, and we should just stop instead.

<rdar://problem/13184758>


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@183577 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/lldb/Core/Error.h b/include/lldb/Core/Error.h
index c48add8..9e45d5f 100644
--- a/include/lldb/Core/Error.h
+++ b/include/lldb/Core/Error.h
@@ -283,6 +283,19 @@
     //------------------------------------------------------------------
     bool
     Success () const;
+    
+    //------------------------------------------------------------------
+    /// Test for a failure due to a generic interrupt.
+    ///
+    /// Returns true if the error code in this object was caused by an interrupt.
+    /// At present only supports Posix EINTR.
+    ///
+    /// @return
+    ///     \b true if this object contains an value that describes
+    ///     failure due to interrupt, \b false otherwise.
+    //------------------------------------------------------------------
+    bool
+    WasInterrupted() const;
 
 protected:
     //------------------------------------------------------------------
diff --git a/source/Core/Error.cpp b/source/Core/Error.cpp
index 4f8c266..e29f12f 100644
--- a/source/Core/Error.cpp
+++ b/source/Core/Error.cpp
@@ -387,3 +387,13 @@
 {
     return m_code == 0;
 }
+
+bool
+Error::WasInterrupted() const
+{
+    if (m_type == eErrorTypePOSIX && m_code == EINTR)
+        return true;
+    else
+        return false;
+}
+
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 9123804..fab0e65 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -744,8 +744,14 @@
                 m_gdb_comm.SetConnection (conn_ap.release());
                 break;
             }
+            else if (error.WasInterrupted())
+            {
+                // If we were interrupted, don't keep retrying.
+                break;
+            }
+            
             retry_count++;
-
+            
             if (retry_count >= max_retry_count)
                 break;