decompiler
1.0.0
|
A low-level machine address for labelling bytes and data. More...
#include <address.hh>
Public Types | |
enum | mach_extreme { m_minimal, m_maximal } |
An enum for specifying extremal addresses. More... | |
Public Member Functions | |
Address (mach_extreme ex) | |
Initialize an extremal address. More... | |
Address (void) | |
Create an invalid address. More... | |
Address (AddrSpace *id, uintb off) | |
Construct an address with a space/offset pair. More... | |
Address (const Address &op2) | |
A copy constructor. More... | |
bool | isInvalid (void) const |
Is the address invalid? More... | |
int4 | getAddrSize (void) const |
Get the number of bytes in the address. More... | |
bool | isBigEndian (void) const |
Is data at this address big endian encoded. More... | |
void | printRaw (ostream &s) const |
Write a raw version of the address to a stream. More... | |
int4 | read (const string &s) |
Read in the address from a string. More... | |
AddrSpace * | getSpace (void) const |
Get the address space. More... | |
uintb | getOffset (void) const |
Get the address offset. More... | |
char | getShortcut (void) const |
Get the shortcut character for the address space. More... | |
Address & | operator= (const Address &op2) |
Copy an address. More... | |
bool | operator== (const Address &op2) const |
Compare two addresses for equality. More... | |
bool | operator!= (const Address &op2) const |
Compare two addresses for inequality. More... | |
bool | operator< (const Address &op2) const |
Compare two addresses via their natural ordering. More... | |
bool | operator<= (const Address &op2) const |
Compare two addresses via their natural ordering. More... | |
Address | operator+ (int8 off) const |
Increment address by a number of bytes. More... | |
Address | operator- (int8 off) const |
Decrement address by a number of bytes. More... | |
bool | containedBy (int4 sz, const Address &op2, int4 sz2) const |
Determine if op2 range contains this range. More... | |
int4 | justifiedContain (int4 sz, const Address &op2, int4 sz2, bool forceleft) const |
Determine if op2 is the least significant part of this. More... | |
int4 | overlap (int4 skip, const Address &op, int4 size) const |
Determine how this address falls in a given address range. More... | |
int4 | overlapJoin (int4 skip, const Address &op, int4 size) const |
Determine how this falls in a possible join space address range. More... | |
bool | isContiguous (int4 sz, const Address &loaddr, int4 losz) const |
Does this form a contiguous range with loaddr. More... | |
bool | isConstant (void) const |
Is this a constant value. More... | |
void | renormalize (int4 size) |
Make sure there is a backing JoinRecord if this is in the join space. More... | |
bool | isJoin (void) const |
Is this a join value. More... | |
void | encode (Encoder &encoder) const |
Encode this to a stream. More... | |
void | encode (Encoder &encoder, int4 size) const |
Encode this and a size to a stream. More... | |
Static Public Member Functions | |
static Address | decode (Decoder &decoder) |
Restore an address from parsed XML. More... | |
static Address | decode (Decoder &decoder, int4 &size) |
Restore an address and size from parsed XML. More... | |
Protected Attributes | |
AddrSpace * | base |
Pointer to our address space. | |
uintb | offset |
Offset (in bytes) | |
Friends | |
ostream & | operator<< (ostream &s, const Address &addr) |
Write out an address to stream. More... | |
A low-level machine address for labelling bytes and data.
All data that can be manipulated within the processor reverse engineering model can be labelled with an Address. It is simply an address space (AddrSpace) and an offset within that space. Note that processor registers are typically modelled by creating a dedicated address space for them, as distinct from RAM say, and then specifying certain addresses within the register space that correspond to particular registers. However, an arbitrary address could refer to anything, RAM, ROM, cpu register, data segment, coprocessor, stack, nvram, etc. An Address represents an offset only, not an offset and length
ghidra::Address::Address | ( | mach_extreme | ex | ) |
|
inline |
Create an invalid address.
An invalid address is possible in some circumstances. This deliberately constructs an invalid address
References base.
Referenced by ghidra::Range::getFirstAddr(), ghidra::Range::getLastAddr(), operator+(), and operator-().
|
inline |
|
inline |
bool ghidra::Address::containedBy | ( | int4 | sz, |
const Address & | op2, | ||
int4 | sz2 | ||
) | const |
Determine if op2 range contains this range.
Return true if the range starting at this extending the given number of bytes is contained by the second given range.
sz | is the given number of bytes in this range |
op2 | is the start of the second given range |
sz2 | is the number of bytes in the second given range |
Referenced by ghidra::FuncProto::characterizeAsInputParam(), ghidra::FuncProto::characterizeAsOutput(), ghidra::FuncProto::getBiggestContainedInputParam(), and ghidra::FuncProto::getBiggestContainedOutput().
Restore an address from parsed XML.
This is usually used to decode an address from an <addr> element, but any element can be used if it has the appropriate attributes
or a name attribute can be used to recover an address based on a register name.
decoder | is the stream decoder |
References ghidra::VarnodeData::decode(), ghidra::VarnodeData::offset, and ghidra::VarnodeData::space.
Referenced by ghidra::LoadTable::decode(), ghidra::StringManager::decode(), ghidra::Comment::decode(), ghidra::Override::decode(), ghidra::ParamEntry::decode(), ghidra::SymbolEntry::decode(), ghidra::SeqNum::decode(), ghidra::Funcdata::decode(), ghidra::SegmentOp::decode(), ghidra::ExternRefSymbol::decode(), ghidra::JumpTable::decode(), ghidra::TypeSpacebase::decode(), ghidra::ProtoStoreInternal::decode(), ghidra::FuncProto::decode(), ghidra::Architecture::decodeFlowOverride(), ghidra::GhidraTranslate::getRegister(), ghidra::InjectPayloadGhidra::inject(), ghidra::ExecutablePcodeGhidra::inject(), ghidra::DecompileAt::loadParameters(), ghidra::RangeList::numRanges(), ghidra::GhidraTranslate::oneInstruction(), ghidra::SeqNum::operator<(), and ghidra::Range::operator<().
Restore an address and size from parsed XML.
This is usually used to decode an address from an <addr> element, but any element can be used if it has the appropriate attributes
or a name attribute can be used to recover an address and size based on a register name. If a size is recovered it is stored in size reference.
decoder | is the stream decoder |
size | is the reference to any recovered size |
References ghidra::VarnodeData::decode(), ghidra::VarnodeData::offset, ghidra::VarnodeData::size, and ghidra::VarnodeData::space.
|
inline |
Encode this to a stream.
Save an <addr> element corresponding to this address to a stream. The exact format is determined by the address space, but this generally has a space and an offset attribute.
encoder | is the stream encoder |
References base, ghidra::Encoder::closeElement(), ghidra::AddrSpace::encodeAttributes(), offset, and ghidra::Encoder::openElement().
Referenced by ghidra::InjectContextGhidra::encode(), ghidra::LoadTable::encode(), ghidra::SymbolEntry::encode(), ghidra::Funcdata::encode(), ghidra::ExternRefSymbol::encode(), ghidra::EffectRecord::encode(), ghidra::JumpTable::encode(), ghidra::ProtoStoreInternal::encode(), ghidra::FuncProto::encode(), ghidra::ArchitectureGhidra::getBytes(), ghidra::ArchitectureGhidra::getCodeLabel(), ghidra::ArchitectureGhidra::getComments(), ghidra::ArchitectureGhidra::getExternalRef(), ghidra::ArchitectureGhidra::getMappedSymbolsXML(), ghidra::ArchitectureGhidra::getPcode(), ghidra::ArchitectureGhidra::getRegisterName(), ghidra::ArchitectureGhidra::getStringData(), ghidra::ArchitectureGhidra::getTrackedRegisters(), ghidra::RangeList::numRanges(), ghidra::SeqNum::operator<(), and ghidra::Range::operator<().
|
inline |
Encode this and a size to a stream.
Encode an <addr> element corresponding to this address to a stream. The tag will also include an extra size attribute so that it can describe an entire memory range.
encoder | is the stream encoder |
size | is the number of bytes in the range |
References base, ghidra::Encoder::closeElement(), ghidra::AddrSpace::encodeAttributes(), offset, and ghidra::Encoder::openElement().
|
inline |
Get the number of bytes in the address.
Get the number of bytes needed to encode the offset for this address.
References base, and ghidra::AddrSpace::getAddrSize().
Referenced by ghidra::ScopeLocal::buildVariableName(), ghidra::ScopeInternal::buildVariableName(), ghidra::IfcAddrrangeLoad::execute(), ghidra::ToOpEdge::hash(), ghidra::Heritage::normalizeReadSize(), ghidra::Heritage::normalizeWriteSize(), and ghidra::Funcdata::spacebaseConstant().
|
inline |
Get the address offset.
Get the offset of the address as an integer.
References offset.
Referenced by ghidra::Scope::addDynamicSymbol(), ghidra::Scope::addEquateSymbol(), ghidra::Scope::addMap(), ghidra::ScopeInternal::addMapInternal(), ghidra::Scope::addMapPoint(), ghidra::Scope::addUnionFacetSymbol(), ghidra::ScopeLocal::adjustFit(), ghidra::Funcdata::adjustInputVarnodes(), ghidra::ActionShadowVar::apply(), ghidra::ActionRestrictLocal::apply(), ghidra::ParamEntry::assumedExtension(), ghidra::ActionInferTypes::buildLocaltypes(), ghidra::FuncCallSpecs::buildParam(), ghidra::Heritage::buildRefinement(), ghidra::ArchitectureGhidra::buildSymbols(), ghidra::SleighArchitecture::buildSymbols(), ghidra::ScopeLocal::buildVariableName(), ghidra::ScopeInternal::buildVariableName(), ghidra::ParamListStandard::characterizeAsParam(), ghidra::Varnode::characterizeOverlap(), ghidra::Funcdata::checkForLanedRegister(), ghidra::ParamListStandard::checkJoin(), ghidra::Heritage::collect(), ghidra::Varnode::constantMatch(), ghidra::AddrSpaceManager::constructFloatExtensionAddress(), ghidra::AddrSpaceManager::constructJoinAddress(), ghidra::ParamEntry::containedBy(), ghidra::Range::contains(), ghidra::Varnode::contains(), ghidra::Funcdata::coverVarnodes(), ghidra::ParamEntry::decode(), ghidra::SegmentOp::decode(), ghidra::ScopeGhidra::dump2Cache(), ghidra::EffectRecord::EffectRecord(), ghidra::PrintC::emitLabel(), ghidra::PrintLanguage::emitLineComment(), ghidra::Comment::encode(), ghidra::SeqNum::encode(), ghidra::Varnode::encode(), ghidra::JumpBasicOverride::encode(), ghidra::Database::encode(), ghidra::FspecSpace::encodeAttributes(), ghidra::ContextInternal::encodeContext(), ghidra::ContextDatabase::encodeTracked(), ghidra::VarnodeBank::endLoc(), ghidra::SymbolEntry::EntrySubsort::EntrySubsort(), ghidra::IfcMapunionfacet::execute(), ghidra::IfcPrintdisasm::execute(), ghidra::IfcGlobalAdd::execute(), ghidra::IfcGlobalRemove::execute(), ghidra::IfcVolatile::execute(), ghidra::IfcReadonly::execute(), ghidra::IfcPreferSplit::execute(), ghidra::EmulatePcodeCache::executeBranch(), ghidra::ScopeLocal::fakeInputSymbols(), ghidra::ScopeInternal::findAddr(), ghidra::ScopeInternal::findClosestFit(), ghidra::ScopeInternal::findCodeLabel(), ghidra::ScopeGhidra::findContainer(), ghidra::ScopeInternal::findContainer(), ghidra::VarnodeBank::findCoveredInput(), ghidra::VarnodeBank::findCoveringInput(), ghidra::Funcdata::findDisjointCover(), ghidra::ParamListStandard::findEntry(), ghidra::ScopeInternal::findExternalRef(), ghidra::ScopeInternal::findFunction(), ghidra::ScopeInternal::findOverlap(), ghidra::Funcdata::Funcdata(), ghidra::ActionFuncLink::funcLinkInput(), ghidra::FuncProto::getBiggestContainedInputParam(), ghidra::FuncProto::getBiggestContainedOutput(), ghidra::ParamListStandard::getBiggestContainedParam(), ghidra::ParamEntry::getContainer(), ghidra::ContextInternal::getContext(), ghidra::ContextCache::getContext(), ghidra::SymbolEntry::getFirst(), ghidra::FuncCallSpecs::getFspecFromConst(), ghidra::SymbolEntry::getLast(), ghidra::Symbol::getMapEntry(), ghidra::Varnode::getOffset(), ghidra::PcodeOp::getOpFromConst(), ghidra::DisassemblyCache::getParserContext(), ghidra::FlowInfo::getSize(), ghidra::SymbolEntry::getSizedType(), ghidra::ParamEntry::getSlot(), ghidra::Architecture::getSpaceBySpacebase(), ghidra::TypeSpacebase::getSubType(), ghidra::Heritage::guardCallOverlappingInput(), ghidra::Heritage::guardCallOverlappingOutput(), ghidra::Heritage::guardCalls(), ghidra::Heritage::guardInput(), ghidra::Heritage::guardLoads(), ghidra::Heritage::guardReturnsOverlapping(), ghidra::FuncCallSpecs::hasEffectTranslate(), ghidra::ToOpEdge::hash(), ghidra::RangeList::inRange(), ghidra::ParamEntry::intersects(), ghidra::Varnode::intersects(), ghidra::LoadGuard::isGuarded(), ghidra::ParamEntry::justifiedContain(), ghidra::Funcdata::linkSymbolReference(), ghidra::RawLoadImage::loadFill(), ghidra::RangeList::longestFit(), ghidra::Funcdata::mapGlobals(), ghidra::ScopeLocal::markUnaliased(), ghidra::TypeSpacebase::nearestArrayedComponentForward(), ghidra::Sleigh::oneInstruction(), overlapJoin(), ghidra::JoinSpace::overlapJoin(), ghidra::LoadImageXml::pad(), ghidra::Varnode::printRawNoMarkup(), ghidra::ActionInferTypes::propagateRef(), ghidra::ScopeLocal::remapSymbol(), ghidra::ScopeLocal::remapSymbolDynamic(), ghidra::AddrSpaceManager::renormalizeJoinAddress(), ghidra::FuncProto::resolveExtraPop(), ghidra::FuncCallSpecs::resolveSpacebaseRelative(), ghidra::JumpBasic::sanityCheck(), ghidra::JumpTable::sanityCheck(), ghidra::ContextCache::setContext(), ghidra::BlockBasic::setInitialRange(), ghidra::SleighBuilder::setUniqueOffset(), ghidra::Funcdata::spacebaseConstant(), ghidra::Heritage::splitByRefinement(), ghidra::Heritage::splitPieces(), ghidra::FuncProto::unjustifiedInputParam(), and ghidra::Varnode::Varnode().
|
inline |
Get the shortcut character for the address space.
Each address has a shortcut character associated with it for use with the read and printRaw methods.
References base, and ghidra::AddrSpace::getShortcut().
Referenced by ghidra::PrintC::emitLabel(), ghidra::ArchitectureGhidra::getBytes(), ghidra::FlowInfo::handleOutOfBounds(), ghidra::RawLoadImage::loadFill(), ghidra::GhidraTranslate::oneInstruction(), ghidra::SymbolEntry::printEntry(), ghidra::IopSpace::printRaw(), ghidra::Varnode::printRawNoMarkup(), and ghidra::VarnodeBank::setDef().
|
inline |
Get the address space.
Get the address space associated with this address.
References base.
Referenced by ghidra::Scope::addDynamicSymbol(), ghidra::Scope::addEquateSymbol(), ghidra::ScopeGhidraNamespace::addMapInternal(), ghidra::ScopeInternal::addMapInternal(), ghidra::Scope::addMapPoint(), ghidra::Scope::addUnionFacetSymbol(), ghidra::ActionDeindirect::apply(), ghidra::ActionRestrictLocal::apply(), ghidra::RulePiecePathology::applyOp(), ghidra::ActionMarkExplicit::baseExplicit(), ghidra::JumpBasic::buildAddresses(), ghidra::JumpAssisted::buildAddresses(), ghidra::FuncCallSpecs::buildParam(), ghidra::ArchitectureGhidra::buildSymbols(), ghidra::SleighArchitecture::buildSymbols(), ghidra::ScopeLocal::buildVariableName(), ghidra::ScopeInternal::buildVariableName(), ghidra::ParamListStandard::characterizeAsParam(), ghidra::Varnode::characterizeOverlap(), ghidra::Funcdata::checkForLanedRegister(), ghidra::Heritage::collect(), ghidra::FuncCallSpecs::commitNewInputs(), ghidra::FuncCallSpecs::commitNewOutputs(), ghidra::AddrSpaceManager::constructFloatExtensionAddress(), ghidra::AddrSpaceManager::constructJoinAddress(), ghidra::ParamEntry::containedBy(), ghidra::Range::contains(), ghidra::Varnode::contains(), ghidra::ParamEntry::decode(), ghidra::SegmentOp::decode(), ghidra::ScopeInternal::decode(), ghidra::ScopeGhidra::dump2Cache(), ghidra::EffectRecord::EffectRecord(), ghidra::PrintC::emitLabel(), ghidra::PrintLanguage::emitLineComment(), ghidra::Comment::encode(), ghidra::SeqNum::encode(), ghidra::Varnode::encode(), ghidra::JumpBasicOverride::encode(), ghidra::Database::encode(), ghidra::FspecSpace::encodeAttributes(), ghidra::ContextInternal::encodeContext(), ghidra::ContextDatabase::encodeTracked(), ghidra::VarnodeBank::endLoc(), ghidra::SymbolEntry::EntrySubsort::EntrySubsort(), ghidra::IfcMapaddress::execute(), ghidra::IfcGlobalAdd::execute(), ghidra::IfcGlobalRemove::execute(), ghidra::IfcVolatile::execute(), ghidra::IfcReadonly::execute(), ghidra::IfcPreferSplit::execute(), ghidra::ScopeLocal::fakeInputSymbols(), ghidra::ScopeInternal::findAddr(), ghidra::ScopeInternal::findClosestFit(), ghidra::ScopeInternal::findCodeLabel(), ghidra::ScopeInternal::findContainer(), ghidra::VarnodeBank::findCoveredInput(), ghidra::VarnodeBank::findCoveringInput(), ghidra::ParamListStandard::findEntry(), ghidra::ScopeInternal::findExternalRef(), ghidra::ScopeInternal::findFunction(), ghidra::ScopeInternal::findOverlap(), ghidra::FlowInfo::findRelTarget(), ghidra::PieceNode::findRoot(), ghidra::IfaceDecompData::followFlow(), ghidra::FuncCallSpecs::FuncCallSpecs(), ghidra::ActionFuncLink::funcLinkInput(), ghidra::FuncProto::getBiggestContainedInputParam(), ghidra::FuncProto::getBiggestContainedOutput(), ghidra::ParamListStandard::getBiggestContainedParam(), ghidra::ContextInternal::getContext(), ghidra::ContextCache::getContext(), ghidra::TypeOpCallind::getInputLocal(), ghidra::TypeOpIndirect::getInputLocal(), ghidra::Symbol::getMapEntry(), ghidra::Varnode::getSpace(), ghidra::Architecture::getSpaceBySpacebase(), ghidra::Heritage::guardCalls(), ghidra::Heritage::guardInput(), ghidra::Heritage::guardLoads(), ghidra::Heritage::guardStores(), ghidra::FuncCallSpecs::hasEffectTranslate(), ghidra::Architecture::highPtrPossible(), ghidra::Funcdata::inlineFlow(), ghidra::RangeList::inRange(), ghidra::ParamEntry::intersects(), ghidra::Varnode::intersects(), ghidra::LoadGuard::isGuarded(), ghidra::ParamEntry::justifiedContain(), ghidra::RangeList::longestFit(), ghidra::ProtoModel::lookupEffect(), overlapJoin(), ghidra::JoinSpace::overlapJoin(), ghidra::LoadImageXml::pad(), ghidra::Heritage::placeMultiequals(), ghidra::Varnode::printRawNoMarkup(), ghidra::ActionInferTypes::propagateRef(), ghidra::PrintC::pushPartialSymbol(), ghidra::PrintC::pushUnnamedLocation(), ghidra::IfaceDecompData::readVarnode(), ghidra::ParamActive::registerTrial(), ghidra::FlowInfo::reinterpreted(), ghidra::ScopeLocal::remapSymbol(), ghidra::ScopeLocal::remapSymbolDynamic(), ghidra::ScopeGhidra::removeQuery(), ghidra::Heritage::removeRevisitedMarkers(), ghidra::Funcdata::removeUnreachableBlocks(), ghidra::FuncCallSpecs::resolveSpacebaseRelative(), ghidra::ContextCache::setContext(), ghidra::EmulateFunction::setExecuteAddress(), ghidra::BlockBasic::setInitialRange(), ghidra::Funcdata::spacebaseConstant(), ghidra::Heritage::splitByRefinement(), ghidra::Funcdata::startProcessing(), ghidra::FlowInfo::target(), ghidra::FuncCallSpecs::transferLockedInputParam(), ghidra::JumpBasicOverride::trialNorm(), ghidra::FuncProto::unjustifiedInputParam(), and ghidra::Varnode::Varnode().
|
inline |
Is data at this address big endian encoded.
Determine if data stored at this address is big endian encoded.
References base, and ghidra::AddrSpace::isBigEndian().
Referenced by ghidra::Scope::addMap(), ghidra::RuleLeftRight::applyOp(), ghidra::SplitDatatype::buildInSubpieces(), ghidra::SplitDatatype::buildOutConcats(), ghidra::Heritage::concatPieces(), ghidra::AddrSpaceManager::constructJoinAddress(), ghidra::SubvariableFlow::getReplacementAddress(), ghidra::Heritage::normalizeWriteSize(), ghidra::Heritage::splitPieces(), and ghidra::RulePtrFlow::truncatePointer().
|
inline |
Is this a constant value.
Determine if this address is from the constant space. All constant values are represented as an offset into the constant space.
References base, ghidra::AddrSpace::getType(), and ghidra::IPTR_CONSTANT.
Referenced by ghidra::Scope::discoverScope(), ghidra::Scope::stackAddr(), ghidra::Scope::stackClosestFit(), ghidra::Scope::stackCodeLabel(), ghidra::Scope::stackContainer(), ghidra::Scope::stackExternalRef(), and ghidra::Scope::stackFunction().
bool ghidra::Address::isContiguous | ( | int4 | sz, |
const Address & | loaddr, | ||
int4 | losz | ||
) | const |
Does this form a contiguous range with loaddr.
Does the location this, sz form a contiguous region to loaddr, losz, where this forms the most significant piece of the logical whole
sz | is the size of this hi region |
loaddr | is the starting address of the low region |
losz | is the size of the low region |
Referenced by ghidra::ParamListStandard::checkJoin(), and ghidra::AddrSpaceManager::constructJoinAddress().
|
inline |
Is the address invalid?
Determine if this is an invalid address. This only detects deliberate invalid addresses.
References base.
Referenced by ghidra::Scope::addDynamicSymbol(), ghidra::Scope::addEquateSymbol(), ghidra::Scope::addMap(), ghidra::Scope::addMapPoint(), ghidra::Scope::addUnionFacetSymbol(), ghidra::ParamListStandard::assignAddress(), ghidra::Scope::buildDefaultName(), ghidra::SleighArchitecture::buildSymbols(), ghidra::Database::clearPropertyRange(), ghidra::FuncCallSpecs::countMatchingCalls(), ghidra::FuncProto::decode(), ghidra::ContextInternal::decodeContext(), ghidra::ScopeGhidra::dump2Cache(), ghidra::SymbolEntry::encode(), ghidra::FspecSpace::encodeAttributes(), ghidra::IfcSetcontextrange::execute(), ghidra::IfcSettrackedrange::execute(), ghidra::ScopeInternal::findAddr(), ghidra::ScopeInternal::findClosestFit(), ghidra::ScopeInternal::findContainer(), ghidra::Funcdata::findLinkedVarnode(), ghidra::ContextInternal::getRegionForSet(), ghidra::FlowInfo::inlineClone(), ghidra::RangeList::inRange(), ghidra::SymbolEntry::inUse(), ghidra::SymbolEntry::isDynamic(), ghidra::SymbolEntry::isInvalid(), ghidra::ActionConstantPtr::isPointer(), ghidra::Funcdata::linkSymbolReference(), ghidra::RangeList::longestFit(), ghidra::SymbolEntry::printEntry(), ghidra::PrintC::pushPtrCharConstant(), ghidra::FlowInfo::queryCall(), ghidra::IfaceDecompData::readVarnode(), ghidra::ScopeLocal::remapSymbol(), ghidra::ScopeLocal::remapSymbolDynamic(), ghidra::AddrSpaceManager::renormalizeJoinAddress(), ghidra::Database::setPropertyRange(), ghidra::FlowInfo::setupCallindSpecs(), and ghidra::FlowInfo::target().
|
inline |
Is this a join value.
Determine if this address represents a set of joined memory locations.
References base, ghidra::AddrSpace::getType(), and ghidra::IPTR_JOIN.
Referenced by ghidra::Scope::addMap(), and ghidra::RulePullsubMulti::buildSubpiece().
int4 ghidra::Address::justifiedContain | ( | int4 | sz, |
const Address & | op2, | ||
int4 | sz2, | ||
bool | forceleft | ||
) | const |
Determine if op2 is the least significant part of this.
Return -1 if (op2,sz2) is not properly contained in (this,sz). If it is contained, return the endian aware offset of (op2,sz2) I.e. if the least significant byte of the op2 range falls on the least significant byte of the this range, return 0. If it intersects the second least significant, return 1, etc. The -forceleft- toggle causes the check to be made against the left (lowest address) side of the container, regardless of the endianness. I.e. it forces a little endian interpretation.
sz | is the size of this range |
op2 | is the address of the second range |
sz2 | is the size of the second range |
forceleft | is true if containments is forced to be on the left even for big endian |
Referenced by ghidra::Funcdata::adjustInputVarnodes(), ghidra::FuncProto::characterizeAsInputParam(), ghidra::FuncProto::characterizeAsOutput(), ghidra::Heritage::guardCallOverlappingInput(), ghidra::ParamEntry::justifiedContain(), ghidra::FuncProto::possibleInputParam(), ghidra::FuncProto::possibleOutputParam(), ghidra::FuncCallSpecs::transferLockedOutputParam(), and ghidra::FuncProto::unjustifiedInputParam().
|
inline |
Compare two addresses for inequality.
Check if two addresses are not equal. I.e. if either their address space or offset are different.
op2 | is the address to compare to this |
|
inline |
Increment address by a number of bytes.
Add an integer value to the offset portion of the address. The addition takes into account the size of the address space, and the Address will wrap around if necessary.
off | is the number to add to the offset |
References Address(), base, offset, and ghidra::AddrSpace::wrapOffset().
|
inline |
Decrement address by a number of bytes.
Subtract an integer value from the offset portion of the address. The subtraction takes into account the size of the address space, and the Address will wrap around if necessary.
off | is the number to subtract from the offset |
References Address(), base, offset, and ghidra::AddrSpace::wrapOffset().
|
inline |
Compare two addresses via their natural ordering.
Do an ordering comparison of two addresses. Addresses are sorted first on space, then on offset. So two addresses in the same space compare naturally based on their offset, but addresses in different spaces also compare. Different spaces are ordered by their index.
op2 | is the address to compare to |
References base, ghidra::AddrSpace::getIndex(), and offset.
|
inline |
Compare two addresses via their natural ordering.
Do an ordering comparison of two addresses.
op2 | is the address to compare to |
References base, ghidra::AddrSpace::getIndex(), and offset.
|
inline |
int4 ghidra::Address::overlap | ( | int4 | skip, |
const Address & | op, | ||
int4 | size | ||
) | const |
Determine how this address falls in a given address range.
If this + skip falls in the range op to op + size, then a non-negative integer is returned indicating where in the interval it falls. I.e. if this + skip == op, then 0 is returned. Otherwise -1 is returned.
skip | is an adjust to this address |
op | is the start of the range to check |
size | is the size of the range |
References base, ghidra::IPTR_CONSTANT, and offset.
Referenced by ghidra::LocationMap::add(), ghidra::RulePieceStructure::determineDatatype(), ghidra::LocationMap::find(), ghidra::LocationMap::findPass(), ghidra::ParamEntry::getContainer(), ghidra::LoadImageXml::loadFill(), ghidra::ProtoModel::lookupEffect(), ghidra::ProtoModel::lookupRecord(), and ghidra::ParamActive::whichTrial().
|
inline |
Determine how this falls in a possible join space address range.
This method is equivalent to Address::overlap, but a range in the join space can be considered overlapped with its constituent pieces. If this + skip falls in the range, op to op + size, then a non-negative integer is returned indicating where in the interval it falls. Otherwise -1 is returned.
skip | is an adjust to this address |
op | is the start of the range to check |
size | is the size of the range |
References base, getOffset(), getSpace(), offset, and ghidra::AddrSpace::overlapJoin().
Referenced by ghidra::HighVariable::setSymbol().
|
inline |
Write a raw version of the address to a stream.
Write a short-hand or debug version of this address to a stream.
s | is the stream being written |
References base, offset, and ghidra::AddrSpace::printRaw().
Referenced by ghidra::AddTreeState::apply(), ghidra::ActionSegmentize::apply(), ghidra::RuleSwitchSingle::applyOp(), ghidra::FlowInfo::checkContainedCall(), ghidra::IfaceAssemblyEmit::dump(), ghidra::PrintC::emitLabel(), ghidra::Funcdata::fillinReadOnly(), ghidra::FlowInfo::findRelTarget(), ghidra::IfaceDecompData::followFlow(), ghidra::ActionFuncLink::funcLinkOutput(), ghidra::PrintC::genericFunctionName(), ghidra::ArchitectureGhidra::getBytes(), ghidra::FlowInfo::handleOutOfBounds(), ghidra::Heritage::heritage(), ghidra::LoadImageXml::loadFill(), ghidra::RawLoadImage::loadFill(), ghidra::Architecture::nameFunction(), ghidra::GhidraTranslate::oneInstruction(), ghidra::SymbolEntry::printEntry(), ghidra::IopSpace::printRaw(), ghidra::FspecSpace::printRaw(), ghidra::Varnode::printRawNoMarkup(), ghidra::PrintC::pushUnnamedLocation(), ghidra::FlowInfo::recoverJumpTables(), ghidra::FlowInfo::reinterpreted(), ghidra::Heritage::removeRevisitedMarkers(), ghidra::Funcdata::removeUnreachableBlocks(), and ghidra::FlowInfo::target().
|
inline |
Read in the address from a string.
Convert a string into an address. The string format can be tailored for the particular address space.
s | is the string to parse |
References base, offset, and ghidra::AddrSpace::read().
void ghidra::Address::renormalize | ( | int4 | size | ) |
Make sure there is a backing JoinRecord if this is in the join space.
If this is (originally) a join address, reevaluate it in terms of its new offset and size, changing the space and offset if necessary.
size | is the new size in bytes of the underlying object |
References ghidra::IPTR_JOIN.
Referenced by ghidra::RulePullsubMulti::applyOp(), ghidra::RuleLeftRight::applyOp(), ghidra::RulePieceStructure::applyOp(), ghidra::SplitDatatype::buildInSubpieces(), ghidra::SplitDatatype::buildOutConcats(), ghidra::SplitDatatype::buildOutVarnodes(), ghidra::RulePullsubMulti::buildSubpiece(), ghidra::TransformVar::createReplacement(), ghidra::PieceNode::findRoot(), ghidra::SubvariableFlow::getReplacementAddress(), and ghidra::RulePtrFlow::truncatePointer().
|
friend |
Write out an address to stream.
This allows an Address to be written to a stream using the standard '<<' operator. This is a wrapper for the printRaw method and is intended for debugging and console mode uses.
s | is the stream being written to |
addr | is the Address to write |
Referenced by ghidra::SeqNum::operator<().