SBMemoryRegionInfo.h revision 360660
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_SBMemoryRegionInfo_h_
10#define LLDB_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();
24
25  const lldb::SBMemoryRegionInfo &
26  operator=(const lldb::SBMemoryRegionInfo &rhs);
27
28  void Clear();
29
30  /// Get the base address of this memory range.
31  ///
32  /// \return
33  ///     The base address of this memory range.
34  lldb::addr_t GetRegionBase();
35
36  /// Get the end address of this memory range.
37  ///
38  /// \return
39  ///     The base address of this memory range.
40  lldb::addr_t GetRegionEnd();
41
42  /// Check if this memory address is marked readable to the process.
43  ///
44  /// \return
45  ///     true if this memory address is marked readable
46  bool IsReadable();
47
48  /// Check if this memory address is marked writable to the process.
49  ///
50  /// \return
51  ///     true if this memory address is marked writable
52  bool IsWritable();
53
54  /// Check if this memory address is marked executable to the process.
55  ///
56  /// \return
57  ///     true if this memory address is marked executable
58  bool IsExecutable();
59
60  /// Check if this memory address is mapped into the process address
61  /// space.
62  ///
63  /// \return
64  ///     true if this memory address is in the process address space.
65  bool IsMapped();
66
67  /// Returns the name of the memory region mapped at the given
68  /// address.
69  ///
70  /// \return
71  ///     In case of memory mapped files it is the absolute path of
72  ///     the file otherwise it is a name associated with the memory
73  ///     region. If no name can be determined the returns nullptr.
74  const char *GetName();
75
76  bool operator==(const lldb::SBMemoryRegionInfo &rhs) const;
77
78  bool operator!=(const lldb::SBMemoryRegionInfo &rhs) const;
79
80  bool GetDescription(lldb::SBStream &description);
81
82private:
83  friend class SBProcess;
84  friend class SBMemoryRegionInfoList;
85
86  lldb_private::MemoryRegionInfo &ref();
87
88  const lldb_private::MemoryRegionInfo &ref() const;
89
90  // Unused.
91  SBMemoryRegionInfo(const lldb_private::MemoryRegionInfo *lldb_object_ptr);
92
93  lldb::MemoryRegionInfoUP m_opaque_up;
94};
95
96} // namespace lldb
97
98#endif // LLDB_SBMemoryRegionInfo_h_
99