diff options
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
4 files changed, 40 insertions, 16 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 1535fd41260..0d39e98f428 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -225,14 +225,9 @@ GDBRemoteCommunication::GetAck () } bool -GDBRemoteCommunication::GetSequenceMutex (Mutex::Locker& locker, uint32_t usec_timeout) +GDBRemoteCommunication::GetSequenceMutex (Mutex::Locker& locker) { - if (usec_timeout == 0) - return locker.TryLock (m_sequence_mutex.GetMutex()); - - // Wait for the lock - locker.Lock (m_sequence_mutex.GetMutex()); - return true; + 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 ef0c1983898..83bbfd59b8d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h @@ -59,7 +59,7 @@ public: size_t payload_length); bool - GetSequenceMutex (lldb_private::Mutex::Locker& locker, uint32_t usec_timeout); + GetSequenceMutex (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 4efacd57eee..a31f48af1f7 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -259,7 +259,7 @@ GDBRemoteCommunicationClient::SendPacketAndWaitForResponse Mutex::Locker locker; LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); size_t response_len = 0; - if (GetSequenceMutex (locker, 0)) + if (GetSequenceMutex (locker)) { if (SendPacketNoLock (payload, payload_length)) response_len = WaitForPacketWithTimeoutMicroSecondsNoLock (response, GetPacketTimeoutInMicroSeconds ()); @@ -350,7 +350,7 @@ GDBRemoteCommunicationClient::SendPacketAndWaitForResponse else { if (log) - log->Printf("error: packet mutex taken and send_async == false, not sending packet '%*s'", (int) payload_length, payload); + log->Printf("error: failed to get packet sequence mutex, not sending packet '%*s'", (int) payload_length, payload); } } if (response_len == 0) @@ -648,7 +648,7 @@ GDBRemoteCommunicationClient::SendInterrupt if (IsRunning()) { // Only send an interrupt if our debugserver is running... - if (GetSequenceMutex (locker, 0)) + if (GetSequenceMutex (locker)) { if (log) log->Printf ("SendInterrupt () - got sequence mutex without having to interrupt"); @@ -1843,7 +1843,7 @@ GDBRemoteCommunicationClient::GetCurrentThreadIDs (std::vector<lldb::tid_t> &thr Mutex::Locker locker; thread_ids.clear(); - if (GetSequenceMutex (locker, 0)) + if (GetSequenceMutex (locker)) { sequence_mutex_unavailable = false; StringExtractorGDBRemote response; @@ -1872,6 +1872,9 @@ GDBRemoteCommunicationClient::GetCurrentThreadIDs (std::vector<lldb::tid_t> &thr } else { + LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_PROCESS | GDBR_LOG_PACKETS)); + if (log) + log->Printf("error: failed to get packet sequence mutex, not sending packet 'qfThreadInfo'"); sequence_mutex_unavailable = true; } return thread_ids.size(); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index 33b74b42085..ec2cfd88489 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -21,6 +21,7 @@ // Project includes #include "Utility/StringExtractorGDBRemote.h" #include "ProcessGDBRemote.h" +#include "ProcessGDBRemoteLog.h" #include "ThreadGDBRemote.h" #include "Utility/ARM_GCC_Registers.h" #include "Utility/ARM_DWARF_Registers.h" @@ -181,7 +182,7 @@ GDBRemoteRegisterContext::ReadRegisterBytes (const RegisterInfo *reg_info, DataE if (!m_reg_valid[reg]) { Mutex::Locker locker; - if (gdb_comm.GetSequenceMutex (locker, 0)) + if (gdb_comm.GetSequenceMutex (locker)) { const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported(); ProcessSP process_sp (m_thread.GetProcess()); @@ -241,6 +242,12 @@ GDBRemoteRegisterContext::ReadRegisterBytes (const RegisterInfo *reg_info, DataE } } } + else + { + LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS)); + if (log) + log->Printf("error: failed to get packet sequence mutex, not sending read register for \"%s\"", reg_info->name); + } // Make sure we got a valid register value after reading it if (!m_reg_valid[reg]) @@ -331,7 +338,7 @@ GDBRemoteRegisterContext::WriteRegisterBytes (const lldb_private::RegisterInfo * m_reg_data.GetByteOrder())) // dst byte order { Mutex::Locker locker; - if (gdb_comm.GetSequenceMutex (locker, 0)) + if (gdb_comm.GetSequenceMutex (locker)) { const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported(); ProcessSP process_sp (m_thread.GetProcess()); @@ -420,6 +427,12 @@ GDBRemoteRegisterContext::WriteRegisterBytes (const lldb_private::RegisterInfo * } } } + else + { + LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS)); + if (log) + log->Printf("error: failed to get packet sequence mutex, not sending write register for \"%s\"", reg_info->name); + } } return false; } @@ -440,7 +453,7 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp) StringExtractorGDBRemote response; Mutex::Locker locker; - if (gdb_comm.GetSequenceMutex (locker, 0)) + if (gdb_comm.GetSequenceMutex (locker)) { char packet[32]; const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported(); @@ -475,6 +488,13 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp) } } } + else + { + LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS)); + if (log) + log->Printf("error: failed to get packet sequence mutex, not sending read all registers"); + } + data_sp.reset(); return false; } @@ -496,7 +516,7 @@ GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data StringExtractorGDBRemote response; Mutex::Locker locker; - if (gdb_comm.GetSequenceMutex (locker, 0)) + if (gdb_comm.GetSequenceMutex (locker)) { const bool thread_suffix_supported = gdb_comm.GetThreadSuffixSupported(); ProcessSP process_sp (m_thread.GetProcess()); @@ -592,6 +612,12 @@ GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data } } } + else + { + LogSP log (ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet (GDBR_LOG_THREAD | GDBR_LOG_PACKETS)); + if (log) + log->Printf("error: failed to get packet sequence mutex, not sending write all registers"); + } return false; } |