[Lldb-commits] [lldb] r270803 - Make sure to try and take the process stop lock when calling:
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Wed May 25 17:08:44 PDT 2016
Author: gclayton
Date: Wed May 25 19:08:39 2016
New Revision: 270803
URL: http://llvm.org/viewvc/llvm-project?rev=270803&view=rev
Log:
Make sure to try and take the process stop lock when calling:
uint32_t SBProcess::GetNumQueues();
SBQueue SBProcess::GetQueueAtIndex (size_t index);
Otherwise this code will run when the process is running and cause problems.
<rdar://problem/26482744>
Modified:
lldb/trunk/source/API/SBProcess.cpp
Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=270803&r1=270802&r2=270803&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Wed May 25 19:08:39 2016
@@ -549,9 +549,11 @@ SBProcess::GetNumQueues ()
if (process_sp)
{
Process::StopLocker stop_locker;
-
- std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
- num_queues = process_sp->GetQueueList().GetSize();
+ if (stop_locker.TryLock(&process_sp->GetRunLock()))
+ {
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
+ num_queues = process_sp->GetQueueList().GetSize();
+ }
}
if (log)
@@ -572,9 +574,12 @@ SBProcess::GetQueueAtIndex (size_t index
if (process_sp)
{
Process::StopLocker stop_locker;
- std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
- queue_sp = process_sp->GetQueueList().GetQueueAtIndex(index);
- sb_queue.SetQueue (queue_sp);
+ if (stop_locker.TryLock(&process_sp->GetRunLock()))
+ {
+ std::lock_guard<std::recursive_mutex> guard(process_sp->GetTarget().GetAPIMutex());
+ queue_sp = process_sp->GetQueueList().GetQueueAtIndex(index);
+ sb_queue.SetQueue (queue_sp);
+ }
}
if (log)
More information about the lldb-commits
mailing list