LLDB mainline
SBAddressRange.cpp
Go to the documentation of this file.
1//===-- SBAddressRange.cpp ------------------------------------------------===//
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
10#include "Utils.h"
11#include "lldb/API/SBAddress.h"
12#include "lldb/API/SBStream.h"
13#include "lldb/API/SBTarget.h"
15#include "lldb/Core/Section.h"
17#include "lldb/Utility/Stream.h"
18#include <cstddef>
19#include <memory>
20
21using namespace lldb;
22using namespace lldb_private;
23
25 : m_opaque_up(std::make_unique<AddressRange>()) {
27}
28
30 LLDB_INSTRUMENT_VA(this, rhs);
31
33}
34
36 : m_opaque_up(std::make_unique<AddressRange>(addr.ref(), byte_size)) {
37 LLDB_INSTRUMENT_VA(this, addr, byte_size);
38}
39
41
43 LLDB_INSTRUMENT_VA(this, rhs);
44
45 if (this != &rhs)
47 return *this;
48}
49
51 LLDB_INSTRUMENT_VA(this, rhs);
52
53 return ref().operator==(rhs.ref());
54}
55
57 LLDB_INSTRUMENT_VA(this, rhs);
58
59 return !(*this == rhs);
60}
61
64
65 ref().Clear();
66}
67
70
71 return ref().IsValid();
72}
73
76
78}
79
82
83 return ref().GetByteSize();
84}
85
87 const SBTarget target) {
88 LLDB_INSTRUMENT_VA(this, description, target);
89
90 return ref().GetDescription(&description.ref(), target.GetSP().get());
91}
92
94 assert(m_opaque_up && "opaque pointer must always be valid");
95 return *m_opaque_up;
96}
#define LLDB_INSTRUMENT_VA(...)
lldb::addr_t GetByteSize() const
Get the byte size of this range.
bool IsValid() const
Check the address range refers to a valid base address and has a byte size greater than zero.
const lldb::SBAddressRange & operator=(const lldb::SBAddressRange &rhs)
lldb::SBAddress GetBaseAddress() const
Get the base address of the range.
bool operator==(const SBAddressRange &rhs)
AddressRangeUP m_opaque_up
bool operator!=(const SBAddressRange &rhs)
bool GetDescription(lldb::SBStream &description, const SBTarget target)
lldb_private::AddressRange & ref() const
lldb_private::Stream & ref()
Definition: SBStream.cpp:177
lldb::TargetSP GetSP() const
Definition: SBTarget.cpp:585
A section + offset based address range class.
Definition: AddressRange.h:25
bool GetDescription(Stream *s, Target *target) const
void Clear()
Clear the object's state.
lldb::addr_t GetByteSize() const
Get accessor for the byte size of this range.
Definition: AddressRange.h:223
A class that represents a running process on the host machine.
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
Definition: Utils.h:17
Definition: SBAddress.h:15
uint64_t addr_t
Definition: lldb-types.h:80