1303241Sdim//===-- SBMemoryRegionInfo.h ------------------------------------*- C++ -*-===//
2303241Sdim//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6303241Sdim//
7303241Sdim//===----------------------------------------------------------------------===//
8303241Sdim
9303241Sdim#ifndef LLDB_SBMemoryRegionInfo_h_
10303241Sdim#define LLDB_SBMemoryRegionInfo_h_
11303241Sdim
12314564Sdim#include "lldb/API/SBData.h"
13303241Sdim#include "lldb/API/SBDefines.h"
14303241Sdim
15303241Sdimnamespace lldb {
16303241Sdim
17314564Sdimclass LLDB_API SBMemoryRegionInfo {
18303241Sdimpublic:
19314564Sdim  SBMemoryRegionInfo();
20303241Sdim
21314564Sdim  SBMemoryRegionInfo(const lldb::SBMemoryRegionInfo &rhs);
22303241Sdim
23314564Sdim  ~SBMemoryRegionInfo();
24303241Sdim
25314564Sdim  const lldb::SBMemoryRegionInfo &
26314564Sdim  operator=(const lldb::SBMemoryRegionInfo &rhs);
27303241Sdim
28314564Sdim  void Clear();
29303241Sdim
30314564Sdim  /// Get the base address of this memory range.
31314564Sdim  ///
32353358Sdim  /// \return
33314564Sdim  ///     The base address of this memory range.
34314564Sdim  lldb::addr_t GetRegionBase();
35303241Sdim
36314564Sdim  /// Get the end address of this memory range.
37314564Sdim  ///
38353358Sdim  /// \return
39314564Sdim  ///     The base address of this memory range.
40314564Sdim  lldb::addr_t GetRegionEnd();
41303241Sdim
42314564Sdim  /// Check if this memory address is marked readable to the process.
43314564Sdim  ///
44353358Sdim  /// \return
45314564Sdim  ///     true if this memory address is marked readable
46314564Sdim  bool IsReadable();
47303241Sdim
48314564Sdim  /// Check if this memory address is marked writable to the process.
49314564Sdim  ///
50353358Sdim  /// \return
51314564Sdim  ///     true if this memory address is marked writable
52314564Sdim  bool IsWritable();
53303241Sdim
54314564Sdim  /// Check if this memory address is marked executable to the process.
55314564Sdim  ///
56353358Sdim  /// \return
57314564Sdim  ///     true if this memory address is marked executable
58314564Sdim  bool IsExecutable();
59303241Sdim
60314564Sdim  /// Check if this memory address is mapped into the process address
61314564Sdim  /// space.
62314564Sdim  ///
63353358Sdim  /// \return
64314564Sdim  ///     true if this memory address is in the process address space.
65314564Sdim  bool IsMapped();
66303241Sdim
67314564Sdim  /// Returns the name of the memory region mapped at the given
68314564Sdim  /// address.
69314564Sdim  ///
70353358Sdim  /// \return
71314564Sdim  ///     In case of memory mapped files it is the absolute path of
72314564Sdim  ///     the file otherwise it is a name associated with the memory
73314564Sdim  ///     region. If no name can be determined the returns nullptr.
74314564Sdim  const char *GetName();
75303241Sdim
76314564Sdim  bool operator==(const lldb::SBMemoryRegionInfo &rhs) const;
77303241Sdim
78314564Sdim  bool operator!=(const lldb::SBMemoryRegionInfo &rhs) const;
79303241Sdim
80314564Sdim  bool GetDescription(lldb::SBStream &description);
81303241Sdim
82303241Sdimprivate:
83314564Sdim  friend class SBProcess;
84314564Sdim  friend class SBMemoryRegionInfoList;
85303241Sdim
86314564Sdim  lldb_private::MemoryRegionInfo &ref();
87303241Sdim
88314564Sdim  const lldb_private::MemoryRegionInfo &ref() const;
89303241Sdim
90344779Sdim  // Unused.
91314564Sdim  SBMemoryRegionInfo(const lldb_private::MemoryRegionInfo *lldb_object_ptr);
92303241Sdim
93353358Sdim  lldb::MemoryRegionInfoUP m_opaque_up;
94303241Sdim};
95303241Sdim
96303241Sdim} // namespace lldb
97303241Sdim
98303241Sdim#endif // LLDB_SBMemoryRegionInfo_h_
99