LLDB mainline
SBMemoryRegionInfo.h
Go to the documentation of this file.
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
18public:
20
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
28
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.
39
40 /// Get the end address of this memory range.
41 ///
42 /// \return
43 /// The base address of this memory range.
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.
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.
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 /// writes a description of the memory region to a SBStream.
119 ///
120 /// \param[in,out] description
121 /// A stream object where the description will be written.
122 ///
123 /// \return
124 /// Returns true if the description was successfully written,
125 /// false otherwise.
126 ///
127 /// The description format is: [Hex start - Hex End) with associated
128 /// permissions (RWX)
129 bool GetDescription(lldb::SBStream &description);
130
131private:
132 friend class SBProcess;
134 friend class SBSaveCoreOptions;
136
138
139 const lldb_private::MemoryRegionInfo &ref() const;
140
141 // Unused.
143
145};
146
147} // namespace lldb
148
149#endif // LLDB_API_SBMEMORYREGIONINFO_H
#define LLDB_API
Definition SBDefines.h:28
static llvm::StringRef GetName(XcodeSDK::Type type)
Definition XcodeSDK.cpp:21
lldb_private::MemoryRegionInfo & ref()
bool IsMapped()
Check if this memory address is mapped into the process address space.
bool IsReadable()
Check if this memory address is marked readable to the process.
int GetPageSize()
Returns the size of a memory page in this region.
bool operator==(const lldb::SBMemoryRegionInfo &rhs) const
addr_t GetDirtyPageAddressAtIndex(uint32_t idx)
Returns the address of a memory page that has been modified in this region.
lldb::addr_t GetRegionBase()
Get the base address of this memory range.
bool operator!=(const lldb::SBMemoryRegionInfo &rhs) const
bool HasDirtyMemoryPageList()
Returns whether this memory region has a list of memory pages that have been modified – that are dirt...
const lldb::SBMemoryRegionInfo & operator=(const lldb::SBMemoryRegionInfo &rhs)
bool IsWritable()
Check if this memory address is marked writable to the process.
lldb::addr_t GetRegionEnd()
Get the end address of this memory range.
lldb::MemoryRegionInfoUP m_opaque_up
bool IsExecutable()
Check if this memory address is marked executable to the process.
uint32_t GetNumDirtyPages()
Returns the number of modified pages – dirty pages – in this memory region.
bool GetDescription(lldb::SBStream &description)
writes a description of the memory region to a SBStream.
std::unique_ptr< lldb_private::MemoryRegionInfo > MemoryRegionInfoUP
uint64_t addr_t
Definition lldb-types.h:80