1 //===-- LoadedModuleInfoList.h ----------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_CORE_LOADEDMODULEINFOLIST_H
10 #define LLDB_CORE_LOADEDMODULEINFOLIST_H
16 #include "lldb/lldb-defines.h"
17 #include "lldb/lldb-private-forward.h"
18 #include "lldb/lldb-types.h"
20 namespace lldb_private {
21 class LoadedModuleInfoList {
23 class LoadedModuleInfo {
34 for (uint32_t i = 0; i < e_num; ++i)
38 void set_name(const std::string &name) {
40 m_has[e_has_name] = true;
42 bool get_name(std::string &out) const {
44 return m_has[e_has_name];
47 void set_base(const lldb::addr_t base) {
49 m_has[e_has_base] = true;
51 bool get_base(lldb::addr_t &out) const {
53 return m_has[e_has_base];
56 void set_base_is_offset(bool is_offset) { m_base_is_offset = is_offset; }
57 bool get_base_is_offset(bool &out) const {
58 out = m_base_is_offset;
59 return m_has[e_has_base];
62 void set_link_map(const lldb::addr_t addr) {
64 m_has[e_has_link_map] = true;
66 bool get_link_map(lldb::addr_t &out) const {
68 return m_has[e_has_link_map];
71 void set_dynamic(const lldb::addr_t addr) {
73 m_has[e_has_dynamic] = true;
75 bool get_dynamic(lldb::addr_t &out) const {
77 return m_has[e_has_dynamic];
80 bool has_info(e_data_point datum) const {
81 assert(datum < e_num);
85 bool operator==(LoadedModuleInfo const &rhs) const {
86 for (size_t i = 0; i < e_num; ++i) {
87 if (m_has[i] != rhs.m_has[i])
91 return (m_base == rhs.m_base) && (m_link_map == rhs.m_link_map) &&
92 (m_dynamic == rhs.m_dynamic) && (m_name == rhs.m_name);
98 lldb::addr_t m_link_map;
100 bool m_base_is_offset;
101 lldb::addr_t m_dynamic;
104 LoadedModuleInfoList() {}
106 void add(const LoadedModuleInfo &mod) { m_list.push_back(mod); }
108 void clear() { m_list.clear(); }
110 std::vector<LoadedModuleInfo> m_list;
111 lldb::addr_t m_link_map = LLDB_INVALID_ADDRESS;
113 } // namespace lldb_private
115 #endif // LLDB_CORE_LOADEDMODULEINFOLIST_H