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 LLDB_CORE_LOADEDMODULEINFOLIST_H
10#define LLDB_CORE_LOADEDMODULEINFOLIST_H
11
12#include <cassert>
13#include <string>
14#include <vector>
15
16#include "lldb/lldb-defines.h"
18#include "lldb/lldb-types.h"
19
20namespace lldb_private {
22public:
24 public:
30 e_num
31 };
32
34 for (uint32_t i = 0; i < e_num; ++i)
35 m_has[i] = false;
36 };
37
38 void set_name(const std::string &name) {
39 m_name = name;
40 m_has[e_has_name] = true;
41 }
42 bool get_name(std::string &out) const {
43 out = m_name;
44 return m_has[e_has_name];
45 }
46
47 void set_base(const lldb::addr_t base) {
48 m_base = base;
49 m_has[e_has_base] = true;
50 }
51 bool get_base(lldb::addr_t &out) const {
52 out = m_base;
53 return m_has[e_has_base];
54 }
55
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];
60 }
61
62 void set_link_map(const lldb::addr_t addr) {
63 m_link_map = addr;
64 m_has[e_has_link_map] = true;
65 }
66 bool get_link_map(lldb::addr_t &out) const {
67 out = m_link_map;
68 return m_has[e_has_link_map];
69 }
70
71 void set_dynamic(const lldb::addr_t addr) {
72 m_dynamic = addr;
73 m_has[e_has_dynamic] = true;
74 }
75 bool get_dynamic(lldb::addr_t &out) const {
76 out = m_dynamic;
77 return m_has[e_has_dynamic];
78 }
79
80 bool has_info(e_data_point datum) const {
81 assert(datum < e_num);
82 return m_has[datum];
83 }
84
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])
88 return false;
89 }
90
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);
93 }
94
95 protected:
96 bool m_has[e_num];
97 std::string m_name;
100 bool m_base_is_offset = false;
102 };
103
105
106 void add(const LoadedModuleInfo &mod) { m_list.push_back(mod); }
107
108 void clear() { m_list.clear(); }
109
110 std::vector<LoadedModuleInfo> m_list;
112};
113} // namespace lldb_private
114
115#endif // LLDB_CORE_LOADEDMODULEINFOLIST_H
bool operator==(LoadedModuleInfo const &rhs) const
void add(const LoadedModuleInfo &mod)
std::vector< LoadedModuleInfo > m_list
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:82
A class that represents a running process on the host machine.
uint64_t addr_t
Definition: lldb-types.h:80