diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:55:28 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:55:28 +0000 | 
| commit | e81d9d49145e432d917eea3a70d2ae74dcad1d89 (patch) | |
| tree | 9ed5e1a91f242e2cb5911577356e487a55c01b78 /source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | |
| parent | 85d8ef8f1f0e0e063a8571944302be2d2026f823 (diff) | |
Notes
Diffstat (limited to 'source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp')
| -rw-r--r-- | source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | 105 | 
1 files changed, 10 insertions, 95 deletions
| diff --git a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index 698854e5dfbd..7f876fb393d9 100644 --- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -58,8 +58,6 @@ using namespace lldb_private::process_gdb_remote;  //----------------------------------------------------------------------  GDBRemoteCommunicationServerCommon::GDBRemoteCommunicationServerCommon(const char *comm_name, const char *listener_name) :      GDBRemoteCommunicationServer (comm_name, listener_name), -    m_spawned_pids (), -    m_spawned_pids_mutex (Mutex::eMutexTypeRecursive),      m_process_launch_info (),      m_process_launch_error (),      m_proc_infos (), @@ -79,8 +77,6 @@ GDBRemoteCommunicationServerCommon::GDBRemoteCommunicationServerCommon(const cha                                    &GDBRemoteCommunicationServerCommon::Handle_qGroupName);      RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_qHostInfo,                                    &GDBRemoteCommunicationServerCommon::Handle_qHostInfo); -    RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_qKillSpawnedProcess, -                                  &GDBRemoteCommunicationServerCommon::Handle_qKillSpawnedProcess);      RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_QLaunchArch,                                    &GDBRemoteCommunicationServerCommon::Handle_QLaunchArch);      RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_qLaunchSuccess, @@ -185,14 +181,20 @@ GDBRemoteCommunicationServerCommon::Handle_qHostInfo (StringExtractorGDBRemote &      else          response.Printf("watchpoint_exceptions_received:after;");  #else -    if (host_arch.GetMachine() == llvm::Triple::mips64 || -        host_arch.GetMachine() == llvm::Triple::mips64el) +    if (host_arch.GetMachine() == llvm::Triple::aarch64 || +        host_arch.GetMachine() == llvm::Triple::aarch64_be || +        host_arch.GetMachine() == llvm::Triple::arm || +        host_arch.GetMachine() == llvm::Triple::armeb || +        host_arch.GetMachine() == llvm::Triple::mips64 || +        host_arch.GetMachine() == llvm::Triple::mips64el || +        host_arch.GetMachine() == llvm::Triple::mips || +        host_arch.GetMachine() == llvm::Triple::mipsel)          response.Printf("watchpoint_exceptions_received:before;");      else          response.Printf("watchpoint_exceptions_received:after;");  #endif -    switch (lldb::endian::InlHostByteOrder()) +    switch (endian::InlHostByteOrder())      {      case eByteOrderBig:     response.PutCString ("endian:big;"); break;      case eByteOrderLittle:  response.PutCString ("endian:little;"); break; @@ -485,94 +487,6 @@ GDBRemoteCommunicationServerCommon::Handle_qSpeedTest (StringExtractorGDBRemote  }  GDBRemoteCommunication::PacketResult -GDBRemoteCommunicationServerCommon::Handle_qKillSpawnedProcess (StringExtractorGDBRemote &packet) -{ -    packet.SetFilePos(::strlen ("qKillSpawnedProcess:")); - -    lldb::pid_t pid = packet.GetU64(LLDB_INVALID_PROCESS_ID); - -    // verify that we know anything about this pid. -    // Scope for locker -    { -        Mutex::Locker locker (m_spawned_pids_mutex); -        if (m_spawned_pids.find(pid) == m_spawned_pids.end()) -        { -            // not a pid we know about -            return SendErrorResponse (10); -        } -    } - -    // go ahead and attempt to kill the spawned process -    if (KillSpawnedProcess (pid)) -        return SendOKResponse (); -    else -        return SendErrorResponse (11); -} - -bool -GDBRemoteCommunicationServerCommon::KillSpawnedProcess (lldb::pid_t pid) -{ -    // make sure we know about this process -    { -        Mutex::Locker locker (m_spawned_pids_mutex); -        if (m_spawned_pids.find(pid) == m_spawned_pids.end()) -            return false; -    } - -    // first try a SIGTERM (standard kill) -    Host::Kill (pid, SIGTERM); - -    // check if that worked -    for (size_t i=0; i<10; ++i) -    { -        { -            Mutex::Locker locker (m_spawned_pids_mutex); -            if (m_spawned_pids.find(pid) == m_spawned_pids.end()) -            { -                // it is now killed -                return true; -            } -        } -        usleep (10000); -    } - -    // check one more time after the final usleep -    { -        Mutex::Locker locker (m_spawned_pids_mutex); -        if (m_spawned_pids.find(pid) == m_spawned_pids.end()) -            return true; -    } - -    // the launched process still lives.  Now try killing it again, -    // this time with an unblockable signal. -    Host::Kill (pid, SIGKILL); - -    for (size_t i=0; i<10; ++i) -    { -        { -            Mutex::Locker locker (m_spawned_pids_mutex); -            if (m_spawned_pids.find(pid) == m_spawned_pids.end()) -            { -                // it is now killed -                return true; -            } -        } -        usleep (10000); -    } - -    // check one more time after the final usleep -    // Scope for locker -    { -        Mutex::Locker locker (m_spawned_pids_mutex); -        if (m_spawned_pids.find(pid) == m_spawned_pids.end()) -            return true; -    } - -    // no luck - the process still lives -    return false; -} - -GDBRemoteCommunication::PacketResult  GDBRemoteCommunicationServerCommon::Handle_vFile_Open (StringExtractorGDBRemote &packet)  {      packet.SetFilePos(::strlen("vFile:open:")); @@ -1299,6 +1213,7 @@ GDBRemoteCommunicationServerCommon::CreateProcessInfoResponse_DebugServerStyle (              switch (proc_triple.getArch ())              {                  case llvm::Triple::arm: +                case llvm::Triple::thumb:                  case llvm::Triple::aarch64:                      ostype = "ios";                      break; | 
