[Lldb-commits] [lldb] r286908 - Fix a deadlock issue that would happen when loading an AppleTV or watchOS binary.
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 14 15:45:50 PST 2016
Author: gclayton
Date: Mon Nov 14 17:45:50 2016
New Revision: 286908
URL: http://llvm.org/viewvc/llvm-project?rev=286908&view=rev
Log:
Fix a deadlock issue that would happen when loading an AppleTV or watchOS binary.
This was a regression that was caused by svn revision 269877:
commit 1ded4a2a25d60dd2c81bd432bcf63b6ded58e5d6
Author: Saleem Abdulrasool <compnerd at compnerd.org>
Date: Wed May 18 01:59:10 2016 +0000
remove use of Mutex in favour of std::{,recursive_}mutex
This is a pretty straightforward first pass over removing a number of uses of
Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there
are interfaces which take Mutex::Locker & to lock internal locks. This patch
cleans up most of the easy cases. The only non-trivial change is in
CommandObjectTarget.cpp where a Mutex::Locker was split into two.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@269877 91177308-0d34-0410-b5e6-96231b3b80d8
This change actually changed the Platform::m_mutex to be non-recursive which caused the regression.
<rdar://problem/29094384>
Modified:
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp?rev=286908&r1=286907&r2=286908&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp Mon Nov 14 17:45:50 2016
@@ -263,7 +263,7 @@ EnumerateDirectoryCallback(void *baton,
}
const char *PlatformAppleWatchSimulator::GetSDKDirectoryAsCString() {
- std::lock_guard<std::mutex> guard(m_mutex);
+ std::lock_guard<std::mutex> guard(m_sdk_dir_mutex);
if (m_sdk_directory.empty()) {
const char *developer_dir = GetDeveloperDirectory();
if (developer_dir) {
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h?rev=286908&r1=286907&r2=286908&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h Mon Nov 14 17:45:50 2016
@@ -86,6 +86,7 @@ public:
}
protected:
+ std::mutex m_sdk_dir_mutex;
std::string m_sdk_directory;
std::string m_build_update;
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp?rev=286908&r1=286907&r2=286908&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp Mon Nov 14 17:45:50 2016
@@ -258,6 +258,7 @@ PlatformRemoteAppleTV::GetContainedFiles
bool PlatformRemoteAppleTV::UpdateSDKDirectoryInfosIfNeeded() {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
+ std::lock_guard<std::mutex> guard(m_sdk_dir_mutex);
if (m_sdk_directory_infos.empty()) {
const char *device_support_dir = GetDeviceSupportDirectory();
if (log) {
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h?rev=286908&r1=286907&r2=286908&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h Mon Nov 14 17:45:50 2016
@@ -96,6 +96,7 @@ protected:
bool user_cached;
};
typedef std::vector<SDKDirectoryInfo> SDKDirectoryInfoCollection;
+ std::mutex m_sdk_dir_mutex;
SDKDirectoryInfoCollection m_sdk_directory_infos;
std::string m_device_support_directory;
std::string m_device_support_directory_for_os_version;
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp?rev=286908&r1=286907&r2=286908&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp Mon Nov 14 17:45:50 2016
@@ -268,6 +268,7 @@ PlatformRemoteAppleWatch::GetContainedFi
bool PlatformRemoteAppleWatch::UpdateSDKDirectoryInfosIfNeeded() {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
+ std::lock_guard<std::mutex> guard(m_sdk_dir_mutex);
if (m_sdk_directory_infos.empty()) {
const char *device_support_dir = GetDeviceSupportDirectory();
if (log) {
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h?rev=286908&r1=286907&r2=286908&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h Mon Nov 14 17:45:50 2016
@@ -98,6 +98,7 @@ protected:
bool user_cached;
};
typedef std::vector<SDKDirectoryInfo> SDKDirectoryInfoCollection;
+ std::mutex m_sdk_dir_mutex;
SDKDirectoryInfoCollection m_sdk_directory_infos;
std::string m_device_support_directory;
std::string m_device_support_directory_for_os_version;
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp?rev=286908&r1=286907&r2=286908&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp Mon Nov 14 17:45:50 2016
@@ -263,6 +263,7 @@ PlatformRemoteiOS::GetContainedFilesInto
bool PlatformRemoteiOS::UpdateSDKDirectoryInfosIfNeeded() {
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
+ std::lock_guard<std::mutex> guard(m_sdk_dir_mutex);
if (m_sdk_directory_infos.empty()) {
// A --sysroot option was supplied - add it to our list of SDKs to check
if (m_sdk_sysroot) {
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h?rev=286908&r1=286907&r2=286908&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h Mon Nov 14 17:45:50 2016
@@ -94,6 +94,7 @@ protected:
typedef std::vector<SDKDirectoryInfo> SDKDirectoryInfoCollection;
+ std::mutex m_sdk_dir_mutex;
SDKDirectoryInfoCollection m_sdk_directory_infos;
std::string m_device_support_directory;
std::string m_device_support_directory_for_os_version;
More information about the lldb-commits
mailing list