xref: /llvm-project/lldb/include/lldb/API/SBAddressRange.h (revision a083e50f53f0f9eb9ad0c5b65f3c627cf97043e6)
1 //===-- SBAddressRange.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_SBADDRESSRANGE_H
10 #define LLDB_API_SBADDRESSRANGE_H
11 
12 #include "lldb/API/SBDefines.h"
13 
14 namespace lldb_private {
15 class AddressRange;
16 }
17 
18 namespace lldb {
19 
20 class LLDB_API SBAddressRange {
21 public:
22   SBAddressRange();
23 
24   SBAddressRange(const lldb::SBAddressRange &rhs);
25 
26   SBAddressRange(lldb::SBAddress addr, lldb::addr_t byte_size);
27 
28   ~SBAddressRange();
29 
30   const lldb::SBAddressRange &operator=(const lldb::SBAddressRange &rhs);
31 
32   void Clear();
33 
34   /// Check the address range refers to a valid base address and has a byte
35   /// size greater than zero.
36   ///
37   /// \return
38   ///     True if the address range is valid, false otherwise.
39   bool IsValid() const;
40 
41   /// Get the base address of the range.
42   ///
43   /// \return
44   ///     Base address object.
45   lldb::SBAddress GetBaseAddress() const;
46 
47   /// Get the byte size of this range.
48   ///
49   /// \return
50   ///     The size in bytes of this address range.
51   lldb::addr_t GetByteSize() const;
52 
53   bool operator==(const SBAddressRange &rhs);
54 
55   bool operator!=(const SBAddressRange &rhs);
56 
57   bool GetDescription(lldb::SBStream &description, const SBTarget target);
58 
59 private:
60   friend class SBAddressRangeList;
61   friend class SBBlock;
62   friend class SBFunction;
63   friend class SBProcess;
64 
65   lldb_private::AddressRange &ref() const;
66 
67   AddressRangeUP m_opaque_up;
68 };
69 
70 } // namespace lldb
71 
72 #endif // LLDB_API_SBADDRESSRANGE_H
73