1 //===-- SBMemoryRegionInfo.h ------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_SBMemoryRegionInfo_h_
11 #define LLDB_SBMemoryRegionInfo_h_
12 
13 #include "lldb/API/SBData.h"
14 #include "lldb/API/SBDefines.h"
15 
16 namespace lldb {
17 
18 class LLDB_API SBMemoryRegionInfo {
19 public:
20   SBMemoryRegionInfo();
21 
22   SBMemoryRegionInfo(const lldb::SBMemoryRegionInfo &rhs);
23 
24   ~SBMemoryRegionInfo();
25 
26   const lldb::SBMemoryRegionInfo &
27   operator=(const lldb::SBMemoryRegionInfo &rhs);
28 
29   void Clear();
30 
31   //------------------------------------------------------------------
32   /// Get the base address of this memory range.
33   ///
34   /// @return
35   ///     The base address of this memory range.
36   //------------------------------------------------------------------
37   lldb::addr_t GetRegionBase();
38 
39   //------------------------------------------------------------------
40   /// Get the end address of this memory range.
41   ///
42   /// @return
43   ///     The base address of this memory range.
44   //------------------------------------------------------------------
45   lldb::addr_t GetRegionEnd();
46 
47   //------------------------------------------------------------------
48   /// Check if this memory address is marked readable to the process.
49   ///
50   /// @return
51   ///     true if this memory address is marked readable
52   //------------------------------------------------------------------
53   bool IsReadable();
54 
55   //------------------------------------------------------------------
56   /// Check if this memory address is marked writable to the process.
57   ///
58   /// @return
59   ///     true if this memory address is marked writable
60   //------------------------------------------------------------------
61   bool IsWritable();
62 
63   //------------------------------------------------------------------
64   /// Check if this memory address is marked executable to the process.
65   ///
66   /// @return
67   ///     true if this memory address is marked executable
68   //------------------------------------------------------------------
69   bool IsExecutable();
70 
71   //------------------------------------------------------------------
72   /// Check if this memory address is mapped into the process address
73   /// space.
74   ///
75   /// @return
76   ///     true if this memory address is in the process address space.
77   //------------------------------------------------------------------
78   bool IsMapped();
79 
80   //------------------------------------------------------------------
81   /// Returns the name of the memory region mapped at the given
82   /// address.
83   ///
84   /// @return
85   ///     In case of memory mapped files it is the absolute path of
86   ///     the file otherwise it is a name associated with the memory
87   ///     region. If no name can be determined the returns nullptr.
88   //------------------------------------------------------------------
89   const char *GetName();
90 
91   bool operator==(const lldb::SBMemoryRegionInfo &rhs) const;
92 
93   bool operator!=(const lldb::SBMemoryRegionInfo &rhs) const;
94 
95   bool GetDescription(lldb::SBStream &description);
96 
97 private:
98   friend class SBProcess;
99   friend class SBMemoryRegionInfoList;
100 
101   lldb_private::MemoryRegionInfo &ref();
102 
103   const lldb_private::MemoryRegionInfo &ref() const;
104 
105   // Unused.
106   SBMemoryRegionInfo(const lldb_private::MemoryRegionInfo *lldb_object_ptr);
107 
108   lldb::MemoryRegionInfoUP m_opaque_ap;
109 };
110 
111 } // namespace lldb
112 
113 #endif // LLDB_SBMemoryRegionInfo_h_
114