LLDB  mainline
LoadedModuleInfoList.h
Go to the documentation of this file.
1 //===-- LoadedModuleInfoList.h ----------------------------------*- C++ -*-===//
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 
9 #ifndef liblldb_LoadedModuleInfoList_h_
10 #define liblldb_LoadedModuleInfoList_h_
11 
12 
13 #include <cassert>
14 #include <string>
15 #include <vector>
16 
17 #include "lldb/lldb-defines.h"
19 #include "lldb/lldb-types.h"
20 
21 namespace lldb_private {
23 public:
25  public:
26  enum e_data_point {
32  };
33 
35  for (uint32_t i = 0; i < e_num; ++i)
36  m_has[i] = false;
37  };
38 
39  void set_name(const std::string &name) {
40  m_name = name;
41  m_has[e_has_name] = true;
42  }
43  bool get_name(std::string &out) const {
44  out = m_name;
45  return m_has[e_has_name];
46  }
47 
48  void set_base(const lldb::addr_t base) {
49  m_base = base;
50  m_has[e_has_base] = true;
51  }
52  bool get_base(lldb::addr_t &out) const {
53  out = m_base;
54  return m_has[e_has_base];
55  }
56 
57  void set_base_is_offset(bool is_offset) { m_base_is_offset = is_offset; }
58  bool get_base_is_offset(bool &out) const {
59  out = m_base_is_offset;
60  return m_has[e_has_base];
61  }
62 
63  void set_link_map(const lldb::addr_t addr) {
64  m_link_map = addr;
65  m_has[e_has_link_map] = true;
66  }
67  bool get_link_map(lldb::addr_t &out) const {
68  out = m_link_map;
69  return m_has[e_has_link_map];
70  }
71 
72  void set_dynamic(const lldb::addr_t addr) {
73  m_dynamic = addr;
74  m_has[e_has_dynamic] = true;
75  }
76  bool get_dynamic(lldb::addr_t &out) const {
77  out = m_dynamic;
78  return m_has[e_has_dynamic];
79  }
80 
81  bool has_info(e_data_point datum) const {
82  assert(datum < e_num);
83  return m_has[datum];
84  }
85 
86  bool operator==(LoadedModuleInfo const &rhs) const {
87  if (e_num != rhs.e_num)
88  return false;
89 
90  for (size_t i = 0; i < e_num; ++i) {
91  if (m_has[i] != rhs.m_has[i])
92  return false;
93  }
94 
95  return (m_base == rhs.m_base) && (m_link_map == rhs.m_link_map) &&
96  (m_dynamic == rhs.m_dynamic) && (m_name == rhs.m_name);
97  }
98 
99  protected:
100  bool m_has[e_num];
101  std::string m_name;
106  };
107 
109 
110  void add(const LoadedModuleInfo &mod) { m_list.push_back(mod); }
111 
112  void clear() { m_list.clear(); }
113 
114  std::vector<LoadedModuleInfo> m_list;
116 };
117 } // namespace lldb_private
118 
119 #endif // liblldb_LoadedModuleInfoList_h_
void add(const LoadedModuleInfo &mod)
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
bool operator==(LoadedModuleInfo const &rhs) const
#define LLDB_INVALID_ADDRESS
Invalid value definitions.
Definition: lldb-defines.h:85
uint64_t addr_t
Definition: lldb-types.h:83
std::vector< LoadedModuleInfo > m_list