LLDB  mainline
SBMemoryRegionInfoList.cpp
Go to the documentation of this file.
1 //===-- SBMemoryRegionInfoList.cpp ------------------------------*- 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 
10 #include "SBReproducerPrivate.h"
12 #include "lldb/API/SBStream.h"
14 
15 #include <vector>
16 
17 using namespace lldb;
18 using namespace lldb_private;
19 
21 public:
22  MemoryRegionInfoListImpl() : m_regions() {}
23 
25  : m_regions(rhs.m_regions) {}
26 
28  if (this == &rhs)
29  return *this;
30  m_regions = rhs.m_regions;
31  return *this;
32  }
33 
34  size_t GetSize() const { return m_regions.size(); }
35 
36  void Reserve(size_t capacity) { return m_regions.reserve(capacity); }
37 
38  void Append(const MemoryRegionInfo &sb_region) {
39  m_regions.push_back(sb_region);
40  }
41 
42  void Append(const MemoryRegionInfoListImpl &list) {
43  Reserve(GetSize() + list.GetSize());
44 
45  for (const auto &val : list.m_regions)
46  Append(val);
47  }
48 
49  void Clear() { m_regions.clear(); }
50 
51  bool GetMemoryRegionInfoAtIndex(size_t index,
52  MemoryRegionInfo &region_info) {
53  if (index >= GetSize())
54  return false;
55  region_info = m_regions[index];
56  return true;
57  }
58 
59  MemoryRegionInfos &Ref() { return m_regions; }
60 
61  const MemoryRegionInfos &Ref() const { return m_regions; }
62 
63 private:
64  MemoryRegionInfos m_regions;
65 };
66 
67 MemoryRegionInfos &SBMemoryRegionInfoList::ref() { return m_opaque_up->Ref(); }
68 
69 const MemoryRegionInfos &SBMemoryRegionInfoList::ref() const {
70  return m_opaque_up->Ref();
71 }
72 
74  : m_opaque_up(new MemoryRegionInfoListImpl()) {
76 }
77 
79  const SBMemoryRegionInfoList &rhs)
80  : m_opaque_up(new MemoryRegionInfoListImpl(*rhs.m_opaque_up)) {
82  (const lldb::SBMemoryRegionInfoList &), rhs);
83 }
84 
86 
92  rhs);
93 
94  if (this != &rhs) {
95  *m_opaque_up = *rhs.m_opaque_up;
96  }
97  return LLDB_RECORD_RESULT(*this);
98 }
99 
102 
103  return m_opaque_up->GetSize();
104 }
105 
107  uint32_t idx, SBMemoryRegionInfo &region_info) {
109  (uint32_t, lldb::SBMemoryRegionInfo &), idx, region_info);
110 
111  return m_opaque_up->GetMemoryRegionInfoAtIndex(idx, region_info.ref());
112 }
113 
116 
117  m_opaque_up->Clear();
118 }
119 
122  (lldb::SBMemoryRegionInfo &), sb_region);
123 
124  m_opaque_up->Append(sb_region.ref());
125 }
126 
129  (lldb::SBMemoryRegionInfoList &), sb_region_list);
130 
131  m_opaque_up->Append(*sb_region_list);
132 }
133 
135  return m_opaque_up.get();
136 }
137 
139  assert(m_opaque_up.get());
140  return *m_opaque_up;
141 }
142 
143 namespace lldb_private {
144 namespace repro {
145 
146 template <>
150  (const lldb::SBMemoryRegionInfoList &));
153  SBMemoryRegionInfoList, operator=,(
163 }
164 
165 }
166 }
The registry contains a unique mapping between functions and their ID.
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)
bool GetMemoryRegionAtIndex(uint32_t idx, SBMemoryRegionInfo &region_info)
MemoryRegionInfoListImpl(const MemoryRegionInfoListImpl &rhs)
MemoryRegionInfoListImpl & operator=(const MemoryRegionInfoListImpl &rhs)
void Append(lldb::SBMemoryRegionInfo &region)
const MemoryRegionInfoListImpl * operator->() const
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
#define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
bool GetMemoryRegionInfoAtIndex(size_t index, MemoryRegionInfo &region_info)
const MemoryRegionInfos & Ref() const
void Append(const MemoryRegionInfo &sb_region)
const SBMemoryRegionInfoList & operator=(const SBMemoryRegionInfoList &rhs)
const MemoryRegionInfoListImpl & operator*() const
Definition: SBAddress.h:15
void RegisterMethods< SBMemoryRegionInfoList >(Registry &R)
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
void Append(const MemoryRegionInfoListImpl &list)
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)
#define LLDB_RECORD_RESULT(Result)
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature)