annotate lldb/source/Target/JITLoaderList.cpp @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children 5f17cb93ff66
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 //===-- JITLoaderList.cpp -------------------------------------------------===//
anatofuz
parents:
diff changeset
2 //
anatofuz
parents:
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
anatofuz
parents:
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
anatofuz
parents:
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
anatofuz
parents:
diff changeset
6 //
anatofuz
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 #include "lldb/Target/JITLoader.h"
anatofuz
parents:
diff changeset
10 #include "lldb/Target/JITLoaderList.h"
anatofuz
parents:
diff changeset
11 #include "lldb/lldb-private.h"
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 using namespace lldb;
anatofuz
parents:
diff changeset
14 using namespace lldb_private;
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 JITLoaderList::JITLoaderList() : m_jit_loaders_vec(), m_jit_loaders_mutex() {}
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 JITLoaderList::~JITLoaderList() {}
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 void JITLoaderList::Append(const JITLoaderSP &jit_loader_sp) {
anatofuz
parents:
diff changeset
21 std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
anatofuz
parents:
diff changeset
22 m_jit_loaders_vec.push_back(jit_loader_sp);
anatofuz
parents:
diff changeset
23 }
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 void JITLoaderList::Remove(const JITLoaderSP &jit_loader_sp) {
anatofuz
parents:
diff changeset
26 std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
anatofuz
parents:
diff changeset
27 m_jit_loaders_vec.erase(std::remove(m_jit_loaders_vec.begin(),
anatofuz
parents:
diff changeset
28 m_jit_loaders_vec.end(), jit_loader_sp),
anatofuz
parents:
diff changeset
29 m_jit_loaders_vec.end());
anatofuz
parents:
diff changeset
30 }
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 size_t JITLoaderList::GetSize() const { return m_jit_loaders_vec.size(); }
anatofuz
parents:
diff changeset
33
anatofuz
parents:
diff changeset
34 JITLoaderSP JITLoaderList::GetLoaderAtIndex(size_t idx) {
anatofuz
parents:
diff changeset
35 std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
anatofuz
parents:
diff changeset
36 return m_jit_loaders_vec[idx];
anatofuz
parents:
diff changeset
37 }
anatofuz
parents:
diff changeset
38
anatofuz
parents:
diff changeset
39 void JITLoaderList::DidLaunch() {
anatofuz
parents:
diff changeset
40 std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
anatofuz
parents:
diff changeset
41 for (auto const &jit_loader : m_jit_loaders_vec)
anatofuz
parents:
diff changeset
42 jit_loader->DidLaunch();
anatofuz
parents:
diff changeset
43 }
anatofuz
parents:
diff changeset
44
anatofuz
parents:
diff changeset
45 void JITLoaderList::DidAttach() {
anatofuz
parents:
diff changeset
46 std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
anatofuz
parents:
diff changeset
47 for (auto const &jit_loader : m_jit_loaders_vec)
anatofuz
parents:
diff changeset
48 jit_loader->DidAttach();
anatofuz
parents:
diff changeset
49 }
anatofuz
parents:
diff changeset
50
anatofuz
parents:
diff changeset
51 void JITLoaderList::ModulesDidLoad(ModuleList &module_list) {
anatofuz
parents:
diff changeset
52 std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
anatofuz
parents:
diff changeset
53 for (auto const &jit_loader : m_jit_loaders_vec)
anatofuz
parents:
diff changeset
54 jit_loader->ModulesDidLoad(module_list);
anatofuz
parents:
diff changeset
55 }