1*435933ddSDimitry Andric //===-- JITLoaderList.cpp ---------------------------------------*- C++ -*-===// 20127ef0fSEd Maste // 30127ef0fSEd Maste // The LLVM Compiler Infrastructure 40127ef0fSEd Maste // 50127ef0fSEd Maste // This file is distributed under the University of Illinois Open Source 60127ef0fSEd Maste // License. See LICENSE.TXT for details. 70127ef0fSEd Maste // 80127ef0fSEd Maste //===----------------------------------------------------------------------===// 90127ef0fSEd Maste 100127ef0fSEd Maste #include "lldb/Target/JITLoader.h" 110127ef0fSEd Maste #include "lldb/Target/JITLoaderList.h" 12*435933ddSDimitry Andric #include "lldb/lldb-private.h" 130127ef0fSEd Maste 140127ef0fSEd Maste using namespace lldb; 150127ef0fSEd Maste using namespace lldb_private; 160127ef0fSEd Maste JITLoaderList()17*435933ddSDimitry AndricJITLoaderList::JITLoaderList() : m_jit_loaders_vec(), m_jit_loaders_mutex() {} 180127ef0fSEd Maste ~JITLoaderList()19*435933ddSDimitry AndricJITLoaderList::~JITLoaderList() {} 200127ef0fSEd Maste Append(const JITLoaderSP & jit_loader_sp)21*435933ddSDimitry Andricvoid JITLoaderList::Append(const JITLoaderSP &jit_loader_sp) { 224bb0738eSEd Maste std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex); 230127ef0fSEd Maste m_jit_loaders_vec.push_back(jit_loader_sp); 240127ef0fSEd Maste } 250127ef0fSEd Maste Remove(const JITLoaderSP & jit_loader_sp)26*435933ddSDimitry Andricvoid JITLoaderList::Remove(const JITLoaderSP &jit_loader_sp) { 274bb0738eSEd Maste std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex); 280127ef0fSEd Maste m_jit_loaders_vec.erase(std::remove(m_jit_loaders_vec.begin(), 290127ef0fSEd Maste m_jit_loaders_vec.end(), jit_loader_sp), 300127ef0fSEd Maste m_jit_loaders_vec.end()); 310127ef0fSEd Maste } 320127ef0fSEd Maste GetSize() const33*435933ddSDimitry Andricsize_t JITLoaderList::GetSize() const { return m_jit_loaders_vec.size(); } 340127ef0fSEd Maste GetLoaderAtIndex(size_t idx)35*435933ddSDimitry AndricJITLoaderSP JITLoaderList::GetLoaderAtIndex(size_t idx) { 364bb0738eSEd Maste std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex); 370127ef0fSEd Maste return m_jit_loaders_vec[idx]; 380127ef0fSEd Maste } 390127ef0fSEd Maste DidLaunch()40*435933ddSDimitry Andricvoid JITLoaderList::DidLaunch() { 414bb0738eSEd Maste std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex); 420127ef0fSEd Maste for (auto const &jit_loader : m_jit_loaders_vec) 430127ef0fSEd Maste jit_loader->DidLaunch(); 440127ef0fSEd Maste } 450127ef0fSEd Maste DidAttach()46*435933ddSDimitry Andricvoid JITLoaderList::DidAttach() { 474bb0738eSEd Maste std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex); 480127ef0fSEd Maste for (auto const &jit_loader : m_jit_loaders_vec) 490127ef0fSEd Maste jit_loader->DidAttach(); 500127ef0fSEd Maste } 510127ef0fSEd Maste ModulesDidLoad(ModuleList & module_list)52*435933ddSDimitry Andricvoid JITLoaderList::ModulesDidLoad(ModuleList &module_list) { 534bb0738eSEd Maste std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex); 540127ef0fSEd Maste for (auto const &jit_loader : m_jit_loaders_vec) 550127ef0fSEd Maste jit_loader->ModulesDidLoad(module_list); 560127ef0fSEd Maste } 57