[Lldb-commits] [lldb] r154652 - in /lldb/trunk/source/Plugins/Process/gdb-remote: ProcessGDBRemote.cpp ProcessGDBRemote.h
Greg Clayton
gclayton at apple.com
Thu Apr 12 19:11:33 PDT 2012
Author: gclayton
Date: Thu Apr 12 21:11:32 2012
New Revision: 154652
URL: http://llvm.org/viewvc/llvm-project?rev=154652&view=rev
Log:
<rdar://problem/11241798>
The less locks there are, the better. I removed the thread ID mutex and now just shared the m_thread_list's mutex to make sure we don't deadlock due to lock inversion.
Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=154652&r1=154651&r2=154652&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Apr 12 21:11:32 2012
@@ -163,7 +163,6 @@
m_async_broadcaster (NULL, "lldb.process.gdb-remote.async-broadcaster"),
m_async_thread (LLDB_INVALID_HOST_THREAD),
m_thread_ids (),
- m_thread_ids_mutex (Mutex::eMutexTypeRecursive),
m_continue_c_tids (),
m_continue_C_tids (),
m_continue_s_tids (),
@@ -1157,14 +1156,14 @@
void
ProcessGDBRemote::ClearThreadIDList ()
{
- Mutex::Locker locker(m_thread_ids_mutex);
+ Mutex::Locker locker(m_thread_list.GetMutex());
m_thread_ids.clear();
}
bool
ProcessGDBRemote::UpdateThreadIDList ()
{
- Mutex::Locker locker(m_thread_ids_mutex);
+ Mutex::Locker locker(m_thread_list.GetMutex());
bool sequence_mutex_unavailable = false;
m_gdb_comm.GetCurrentThreadIDs (m_thread_ids, sequence_mutex_unavailable);
if (sequence_mutex_unavailable)
@@ -1184,8 +1183,6 @@
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD));
if (log && log->GetMask().Test(GDBR_LOG_VERBOSE))
log->Printf ("ProcessGDBRemote::%s (pid = %llu)", __FUNCTION__, GetID());
- // Update the thread list's stop id immediately so we don't recurse into this function.
- Mutex::Locker locker(m_thread_ids_mutex);
size_t num_thread_ids = m_thread_ids.size();
// The "m_thread_ids" thread ID list should always be updated after each stop
@@ -1283,7 +1280,7 @@
}
else if (name.compare("threads") == 0)
{
- Mutex::Locker locker(m_thread_ids_mutex);
+ Mutex::Locker locker(m_thread_list.GetMutex());
m_thread_ids.clear();
// A comma separated list of all threads in the current
// process that includes the thread for this stop reply
@@ -1494,7 +1491,7 @@
void
ProcessGDBRemote::RefreshStateAfterStop ()
{
- Mutex::Locker locker(m_thread_ids_mutex);
+ Mutex::Locker locker(m_thread_list.GetMutex());
m_thread_ids.clear();
// Set the thread stop info. It might have a "threads" key whose value is
// a list of all thread IDs in the current process, so m_thread_ids might
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=154652&r1=154651&r2=154652&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Thu Apr 12 21:11:32 2012
@@ -309,7 +309,6 @@
typedef std::vector< std::pair<lldb::tid_t,int> > tid_sig_collection;
typedef std::map<lldb::addr_t, lldb::addr_t> MMapMap;
tid_collection m_thread_ids; // Thread IDs for all threads. This list gets updated after stopping
- lldb_private::Mutex m_thread_ids_mutex;
tid_collection m_continue_c_tids; // 'c' for continue
tid_sig_collection m_continue_C_tids; // 'C' for continue with signal
tid_collection m_continue_s_tids; // 's' for step
More information about the lldb-commits
mailing list