diff options
Diffstat (limited to 'lldb/source/Plugins/Process')
12 files changed, 29 insertions, 26 deletions
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp index c1d9f955159..8fc3692c261 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp @@ -151,7 +151,7 @@ CommunicationKDP::SendRequestPacketNoLock (const PacketStreamType &request_packe } bool -CommunicationKDP::GetSequenceMutex (Mutex::Locker& locker) +CommunicationKDP::TryLockSequenceMutex (Mutex::Locker& locker) { return locker.TryLock (m_sequence_mutex.GetMutex()); } diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h index db1e02f605f..728cddd995d 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h @@ -102,7 +102,7 @@ public: uint32_t usec); bool - GetSequenceMutex(lldb_private::Mutex::Locker& locker); + TryLockSequenceMutex(lldb_private::Mutex::Locker& locker); bool CheckForPacket (const uint8_t *src, diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp index 1db2d842dd8..45ed9b5f854 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -301,7 +301,7 @@ ProcessKDP::DoResume () return error; } -uint32_t +bool ProcessKDP::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_thread_list) { // locker will keep a mutex locked until it goes out of scope @@ -323,7 +323,7 @@ ProcessKDP::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_threa thread_sp.reset(new ThreadKDP (shared_from_this(), tid)); new_thread_list.AddThread(thread_sp); } - return new_thread_list.GetSize(false); + return new_thread_list.GetSize(false) > 0; } diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h index bfdea7bcc0f..297d854cd9c 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h @@ -231,7 +231,7 @@ protected: void Clear ( ); - uint32_t + virtual bool UpdateThreadList (lldb_private::ThreadList &old_thread_list, lldb_private::ThreadList &new_thread_list); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 5b589dce795..caa70258e30 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -201,10 +201,7 @@ GDBRemoteCommunication::SendPacketNoLock (const char *payload, size_t payload_le // logs all of the packet will set a boolean so that we don't dump this more // than once if (!m_history.DidDumpToLog ()) - { - DumpHistory("/tmp/foo.txt"); m_history.Dump (log.get()); - } log->Printf ("<%4zu> send packet: %.*s", bytes_written, (int)packet.GetSize(), packet.GetData()); } @@ -243,7 +240,7 @@ GDBRemoteCommunication::GetAck () } bool -GDBRemoteCommunication::GetSequenceMutex (Mutex::Locker& locker) +GDBRemoteCommunication::TryLockSequenceMutex (Mutex::Locker& locker) { return locker.TryLock (m_sequence_mutex.GetMutex()); } diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h index 0e9ea0dcb1d..d7986d5b278 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -74,7 +74,7 @@ public: size_t payload_length); bool - GetSequenceMutex(lldb_private::Mutex::Locker& locker); + TryLockSequenceMutex(lldb_private::Mutex::Locker& locker); bool CheckForPacket (const uint8_t *src, diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index e308f915d1c..4fbfa982e0d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -240,7 +240,7 @@ GDBRemoteCommunicationClient::SendPacketAndWaitForResponse Mutex::Locker locker; LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); size_t response_len = 0; - if (GetSequenceMutex (locker)) + if (TryLockSequenceMutex (locker)) { if (SendPacketNoLock (payload, payload_length)) response_len = WaitForPacketWithTimeoutMicroSecondsNoLock (response, GetPacketTimeoutInMicroSeconds ()); @@ -628,7 +628,7 @@ GDBRemoteCommunicationClient::SendAsyncSignal (int signo) return false; } -// This function takes a mutex locker as a parameter in case the GetSequenceMutex +// This function takes a mutex locker as a parameter in case the TryLockSequenceMutex // actually succeeds. If it doesn't succeed in acquiring the sequence mutex // (the expected result), then it will send the halt packet. If it does succeed // then the caller that requested the interrupt will want to keep the sequence @@ -653,7 +653,7 @@ GDBRemoteCommunicationClient::SendInterrupt if (IsRunning()) { // Only send an interrupt if our debugserver is running... - if (GetSequenceMutex (locker) == false) + if (TryLockSequenceMutex (locker) == false) { // Someone has the mutex locked waiting for a response or for the // inferior to stop, so send the interrupt on the down low... @@ -1842,7 +1842,7 @@ GDBRemoteCommunicationClient::GetCurrentThreadIDs (std::vector<lldb::tid_t> &thr Mutex::Locker locker; thread_ids.clear(); - if (GetSequenceMutex (locker)) + if (TryLockSequenceMutex (locker)) { sequence_mutex_unavailable = false; StringExtractorGDBRemote response; diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index 77051fffc6e..120caf3d7a7 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -181,7 +181,7 @@ GDBRemoteRegisterContext::ReadRegisterBytes (const RegisterInfo *reg_info, DataE if (!m_reg_valid[reg]) { Mutex::Locker locker; - if (gdb_comm.GetSequenceMutex (locker)) + if (gdb_comm.TryLockSequenceMutex (locker)) { const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported(); ProcessSP process_sp (m_thread.GetProcess()); @@ -331,7 +331,7 @@ GDBRemoteRegisterContext::WriteRegisterBytes (const lldb_private::RegisterInfo * m_reg_data.GetByteOrder())) // dst byte order { Mutex::Locker locker; - if (gdb_comm.GetSequenceMutex (locker)) + if (gdb_comm.TryLockSequenceMutex (locker)) { const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported(); ProcessSP process_sp (m_thread.GetProcess()); @@ -440,7 +440,7 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp) StringExtractorGDBRemote response; Mutex::Locker locker; - if (gdb_comm.GetSequenceMutex (locker)) + if (gdb_comm.TryLockSequenceMutex (locker)) { char packet[32]; const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported(); @@ -496,7 +496,7 @@ GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data StringExtractorGDBRemote response; Mutex::Locker locker; - if (gdb_comm.GetSequenceMutex (locker)) + if (gdb_comm.TryLockSequenceMutex (locker)) { const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported(); ProcessSP process_sp (m_thread.GetProcess()); diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 8a1f120f308..8b667dffd8d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1129,7 +1129,7 @@ ProcessGDBRemote::DoResume () return error; } -uint32_t +bool ProcessGDBRemote::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_thread_list) { // locker will keep a mutex locked until it goes out of scope @@ -1151,11 +1151,17 @@ ProcessGDBRemote::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new thread_sp.reset (new ThreadGDBRemote (shared_from_this(), tid)); new_thread_list.AddThread(thread_sp); } + SetThreadStopInfo (m_last_stop_packet); + } + else if (sequence_mutex_unavailable) + { +#if defined (LLDB_CONFIGURATION_DEBUG) + assert(!"ProcessGDBRemote::UpdateThreadList() failed due to not getting the sequence mutex"); +#endif + return false; // We just didn't get the list } - if (sequence_mutex_unavailable == false) - SetThreadStopInfo (m_last_stop_packet); - return new_thread_list.GetSize(false); + return true; } diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index 9f3b75874ea..a41957fdc0a 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -265,7 +265,7 @@ protected: return m_flags; } - uint32_t + virtual bool UpdateThreadList (lldb_private::ThreadList &old_thread_list, lldb_private::ThreadList &new_thread_list); diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index a111fb8d343..abff31688d0 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -337,7 +337,7 @@ ProcessMachCore::GetDynamicLoader () return m_dyld_ap.get(); } -uint32_t +bool ProcessMachCore::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_thread_list) { if (old_thread_list.GetSize(false) == 0) @@ -362,7 +362,7 @@ ProcessMachCore::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_ for (uint32_t i=0; i<num_threads; ++i) new_thread_list.AddThread (old_thread_list.GetThreadAtIndex (i)); } - return new_thread_list.GetSize(false); + return new_thread_list.GetSize(false) > 0; } void diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h index 924f549475e..e20276f1da2 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.h @@ -116,7 +116,7 @@ protected: void Clear ( ); - uint32_t + virtual bool UpdateThreadList (lldb_private::ThreadList &old_thread_list, lldb_private::ThreadList &new_thread_list); |