================ @@ -0,0 +1,235 @@ +//===-- StopPointSiteList.cpp ---------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#include "lldb/Breakpoint/StopPointSiteList.h" +#include "lldb/Breakpoint/BreakpointSite.h" +#include "lldb/Breakpoint/WatchpointResource.h" + +#include "lldb/Utility/Stream.h" +#include <algorithm> + +using namespace lldb; +using namespace lldb_private; + +// Add site to the list. However, if the element already exists in +// the list, then we don't add it, and return InvalidSiteID. + +template <typename StopPointSite> +typename StopPointSite::SiteID +StopPointSiteList<StopPointSite>::Add(const StopPointSiteSP &site) { + lldb::addr_t site_load_addr = site->GetLoadAddress(); + std::lock_guard<std::recursive_mutex> guard(m_mutex); + typename collection::iterator iter = m_site_list.find(site_load_addr); + + if (iter == m_site_list.end()) { +#if 0 + m_site_list.insert(iter, collection::value_type(site_load_addr, site)); +#endif + m_site_list[site_load_addr] = site; + return site->GetID(); + } else { + return UINT32_MAX; + } +} + +template <typename StopPointSite> +bool StopPointSiteList<StopPointSite>::ShouldStop( + StoppointCallbackContext *context, typename StopPointSite::SiteID site_id) { + StopPointSiteSP site_sp(FindByID(site_id)); + if (site_sp) { ---------------- JDevlieghere wrote:
```if(StopPointSiteSP site_sp = FindByID(site_id))``` https://github.com/llvm/llvm-project/pull/68845 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits