mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-23 20:59:58 +00:00
Merge remote-tracking branch 'origin/GP-2079_RelativePointerCompare'
(Closes #4224)
This commit is contained in:
commit
91f44ba36e
@ -1870,6 +1870,26 @@ void TypePointerRel::printRaw(ostream &s) const
|
||||
s << ']';
|
||||
}
|
||||
|
||||
int4 TypePointerRel::compare(const Datatype &op,int4 level) const
|
||||
|
||||
{
|
||||
int4 res = TypePointer::compare(op,level); // Compare as plain pointers first
|
||||
if (res != 0) return res;
|
||||
// Both must be relative pointers
|
||||
TypePointerRel *tp = (TypePointerRel *) &op;
|
||||
// Its possible a formal relative pointer gets compared to its equivalent ephemeral version.
|
||||
// In which case, we prefer the formal version.
|
||||
if (stripped == (TypePointer *)0) {
|
||||
if (tp->stripped != (TypePointer *)0)
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
if (tp->stripped == (TypePointer *)0)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int4 TypePointerRel::compareDependency(const Datatype &op) const
|
||||
|
||||
{
|
||||
|
@ -461,6 +461,7 @@ public:
|
||||
/// \return the offset value in \e address \e units
|
||||
int4 getPointerOffset(void) const { return AddrSpace::byteToAddressInt(offset, wordsize); }
|
||||
virtual void printRaw(ostream &s) const;
|
||||
virtual int4 compare(const Datatype &op,int4 level) const;
|
||||
virtual int4 compareDependency(const Datatype &op) const;
|
||||
virtual Datatype *clone(void) const { return new TypePointerRel(*this); }
|
||||
virtual void saveXml(ostream &s) const;
|
||||
|
Loading…
Reference in New Issue
Block a user