Author: labath Date: Mon May 16 04:18:30 2016 New Revision: 269640 URL: http://llvm.org/viewvc/llvm-project?rev=269640&view=rev Log: Remove Mutex from NativeProcessLinux
NPL now assumes it is running from a single thread now, so its thread-safety is untested anyway (and if that assumption is broken, we'll have bigger problems (due to ptrace restrictions) than a couple of missing mutexes). Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=269640&r1=269639&r2=269640&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Mon May 16 04:18:30 2016 @@ -427,7 +427,6 @@ NativeProcessLinux::NativeProcessLinux ( m_arch (), m_supports_mem_region (eLazyBoolCalculate), m_mem_region_cache (), - m_mem_region_cache_mutex(), m_pending_notification_tid(LLDB_INVALID_THREAD_ID) { } @@ -1149,8 +1148,6 @@ NativeProcessLinux::MonitorSIGTRAP(const assert(info.si_signo == SIGTRAP && "Unexpected child signal!"); - Mutex::Locker locker (m_threads_mutex); - switch (info.si_code) { // TODO: these two cases are required if we want to support tracing of the inferiors' children. We'd need this to debug a monitor. @@ -1186,7 +1183,7 @@ NativeProcessLinux::MonitorSIGTRAP(const // Exec clears any pending notifications. m_pending_notification_tid = LLDB_INVALID_THREAD_ID; - // Remove all but the main thread here. Linux fork creates a new process which only copies the main thread. Mutexes are in undefined state. + // Remove all but the main thread here. Linux fork creates a new process which only copies the main thread. if (log) log->Printf ("NativeProcessLinux::%s exec received, stop tracking all but main thread", __FUNCTION__); @@ -1412,8 +1409,6 @@ NativeProcessLinux::MonitorSignal(const // // Similarly, ACK signals generated by this monitor. - Mutex::Locker locker (m_threads_mutex); - // Handle the signal. if (info.si_code == SI_TKILL || info.si_code == SI_USER) { @@ -1712,8 +1707,6 @@ NativeProcessLinux::Resume (const Resume bool software_single_step = !SupportHardwareSingleStepping(); - Mutex::Locker locker (m_threads_mutex); - if (software_single_step) { for (auto thread_sp : m_threads) @@ -1839,8 +1832,6 @@ NativeProcessLinux::Interrupt () if (log) log->Printf ("NativeProcessLinux::%s selecting running thread for interrupt target", __FUNCTION__); - Mutex::Locker locker (m_threads_mutex); - for (auto thread_sp : m_threads) { // The thread shouldn't be null but lets just cover that here. @@ -2001,7 +1992,6 @@ NativeProcessLinux::GetMemoryRegionInfo // Use an approach that reads memory regions from /proc/{pid}/maps. // Assume proc maps entries are in ascending order. // FIXME assert if we find differently. - Mutex::Locker locker (m_mem_region_cache_mutex); Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS)); Error error; @@ -2126,12 +2116,9 @@ NativeProcessLinux::DoStopIDBumped (uint if (log) log->Printf ("NativeProcessLinux::%s(newBumpId=%" PRIu32 ") called", __FUNCTION__, newBumpId); - { - Mutex::Locker locker (m_mem_region_cache_mutex); if (log) log->Printf ("NativeProcessLinux::%s clearing %" PRIu64 " entries from the cache", __FUNCTION__, static_cast<uint64_t> (m_mem_region_cache.size ())); m_mem_region_cache.clear (); - } } Error @@ -2230,7 +2217,6 @@ NativeProcessLinux::UpdateThreads () // with respect to thread state and they keep the thread list // populated properly. All this method needs to do is return the // thread count. - Mutex::Locker locker (m_threads_mutex); return m_threads.size (); } @@ -2727,7 +2713,6 @@ NativeProcessLinux::StopTrackingThread ( bool found = false; - Mutex::Locker locker (m_threads_mutex); for (auto it = m_threads.begin (); it != m_threads.end (); ++it) { if (*it && ((*it)->GetID () == thread_id)) @@ -2748,8 +2733,6 @@ NativeProcessLinux::AddThread (lldb::tid { Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD)); - Mutex::Locker locker (m_threads_mutex); - if (log) { log->Printf ("NativeProcessLinux::%s pid %" PRIu64 " adding thread with tid %" PRIu64, Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h?rev=269640&r1=269639&r2=269640&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.h Mon May 16 04:18:30 2016 @@ -19,7 +19,6 @@ #include "lldb/Host/Debug.h" #include "lldb/Host/FileSpec.h" #include "lldb/Host/HostThread.h" -#include "lldb/Host/Mutex.h" #include "lldb/Target/MemoryRegionInfo.h" #include "lldb/Host/common/NativeProcessProtocol.h" @@ -144,7 +143,6 @@ namespace process_linux { LazyBool m_supports_mem_region; std::vector<MemoryRegionInfo> m_mem_region_cache; - Mutex m_mem_region_cache_mutex; lldb::tid_t m_pending_notification_tid; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits