Skip to content

Commit 786e94d

Browse files
author
Miro Bucko
committed
[lldb] Fix SBAddressRange validation checks.
1 parent 1623866 commit 786e94d

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

lldb/source/API/SBAddressRange.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ const SBAddressRange &SBAddressRange::operator=(const SBAddressRange &rhs) {
5050
bool SBAddressRange::operator==(const SBAddressRange &rhs) {
5151
LLDB_INSTRUMENT_VA(this, rhs);
5252

53-
if (!IsValid() || !rhs.IsValid())
54-
return false;
5553
return m_opaque_up->operator==(*(rhs.m_opaque_up));
5654
}
5755

@@ -64,40 +62,30 @@ bool SBAddressRange::operator!=(const SBAddressRange &rhs) {
6462
void SBAddressRange::Clear() {
6563
LLDB_INSTRUMENT_VA(this);
6664

67-
m_opaque_up.reset();
65+
m_opaque_up->Clear();
6866
}
6967

7068
bool SBAddressRange::IsValid() const {
7169
LLDB_INSTRUMENT_VA(this);
7270

73-
return m_opaque_up && m_opaque_up->IsValid();
71+
return m_opaque_up->IsValid();
7472
}
7573

7674
lldb::SBAddress SBAddressRange::GetBaseAddress() const {
7775
LLDB_INSTRUMENT_VA(this);
7876

79-
if (!IsValid())
80-
return lldb::SBAddress();
8177
return lldb::SBAddress(m_opaque_up->GetBaseAddress());
8278
}
8379

8480
lldb::addr_t SBAddressRange::GetByteSize() const {
8581
LLDB_INSTRUMENT_VA(this);
8682

87-
if (!IsValid())
88-
return 0;
8983
return m_opaque_up->GetByteSize();
9084
}
9185

9286
bool SBAddressRange::GetDescription(SBStream &description,
9387
const SBTarget target) {
9488
LLDB_INSTRUMENT_VA(this, description, target);
9589

96-
Stream &stream = description.ref();
97-
if (!IsValid()) {
98-
stream << "<invalid>";
99-
return true;
100-
}
101-
m_opaque_up->GetDescription(&stream, target.GetSP().get());
102-
return true;
90+
return m_opaque_up->GetDescription(&description.ref(), target.GetSP().get());
10391
}

lldb/test/API/python_api/address_range/TestAddressRange.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def test_address_range_list_iterator(self):
166166
def test_address_range_print_invalid(self):
167167
"""Make sure the SBAddressRange can be printed when invalid."""
168168
range = lldb.SBAddressRange()
169-
self.assertEqual(str(range), "<invalid>")
169+
self.assertEqual(str(range), "[0xffffffffffffffff-0xffffffffffffffff)")
170170

171171
def test_address_range_print_resolved(self):
172172
"""Make sure the SBAddressRange can be printed when resolved."""

0 commit comments

Comments
 (0)