LLDB  mainline
JITLoaderList.cpp
Go to the documentation of this file.
1 //===-- JITLoaderList.cpp -------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
11 #include "lldb/lldb-private.h"
12 
13 using namespace lldb;
14 using namespace lldb_private;
15 
16 JITLoaderList::JITLoaderList() : m_jit_loaders_vec(), m_jit_loaders_mutex() {}
17 
19 
20 void JITLoaderList::Append(const JITLoaderSP &jit_loader_sp) {
21  std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
22  m_jit_loaders_vec.push_back(jit_loader_sp);
23 }
24 
25 void JITLoaderList::Remove(const JITLoaderSP &jit_loader_sp) {
26  std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
27  m_jit_loaders_vec.erase(std::remove(m_jit_loaders_vec.begin(),
28  m_jit_loaders_vec.end(), jit_loader_sp),
29  m_jit_loaders_vec.end());
30 }
31 
32 size_t JITLoaderList::GetSize() const { return m_jit_loaders_vec.size(); }
33 
34 JITLoaderSP JITLoaderList::GetLoaderAtIndex(size_t idx) {
35  std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
36  return m_jit_loaders_vec[idx];
37 }
38 
40  std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
41  for (auto const &jit_loader : m_jit_loaders_vec)
42  jit_loader->DidLaunch();
43 }
44 
46  std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
47  for (auto const &jit_loader : m_jit_loaders_vec)
48  jit_loader->DidAttach();
49 }
50 
52  std::lock_guard<std::recursive_mutex> guard(m_jit_loaders_mutex);
53  for (auto const &jit_loader : m_jit_loaders_vec)
54  jit_loader->ModulesDidLoad(module_list);
55 }
lldb_private::JITLoaderList::Remove
void Remove(const lldb::JITLoaderSP &jit_loader_sp)
Definition: JITLoaderList.cpp:25
lldb_private::JITLoaderList::GetSize
size_t GetSize() const
Definition: JITLoaderList.cpp:32
lldb_private::JITLoaderList::ModulesDidLoad
void ModulesDidLoad(ModuleList &module_list)
Definition: JITLoaderList.cpp:51
lldb_private::JITLoaderList::GetLoaderAtIndex
lldb::JITLoaderSP GetLoaderAtIndex(size_t idx)
Definition: JITLoaderList.cpp:34
lldb_private::ModuleList
Definition: ModuleList.h:72
lldb_private::JITLoaderList::m_jit_loaders_mutex
std::recursive_mutex m_jit_loaders_mutex
Definition: JITLoaderList.h:43
lldb_private::JITLoaderList::DidAttach
void DidAttach()
Definition: JITLoaderList.cpp:45
JITLoaderList.h
lldb_private::JITLoaderList::DidLaunch
void DidLaunch()
Definition: JITLoaderList.cpp:39
lldb_private::JITLoaderList::m_jit_loaders_vec
std::vector< lldb::JITLoaderSP > m_jit_loaders_vec
Definition: JITLoaderList.h:42
lldb-private.h
JITLoader.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::JITLoaderList::Append
void Append(const lldb::JITLoaderSP &jit_loader_sp)
Definition: JITLoaderList.cpp:20
lldb_private::JITLoaderList::~JITLoaderList
~JITLoaderList()
lldb
Definition: SBAddress.h:15