2016-11-26 13:23:44 +08:00
|
|
|
//===-- JITLoaderList.cpp ---------------------------------------*- C++ -*-===//
|
2014-03-05 18:12:43 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/Target/JITLoader.h"
|
|
|
|
#include "lldb/Target/JITLoaderList.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include "lldb/lldb-private.h"
|
2014-03-05 18:12:43 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
JITLoaderList::JITLoaderList() : m_jit_loaders_vec(), m_jit_loaders_mutex() {}
|
2014-03-05 18:12:43 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
JITLoaderList::~JITLoaderList() {}
|
2014-03-05 18:12:43 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void JITLoaderList::Append(const JITLoaderSP &jit_loader_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
|
|
|
|
m_jit_loaders_vec.push_back(jit_loader_sp);
|
2014-03-05 18:12:43 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void JITLoaderList::Remove(const JITLoaderSP &jit_loader_sp) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
|
|
|
|
m_jit_loaders_vec.erase(std::remove(m_jit_loaders_vec.begin(),
|
|
|
|
m_jit_loaders_vec.end(), jit_loader_sp),
|
|
|
|
m_jit_loaders_vec.end());
|
2014-03-05 18:12:43 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
size_t JITLoaderList::GetSize() const { return m_jit_loaders_vec.size(); }
|
2014-03-05 18:12:43 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
JITLoaderSP JITLoaderList::GetLoaderAtIndex(size_t idx) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
|
|
|
|
return m_jit_loaders_vec[idx];
|
2014-03-05 18:12:43 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void JITLoaderList::DidLaunch() {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
|
|
|
|
for (auto const &jit_loader : m_jit_loaders_vec)
|
|
|
|
jit_loader->DidLaunch();
|
2014-03-05 18:12:43 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void JITLoaderList::DidAttach() {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
|
|
|
|
for (auto const &jit_loader : m_jit_loaders_vec)
|
|
|
|
jit_loader->DidAttach();
|
2014-03-05 18:12:43 +08:00
|
|
|
}
|
2014-03-13 17:37:02 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void JITLoaderList::ModulesDidLoad(ModuleList &module_list) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
|
|
|
|
for (auto const &jit_loader : m_jit_loaders_vec)
|
|
|
|
jit_loader->ModulesDidLoad(module_list);
|
2014-03-13 17:37:02 +08:00
|
|
|
}
|