Path: blob/main/contrib/llvm-project/lldb/source/Target/JITLoaderList.cpp
39587 views
//===-- JITLoaderList.cpp -------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "lldb/Target/JITLoader.h"9#include "lldb/Target/JITLoaderList.h"10#include "lldb/lldb-private.h"1112using namespace lldb;13using namespace lldb_private;1415JITLoaderList::JITLoaderList() : m_jit_loaders_vec(), m_jit_loaders_mutex() {}1617JITLoaderList::~JITLoaderList() = default;1819void JITLoaderList::Append(const JITLoaderSP &jit_loader_sp) {20std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);21m_jit_loaders_vec.push_back(jit_loader_sp);22}2324void JITLoaderList::Remove(const JITLoaderSP &jit_loader_sp) {25std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);26llvm::erase(m_jit_loaders_vec, jit_loader_sp);27}2829size_t JITLoaderList::GetSize() const { return m_jit_loaders_vec.size(); }3031JITLoaderSP JITLoaderList::GetLoaderAtIndex(size_t idx) {32std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);33return m_jit_loaders_vec[idx];34}3536void JITLoaderList::DidLaunch() {37std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);38for (auto const &jit_loader : m_jit_loaders_vec)39jit_loader->DidLaunch();40}4142void JITLoaderList::DidAttach() {43std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);44for (auto const &jit_loader : m_jit_loaders_vec)45jit_loader->DidAttach();46}4748void JITLoaderList::ModulesDidLoad(ModuleList &module_list) {49std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);50for (auto const &jit_loader : m_jit_loaders_vec)51jit_loader->ModulesDidLoad(module_list);52}535455