decompiler
1.0.0
|
A contiguous range of bytes in some address space. More...
#include <address.hh>
Public Member Functions | |
Range (AddrSpace *s, uintb f, uintb l) | |
Construct a Range from offsets. More... | |
Range (void) | |
Constructor for use with decode. | |
Range (const RangeProperties &properties, const AddrSpaceManager *manage) | |
Construct range out of basic properties. | |
AddrSpace * | getSpace (void) const |
Get the address space containing this Range. | |
uintb | getFirst (void) const |
Get the offset of the first byte in this Range. | |
uintb | getLast (void) const |
Get the offset of the last byte in this Range. | |
Address | getFirstAddr (void) const |
Get the address of the first byte. | |
Address | getLastAddr (void) const |
Get the address of the last byte. | |
Address | getLastAddrOpen (const AddrSpaceManager *manage) const |
Get address of first byte after this. More... | |
bool | contains (const Address &addr) const |
Determine if the address is in this Range. More... | |
bool | operator< (const Range &op2) const |
Sorting operator for Ranges. More... | |
void | printBounds (ostream &s) const |
Print this Range to a stream. More... | |
void | encode (Encoder &encoder) const |
Encode this Range to a stream. More... | |
void | decode (Decoder &decoder) |
Restore this from a stream. More... | |
void | decodeFromAttributes (Decoder &decoder) |
Read from attributes on another tag. More... | |
Private Attributes | |
AddrSpace * | spc |
Space containing range. | |
uintb | first |
Offset of first byte in this Range. | |
uintb | last |
Offset of last byte in this Range. | |
Friends | |
class | RangeList |
A contiguous range of bytes in some address space.
|
inline |
Construct a Range from offsets.
Offsets must expressed in bytes as opposed to addressable words
s | is the address space containing the range |
f | is the offset of the first byte in the range |
l | is the offset of the last byte in the range |
|
inline |
Determine if the address is in this Range.
addr | is the Address to test for containment |
References ghidra::Address::getOffset(), and ghidra::Address::getSpace().
void ghidra::Range::decode | ( | Decoder & | decoder | ) |
Restore this from a stream.
Reconstruct this object from a <range> or <register> element
decoder | is the stream decoder |
References ghidra::Decoder::closeElement(), and ghidra::Decoder::openElement().
Referenced by ghidra::RangeList::decode(), ghidra::ProtoModel::decode(), ghidra::Architecture::decodeInferPtrBounds(), ghidra::Architecture::decodeNoHighPtr(), ghidra::Architecture::decodeReadOnly(), and ghidra::Architecture::decodeVolatile().
void ghidra::Range::decodeFromAttributes | ( | Decoder & | decoder | ) |
Read from attributes on another tag.
Reconstruct from attributes that may not be part of a <range> element.
decoder | is the stream decoder |
References ghidra::Decoder::getAddrSpaceManager(), ghidra::AddrSpaceManager::getDefaultCodeSpace(), ghidra::Decoder::getNextAttributeId(), ghidra::Translate::getRegister(), ghidra::AddrSpace::getTrans(), ghidra::VarnodeData::offset, ghidra::Decoder::readSpace(), ghidra::Decoder::readString(), ghidra::Decoder::readUnsignedInteger(), ghidra::VarnodeData::size, and ghidra::VarnodeData::space.
Referenced by ghidra::ContextInternal::decodeFromSpec(), ghidra::ScopeGhidra::decodeHole(), and ghidra::ScopeInternal::decodeHole().
void ghidra::Range::encode | ( | Encoder & | encoder | ) | const |
Encode this Range to a stream.
Encode this to a stream as a <range> element.
encoder | is the stream encoder |
References ghidra::Encoder::closeElement(), ghidra::Encoder::openElement(), ghidra::Encoder::writeSpace(), and ghidra::Encoder::writeUnsignedInteger().
Address ghidra::Range::getLastAddrOpen | ( | const AddrSpaceManager * | manage | ) | const |
Get address of first byte after this.
Get the last address +1, updating the space, or returning the extremal address if necessary
manage | is used to fetch the next address space |
References ghidra::AddrSpace::getHighest(), ghidra::AddrSpaceManager::getNextSpaceInOrder(), and ghidra::Address::m_maximal.
Referenced by ghidra::Database::clearPropertyRange(), ghidra::ContextInternal::decodeFromSpec(), and ghidra::Database::setPropertyRange().
|
inline |
Sorting operator for Ranges.
Compare based on address space, then the starting offset
op2 | is the Range to compare with this |
References ghidra::Address::decode(), ghidra::Address::encode(), first, ghidra::AddrSpace::getIndex(), and spc.
void ghidra::Range::printBounds | ( | ostream & | s | ) | const |