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 
20 namespace lldb_private {
22 public:
24  public:
25  enum e_data_point {
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];
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
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::operator==
bool operator==(LoadedModuleInfo const &rhs) const
Definition: LoadedModuleInfoList.h:85
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::set_link_map
void set_link_map(const lldb::addr_t addr)
Definition: LoadedModuleInfoList.h:62
lldb_private::LoadedModuleInfoList::add
void add(const LoadedModuleInfo &mod)
Definition: LoadedModuleInfoList.h:106
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::m_dynamic
lldb::addr_t m_dynamic
Definition: LoadedModuleInfoList.h:101
lldb-defines.h
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::set_name
void set_name(const std::string &name)
Definition: LoadedModuleInfoList.h:38
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::has_info
bool has_info(e_data_point datum) const
Definition: LoadedModuleInfoList.h:80
lldb_private::LoadedModuleInfoList::clear
void clear()
Definition: LoadedModuleInfoList.h:108
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::get_name
bool get_name(std::string &out) const
Definition: LoadedModuleInfoList.h:42
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::e_has_dynamic
@ e_has_dynamic
Definition: LoadedModuleInfoList.h:28
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::e_data_point
e_data_point
Definition: LoadedModuleInfoList.h:25
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::LoadedModuleInfoList
Definition: LoadedModuleInfoList.h:21
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::e_has_base
@ e_has_base
Definition: LoadedModuleInfoList.h:27
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::e_num
@ e_num
Definition: LoadedModuleInfoList.h:30
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::set_base
void set_base(const lldb::addr_t base)
Definition: LoadedModuleInfoList.h:47
lldb-private-forward.h
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::set_dynamic
void set_dynamic(const lldb::addr_t addr)
Definition: LoadedModuleInfoList.h:71
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::set_base_is_offset
void set_base_is_offset(bool is_offset)
Definition: LoadedModuleInfoList.h:56
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::m_base
lldb::addr_t m_base
Definition: LoadedModuleInfoList.h:99
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::get_base_is_offset
bool get_base_is_offset(bool &out) const
Definition: LoadedModuleInfoList.h:57
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::m_name
std::string m_name
Definition: LoadedModuleInfoList.h:97
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::get_link_map
bool get_link_map(lldb::addr_t &out) const
Definition: LoadedModuleInfoList.h:66
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::e_has_name
@ e_has_name
Definition: LoadedModuleInfoList.h:26
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::get_base
bool get_base(lldb::addr_t &out) const
Definition: LoadedModuleInfoList.h:51
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::get_dynamic
bool get_dynamic(lldb::addr_t &out) const
Definition: LoadedModuleInfoList.h:75
lldb-types.h
lldb_private::LoadedModuleInfoList::m_link_map
lldb::addr_t m_link_map
Definition: LoadedModuleInfoList.h:111
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::e_has_link_map
@ e_has_link_map
Definition: LoadedModuleInfoList.h:29
uint32_t
lldb_private::LoadedModuleInfoList::LoadedModuleInfoList
LoadedModuleInfoList()
Definition: LoadedModuleInfoList.h:104
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:86
lldb_private::LoadedModuleInfoList::m_list
std::vector< LoadedModuleInfo > m_list
Definition: LoadedModuleInfoList.h:110
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::m_has
bool m_has[e_num]
Definition: LoadedModuleInfoList.h:96
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::m_base_is_offset
bool m_base_is_offset
Definition: LoadedModuleInfoList.h:100
lldb_private::LoadedModuleInfoList::LoadedModuleInfo
Definition: LoadedModuleInfoList.h:23
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::LoadedModuleInfo
LoadedModuleInfo()
Definition: LoadedModuleInfoList.h:33
lldb_private::LoadedModuleInfoList::LoadedModuleInfo::m_link_map
lldb::addr_t m_link_map
Definition: LoadedModuleInfoList.h:98