1//===-- SBMemoryRegionInfo.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_API_SBMEMORYREGIONINFO_H
10#define LLDB_API_SBMEMORYREGIONINFO_H
11
12#include "lldb/API/SBData.h"
13#include "lldb/API/SBDefines.h"
14
15namespace lldb {
16
17class LLDB_API SBMemoryRegionInfo {
18public:
19 SBMemoryRegionInfo();
20
21 SBMemoryRegionInfo(const lldb::SBMemoryRegionInfo &rhs);
22
23 SBMemoryRegionInfo(const char *name, lldb::addr_t begin, lldb::addr_t end,
24 uint32_t permissions, bool mapped,
25 bool stack_memory = false);
26
27 ~SBMemoryRegionInfo();
28
29 const lldb::SBMemoryRegionInfo &
30 operator=(const lldb::SBMemoryRegionInfo &rhs);
31
32 void Clear();
33
34 /// Get the base address of this memory range.
35 ///
36 /// \return
37 /// The base address of this memory range.
38 lldb::addr_t GetRegionBase();
39
40 /// Get the end address of this memory range.
41 ///
42 /// \return
43 /// The base address of this memory range.
44 lldb::addr_t GetRegionEnd();
45
46 /// Check if this memory address is marked readable to the process.
47 ///
48 /// \return
49 /// true if this memory address is marked readable
50 bool IsReadable();
51
52 /// Check if this memory address is marked writable to the process.
53 ///
54 /// \return
55 /// true if this memory address is marked writable
56 bool IsWritable();
57
58 /// Check if this memory address is marked executable to the process.
59 ///
60 /// \return
61 /// true if this memory address is marked executable
62 bool IsExecutable();
63
64 /// Check if this memory address is mapped into the process address
65 /// space.
66 ///
67 /// \return
68 /// true if this memory address is in the process address space.
69 bool IsMapped();
70
71 /// Returns the name of the memory region mapped at the given
72 /// address.
73 ///
74 /// \return
75 /// In case of memory mapped files it is the absolute path of
76 /// the file otherwise it is a name associated with the memory
77 /// region. If no name can be determined the returns nullptr.
78 const char *GetName();
79
80 /// Returns whether this memory region has a list of memory pages
81 /// that have been modified -- that are dirty.
82 ///
83 /// \return
84 /// True if the dirty page list is available.
85 bool HasDirtyMemoryPageList();
86
87 /// Returns the number of modified pages -- dirty pages -- in this
88 /// memory region.
89 ///
90 /// \return
91 /// The number of dirty page entries will be returned. If
92 /// there are no dirty pages in this memory region, 0 will
93 /// be returned. 0 will also be returned if the dirty page
94 /// list is not available for this memory region -- you must
95 /// use HasDirtyMemoryPageList() to check for that.
96 uint32_t GetNumDirtyPages();
97
98 /// Returns the address of a memory page that has been modified in
99 /// this region.
100 ///
101 /// \return
102 /// Returns the address for his dirty page in the list.
103 /// If this memory region does not have a dirty page list,
104 /// LLDB_INVALID_ADDRESS is returned.
105 addr_t GetDirtyPageAddressAtIndex(uint32_t idx);
106
107 /// Returns the size of a memory page in this region.
108 ///
109 /// \return
110 /// Returns the size of the memory pages in this region,
111 /// or 0 if this information is unavailable.
112 int GetPageSize();
113
114 bool operator==(const lldb::SBMemoryRegionInfo &rhs) const;
115
116 bool operator!=(const lldb::SBMemoryRegionInfo &rhs) const;
117
118 bool GetDescription(lldb::SBStream &description);
119
120private:
121 friend class SBProcess;
122 friend class SBMemoryRegionInfoList;
123
124 friend class lldb_private::ScriptInterpreter;
125
126 lldb_private::MemoryRegionInfo &ref();
127
128 const lldb_private::MemoryRegionInfo &ref() const;
129
130 // Unused.
131 SBMemoryRegionInfo(const lldb_private::MemoryRegionInfo *lldb_object_ptr);
132
133 lldb::MemoryRegionInfoUP m_opaque_up;
134};
135
136} // namespace lldb
137
138#endif // LLDB_API_SBMEMORYREGIONINFO_H
139

source code of lldb/include/lldb/API/SBMemoryRegionInfo.h