diff options
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r-- | lldb/source/Commands/CommandObjectBreakpoint.cpp | 46 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectProcess.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 16 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectThread.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectWatchpoint.cpp | 31 |
5 files changed, 51 insertions, 50 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index b7ed2a2547c..f8dd6eff2fb 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -1092,9 +1092,9 @@ protected: return false; } - Mutex::Locker locker; - target->GetBreakpointList().GetListMutex(locker); - + std::unique_lock<std::recursive_mutex> lock; + target->GetBreakpointList().GetListMutex(lock); + BreakpointIDList valid_bp_ids; CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs (command, target, result, &valid_bp_ids); @@ -1222,8 +1222,8 @@ protected: return false; } - Mutex::Locker locker; - target->GetBreakpointList().GetListMutex(locker); + std::unique_lock<std::recursive_mutex> lock; + target->GetBreakpointList().GetListMutex(lock); const BreakpointList &breakpoints = target->GetBreakpointList(); @@ -1339,8 +1339,8 @@ protected: return false; } - Mutex::Locker locker; - target->GetBreakpointList().GetListMutex(locker); + std::unique_lock<std::recursive_mutex> lock; + target->GetBreakpointList().GetListMutex(lock); const BreakpointList &breakpoints = target->GetBreakpointList(); size_t num_breakpoints = breakpoints.GetSize(); @@ -1523,8 +1523,8 @@ protected: } const BreakpointList &breakpoints = target->GetBreakpointList(m_options.m_internal); - Mutex::Locker locker; - target->GetBreakpointList(m_options.m_internal).GetListMutex(locker); + std::unique_lock<std::recursive_mutex> lock; + target->GetBreakpointList(m_options.m_internal).GetListMutex(lock); size_t num_breakpoints = breakpoints.GetSize(); @@ -1713,8 +1713,8 @@ protected: if (m_options.m_line_num != 0) break_type = eClearTypeFileAndLine; - Mutex::Locker locker; - target->GetBreakpointList().GetListMutex(locker); + std::unique_lock<std::recursive_mutex> lock; + target->GetBreakpointList().GetListMutex(lock); BreakpointList &breakpoints = target->GetBreakpointList(); size_t num_breakpoints = breakpoints.GetSize(); @@ -1901,9 +1901,9 @@ protected: return false; } - Mutex::Locker locker; - target->GetBreakpointList().GetListMutex(locker); - + std::unique_lock<std::recursive_mutex> lock; + target->GetBreakpointList().GetListMutex(lock); + const BreakpointList &breakpoints = target->GetBreakpointList(); size_t num_breakpoints = breakpoints.GetSize(); @@ -2118,9 +2118,9 @@ protected: return false; } - Mutex::Locker locker; - target->GetBreakpointList().GetListMutex(locker); - + std::unique_lock<std::recursive_mutex> lock; + target->GetBreakpointList().GetListMutex(lock); + const BreakpointList &breakpoints = target->GetBreakpointList(); size_t num_breakpoints = breakpoints.GetSize(); @@ -2211,9 +2211,9 @@ protected: return false; } - Mutex::Locker locker; - target->GetBreakpointList().GetListMutex(locker); - + std::unique_lock<std::recursive_mutex> lock; + target->GetBreakpointList().GetListMutex(lock); + const BreakpointList &breakpoints = target->GetBreakpointList(); size_t num_breakpoints = breakpoints.GetSize(); @@ -2292,9 +2292,9 @@ protected: if (m_name_options.m_name.OptionWasSet()) { const char *name = m_name_options.m_name.GetCurrentValue(); - Mutex::Locker locker; - target->GetBreakpointList().GetListMutex(locker); - + std::unique_lock<std::recursive_mutex> lock; + target->GetBreakpointList().GetListMutex(lock); + BreakpointList &breakpoints = target->GetBreakpointList(); for (BreakpointSP bp_sp : breakpoints.Breakpoints()) { diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 857440b7af7..2d1b0dab1e8 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -733,7 +733,7 @@ protected: } { // Scope for thread list mutex: - Mutex::Locker locker (process->GetThreadList().GetMutex()); + std::lock_guard<std::recursive_mutex> guard(process->GetThreadList().GetMutex()); const uint32_t num_threads = process->GetThreadList().GetSize(); // Set the actions that the threads should each take when resuming diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 1e7f1e54cc6..45d372cba02 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1548,7 +1548,7 @@ static size_t DumpModuleObjfileHeaders(Stream &strm, ModuleList &module_list) { size_t num_dumped = 0; - Mutex::Locker modules_locker(module_list.GetMutex()); + std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex()); const size_t num_modules = module_list.GetSize(); if (num_modules > 0) { @@ -2302,7 +2302,7 @@ protected: if (command.GetArgumentCount() == 0) { // Dump all sections for all modules images - Mutex::Locker modules_locker(target->GetImages().GetMutex()); + std::lock_guard<std::recursive_mutex> guard(target->GetImages().GetMutex()); const size_t num_modules = target->GetImages().GetSize(); if (num_modules > 0) { @@ -2532,7 +2532,7 @@ protected: { // Dump all sections for all modules images const ModuleList &target_modules = target->GetImages(); - Mutex::Locker modules_locker (target_modules.GetMutex()); + std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex()); const size_t num_modules = target_modules.GetSize(); if (num_modules > 0) { @@ -2633,7 +2633,7 @@ protected: FileSpec file_spec(arg_cstr, false); const ModuleList &target_modules = target->GetImages(); - Mutex::Locker modules_locker(target_modules.GetMutex()); + std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex()); const size_t num_modules = target_modules.GetSize(); if (num_modules > 0) { @@ -3296,7 +3296,6 @@ protected: // Otherwise it will lock the AllocationModuleCollectionMutex when accessing // the global module list directly. std::unique_lock<std::recursive_mutex> guard(Module::GetAllocationModuleCollectionMutex(), std::defer_lock); - Mutex::Locker locker; const ModuleList *module_list_ptr = nullptr; const size_t argc = command.GetArgumentCount(); @@ -3333,10 +3332,11 @@ protected: module_list_ptr = &module_list; } + std::unique_lock<std::recursive_mutex> lock; if (module_list_ptr != nullptr) { - assert(use_global_module_list == false && "locking violation"); - locker.Lock(module_list_ptr->GetMutex()); + lock = std::unique_lock<std::recursive_mutex>(module_list_ptr->GetMutex()); + num_modules = module_list_ptr->GetSize(); } @@ -4239,7 +4239,7 @@ protected: // Dump all sections for all other modules const ModuleList &target_modules = target->GetImages(); - Mutex::Locker modules_locker(target_modules.GetMutex()); + std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex()); const size_t num_modules = target_modules.GetSize(); if (num_modules > 0) { diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index d82d99df052..864300cb485 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -87,7 +87,7 @@ public: const size_t num_args = command.GetArgumentCount(); Process *process = m_exe_ctx.GetProcessPtr(); - Mutex::Locker locker (process->GetThreadList().GetMutex()); + std::lock_guard<std::recursive_mutex> guard(process->GetThreadList().GetMutex()); for (size_t i = 0; i < num_args; i++) { @@ -859,7 +859,7 @@ public: // These two lines appear at the beginning of both blocks in // this if..else, but that is because we need to release the // lock before calling process->Resume below. - Mutex::Locker locker (process->GetThreadList().GetMutex()); + std::lock_guard<std::recursive_mutex> guard(process->GetThreadList().GetMutex()); const uint32_t num_threads = process->GetThreadList().GetSize(); std::vector<Thread *> resume_threads; for (uint32_t i = 0; i < argc; ++i) @@ -932,7 +932,7 @@ public: // These two lines appear at the beginning of both blocks in // this if..else, but that is because we need to release the // lock before calling process->Resume below. - Mutex::Locker locker (process->GetThreadList().GetMutex()); + std::lock_guard<std::recursive_mutex> guard(process->GetThreadList().GetMutex()); const uint32_t num_threads = process->GetThreadList().GetSize(); Thread *current_thread = GetDefaultThread(); if (current_thread == nullptr) diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index d3071d5cfd7..ddda3ad9fe1 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -265,8 +265,9 @@ protected: } const WatchpointList &watchpoints = target->GetWatchpointList(); - Mutex::Locker locker; - target->GetWatchpointList().GetListMutex(locker); + + std::unique_lock<std::recursive_mutex> lock; + target->GetWatchpointList().GetListMutex(lock); size_t num_watchpoints = watchpoints.GetSize(); @@ -369,8 +370,8 @@ protected: if (!CheckTargetForWatchpointOperations(target, result)) return false; - Mutex::Locker locker; - target->GetWatchpointList().GetListMutex(locker); + std::unique_lock<std::recursive_mutex> lock; + target->GetWatchpointList().GetListMutex(lock); const WatchpointList &watchpoints = target->GetWatchpointList(); @@ -444,8 +445,8 @@ protected: if (!CheckTargetForWatchpointOperations(target, result)) return false; - Mutex::Locker locker; - target->GetWatchpointList().GetListMutex(locker); + std::unique_lock<std::recursive_mutex> lock; + target->GetWatchpointList().GetListMutex(lock); const WatchpointList &watchpoints = target->GetWatchpointList(); size_t num_watchpoints = watchpoints.GetSize(); @@ -525,9 +526,9 @@ protected: if (!CheckTargetForWatchpointOperations(target, result)) return false; - Mutex::Locker locker; - target->GetWatchpointList().GetListMutex(locker); - + std::unique_lock<std::recursive_mutex> lock; + target->GetWatchpointList().GetListMutex(lock); + const WatchpointList &watchpoints = target->GetWatchpointList(); size_t num_watchpoints = watchpoints.GetSize(); @@ -666,9 +667,9 @@ protected: if (!CheckTargetForWatchpointOperations(target, result)) return false; - Mutex::Locker locker; - target->GetWatchpointList().GetListMutex(locker); - + std::unique_lock<std::recursive_mutex> lock; + target->GetWatchpointList().GetListMutex(lock); + const WatchpointList &watchpoints = target->GetWatchpointList(); size_t num_watchpoints = watchpoints.GetSize(); @@ -819,9 +820,9 @@ protected: if (!CheckTargetForWatchpointOperations(target, result)) return false; - Mutex::Locker locker; - target->GetWatchpointList().GetListMutex(locker); - + std::unique_lock<std::recursive_mutex> lock; + target->GetWatchpointList().GetListMutex(lock); + const WatchpointList &watchpoints = target->GetWatchpointList(); size_t num_watchpoints = watchpoints.GetSize(); |