1 //===-- JITLoader.cpp -------------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "lldb/lldb-private.h" 11 #include "lldb/Target/JITLoader.h" 12 #include "lldb/Target/JITLoaderList.h" 13 14 using namespace lldb; 15 using namespace lldb_private; 16 17 JITLoaderList::JITLoaderList() 18 : m_jit_loaders_vec(), m_jit_loaders_mutex(Mutex::eMutexTypeRecursive) 19 { 20 } 21 22 JITLoaderList::~JITLoaderList() 23 { 24 } 25 26 void 27 JITLoaderList::Append (const JITLoaderSP &jit_loader_sp) 28 { 29 Mutex::Locker locker(m_jit_loaders_mutex); 30 m_jit_loaders_vec.push_back(jit_loader_sp); 31 } 32 33 void 34 JITLoaderList::Remove (const JITLoaderSP &jit_loader_sp) 35 { 36 Mutex::Locker locker(m_jit_loaders_mutex); 37 m_jit_loaders_vec.erase(std::remove(m_jit_loaders_vec.begin(), 38 m_jit_loaders_vec.end(), jit_loader_sp), 39 m_jit_loaders_vec.end()); 40 } 41 42 size_t 43 JITLoaderList::GetSize() const 44 { 45 return m_jit_loaders_vec.size(); 46 } 47 48 JITLoaderSP 49 JITLoaderList::GetLoaderAtIndex (size_t idx) 50 { 51 Mutex::Locker locker(m_jit_loaders_mutex); 52 return m_jit_loaders_vec[idx]; 53 } 54 55 void 56 JITLoaderList::DidLaunch() 57 { 58 Mutex::Locker locker(m_jit_loaders_mutex); 59 for (auto const &jit_loader : m_jit_loaders_vec) 60 jit_loader->DidLaunch(); 61 } 62 63 void 64 JITLoaderList::DidAttach() 65 { 66 Mutex::Locker locker(m_jit_loaders_mutex); 67 for (auto const &jit_loader : m_jit_loaders_vec) 68 jit_loader->DidAttach(); 69 } 70 71 void 72 JITLoaderList::ModulesDidLoad(ModuleList &module_list) 73 { 74 Mutex::Locker locker(m_jit_loaders_mutex); 75 for (auto const &jit_loader : m_jit_loaders_vec) 76 jit_loader->ModulesDidLoad(module_list); 77 } 78