llgs: fix Ctrl-C inferior interrupt handling to do the right thing.

* Sends a SIGSTOP to the process.
* Fixes busted SIGSTOP handling.  Now builds a list of non-stopped
  that we wait for the PTRACE group-stop for.  When the final must-stop
  tid gets its group stop, we propagate the process state change.
  Only the signal receiving the notification of the pending SIGSTOP
  is marked with the SIGSTOP signal.  All the rest, if they weren't
  already stopped, are marked as stopped with signal 0.
* Fixes a few broken tests.
* Marks the Linux test I added earlier as expect-pass (no longer XFAIL).

Implements fix for http://llvm.org/bugs/show_bug.cgi?id=20908.

llvm-svn: 217647
diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp
index b7a7726..e192f19 100644
--- a/lldb/source/Host/common/NativeProcessProtocol.cpp
+++ b/lldb/source/Host/common/NativeProcessProtocol.cpp
@@ -13,6 +13,7 @@
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/State.h"
+#include "lldb/Host/Host.h"
 #include "lldb/Target/NativeRegisterContext.h"
 
 #include "NativeThreadProtocol.h"
@@ -44,6 +45,18 @@
 }
 
 lldb_private::Error
+NativeProcessProtocol::Interrupt ()
+{
+    Error error;
+#if !defined (SIGSTOP)
+    error.SetErrorString ("local host does not support signaling");
+    return error;
+#else
+    return Signal (SIGSTOP);
+#endif
+}
+
+lldb_private::Error
 NativeProcessProtocol::GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info)
 {
     // Default: not implemented.
@@ -110,9 +123,8 @@
 }
 
 NativeThreadProtocolSP
-NativeProcessProtocol::GetThreadByID (lldb::tid_t tid)
+NativeProcessProtocol::GetThreadByIDUnlocked (lldb::tid_t tid)
 {
-    Mutex::Locker locker (m_threads_mutex);
     for (auto thread_sp : m_threads)
     {
         if (thread_sp->GetID() == tid)
@@ -121,6 +133,13 @@
     return NativeThreadProtocolSP ();
 }
 
+NativeThreadProtocolSP
+NativeProcessProtocol::GetThreadByID (lldb::tid_t tid)
+{
+    Mutex::Locker locker (m_threads_mutex);
+    return GetThreadByIDUnlocked (tid);
+}
+
 bool
 NativeProcessProtocol::IsAlive () const
 {