diff options
Diffstat (limited to 'source/Breakpoint/BreakpointSite.cpp')
-rw-r--r-- | source/Breakpoint/BreakpointSite.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/Breakpoint/BreakpointSite.cpp b/source/Breakpoint/BreakpointSite.cpp index 73c1357ce9639..a757a01824c76 100644 --- a/source/Breakpoint/BreakpointSite.cpp +++ b/source/Breakpoint/BreakpointSite.cpp @@ -1,9 +1,8 @@ //===-- BreakpointSite.cpp --------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -49,9 +48,17 @@ break_id_t BreakpointSite::GetNextID() { // should continue. bool BreakpointSite::ShouldStop(StoppointCallbackContext *context) { - std::lock_guard<std::recursive_mutex> guard(m_owners_mutex); IncrementHitCount(); - return m_owners.ShouldStop(context); + // ShouldStop can do a lot of work, and might even come come back and hit + // this breakpoint site again. So don't hold the m_owners_mutex the whole + // while. Instead make a local copy of the collection and call ShouldStop on + // the copy. + BreakpointLocationCollection owners_copy; + { + std::lock_guard<std::recursive_mutex> guard(m_owners_mutex); + owners_copy = m_owners; + } + return owners_copy.ShouldStop(context); } bool BreakpointSite::IsBreakpointAtThisSite(lldb::break_id_t bp_id) { |