diff options
author | Greg Clayton <gclayton@apple.com> | 2016-05-26 00:08:39 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2016-05-26 00:08:39 +0000 |
commit | a61d0a5b01f58bfc8aa855a068aaab337fc2f6cb (patch) | |
tree | 73c4d8da9c7b7bbdea3fe57862a56792f8512f8b /lldb/source/API | |
parent | 8fe8892c2dfffe7cdd198d7bbe30fb808f32db25 (diff) | |
download | bcm5719-llvm-a61d0a5b01f58bfc8aa855a068aaab337fc2f6cb.tar.gz bcm5719-llvm-a61d0a5b01f58bfc8aa855a068aaab337fc2f6cb.zip |
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>
llvm-svn: 270803
Diffstat (limited to 'lldb/source/API')
-rw-r--r-- | lldb/source/API/SBProcess.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index 1bf3d768841..31c8c599fab 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -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) |