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
This commit is contained in:
Todd Fiala
2014-09-11 23:29:14 +00:00
parent 3d7260e7b2
commit 511e5cdce4
9 changed files with 271 additions and 55 deletions

View File

@@ -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"
@@ -43,6 +44,18 @@ NativeProcessProtocol::NativeProcessProtocol (lldb::pid_t pid) :
{
}
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)
{
@@ -110,9 +123,8 @@ NativeProcessProtocol::GetThreadAtIndex (uint32_t idx)
}
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 @@ NativeProcessProtocol::GetThreadByID (lldb::tid_t tid)
return NativeThreadProtocolSP ();
}
NativeThreadProtocolSP
NativeProcessProtocol::GetThreadByID (lldb::tid_t tid)
{
Mutex::Locker locker (m_threads_mutex);
return GetThreadByIDUnlocked (tid);
}
bool
NativeProcessProtocol::IsAlive () const
{