ROSE 0.11.145.147
|
Concrete location of data.
A concrete location is a machine register, a concrete memory address, or a memory address calculated from a register's current value and a signed byte offset.
Concrete locations are immutable objects.
See also, AbstractLocation.
Definition at line 26 of file ConcreteLocation.h.
#include <Rose/BinaryAnalysis/ConcreteLocation.h>
Public Types | |
enum | Type { NO_LOCATION , REGISTER , RELATIVE , ABSOLUTE } |
Type of location. More... | |
Public Member Functions | |
ConcreteLocation () | |
Default constructor. | |
ConcreteLocation (const ConcreteLocation &) | |
Copy constructor. | |
ConcreteLocation & | operator= (const ConcreteLocation &) |
ConcreteLocation (rose_addr_t) | |
Address location. | |
virtual bool | isValid () const override |
Test whether this object is valid. | |
virtual std::string | toString () const override |
Convert location to string. | |
virtual void | print (std::ostream &) const override |
Output location to a stream. | |
virtual std::string | printableName () const override |
Convert location to escaped, parsable string. | |
virtual bool | isEqual (const Location &) const override |
Equality and inequality. | |
virtual bool | operator< (const Location &) const override |
virtual bool | operator<= (const Location &) const override |
virtual bool | operator> (const Location &) const override |
virtual bool | operator>= (const Location &) const override |
void | print (std::ostream &, const RegisterDictionaryPtr &) const |
Print using the specified register dictionary. | |
int | compare (const ConcreteLocation &) const |
Compare two concrete locations. | |
Type | type () const |
Type of location. | |
RegisterDescriptor | reg () const |
Register part of the location. | |
rose_addr_t | address () const |
Address part of the location. | |
int64_t | offset () const |
Offset part of the location. | |
ConcreteLocation (RegisterDescriptor) | |
Register location. | |
ConcreteLocation (RegisterDescriptor, const RegisterDictionaryPtr &) | |
Register location. | |
ConcreteLocation (RegisterDescriptor, int64_t offset) | |
Register and offset location. | |
ConcreteLocation (RegisterDescriptor, int64_t offset, const RegisterDictionaryPtr &) | |
Register and offset location. | |
RegisterDictionaryPtr | registerDictionary () const |
Property: Register dictionary. | |
void | registerDictionary (const RegisterDictionaryPtr &) |
Property: Register dictionary. | |
Public Member Functions inherited from Rose::Location | |
virtual bool | operator== (const Location &other) const final |
Equality and inequality. | |
virtual bool | operator!= (const Location &other) const final |
Equality and inequality. | |
virtual | operator bool () const final |
Test whether this object is valid. | |
virtual bool | operator! () const final |
Test whether this object is empty. | |
virtual bool | isEmpty () const final |
Test whether this object is empty. | |
Static Public Member Functions | |
static ConcreteLocation | parse (const std::string &) |
Parse a concrete location from a string. | |
Type of location.
Definition at line 29 of file ConcreteLocation.h.
Rose::BinaryAnalysis::ConcreteLocation::ConcreteLocation | ( | ) |
Default constructor.
Constructs a concrete location that does not refer to any location. The isEmpty method return true for such objects.
|
explicit |
Register location.
Construct a concrete location that refers to a register. The optional register dictionary can be associated with the location and is only used when printing the location.
|
explicit |
Register location.
Construct a concrete location that refers to a register. The optional register dictionary can be associated with the location and is only used when printing the location.
|
explicit |
Address location.
Construct a concrete location that refers to an address in memory.
Rose::BinaryAnalysis::ConcreteLocation::ConcreteLocation | ( | RegisterDescriptor | , |
int64_t | offset | ||
) |
Register and offset location.
Construct a concrete location that refers to an address in memory calculated by adding a register's value and a signed byte offset. The optional register dictionary can be associated with the location and is only used when printing the location.
Rose::BinaryAnalysis::ConcreteLocation::ConcreteLocation | ( | RegisterDescriptor | , |
int64_t | offset, | ||
const RegisterDictionaryPtr & | |||
) |
Register and offset location.
Construct a concrete location that refers to an address in memory calculated by adding a register's value and a signed byte offset. The optional register dictionary can be associated with the location and is only used when printing the location.
|
overridevirtual |
Test whether this object is valid.
Implements Rose::Location.
|
overridevirtual |
Convert location to string.
Returns a string representation of the location. This representation is not necessarily parsable.
See also, print.
Implements Rose::Location.
|
overridevirtual |
Output location to a stream.
The format is the same as the toString method and is not necessarily parsable.
See also, toString.
Implements Rose::Location.
|
overridevirtual |
Convert location to escaped, parsable string.
Returns a string that can be safely emitted to a terminal. The format should also be parsable so the static parse
method in subclasses can create an equal object from the string.
Implements Rose::Location.
|
overridevirtual |
Equality and inequality.
Objects are equal if they are the same type and they point to the same location. Otherwise they are unequal.
The operator== is implemented in the base class only. For the expression a == b
it calls both a.isEqual(b)
and b.isEqual(a)
, returning true only if both tests return true. Subclasses should implement x.isEqual(y)
by dynamic casting y
to the type of x
and returning true if and only if the cast succeeds and x
and y
point to the same location.
The operator!= is implemented in the base class as the complement of operator==.
Implements Rose::Location.
|
overridevirtual |
Implements Rose::Location.
|
overridevirtual |
Implements Rose::Location.
|
overridevirtual |
Implements Rose::Location.
|
overridevirtual |
Implements Rose::Location.
void Rose::BinaryAnalysis::ConcreteLocation::print | ( | std::ostream & | , |
const RegisterDictionaryPtr & | |||
) | const |
Print using the specified register dictionary.
Concrete locations have an optional internal register dictionary pointer that's usually used for printing, but this method provides a way to use some other register dictionary.
int Rose::BinaryAnalysis::ConcreteLocation::compare | ( | const ConcreteLocation & | ) | const |
Compare two concrete locations.
Returns negative if this location is less than the other
, positive if this location is greater than the other
, or zero if this and the other
location are equal.
RegisterDictionaryPtr Rose::BinaryAnalysis::ConcreteLocation::registerDictionary | ( | ) | const |
Property: Register dictionary.
This is the optional register dictionary associated with this location and used when printing the location.
void Rose::BinaryAnalysis::ConcreteLocation::registerDictionary | ( | const RegisterDictionaryPtr & | ) |
Property: Register dictionary.
This is the optional register dictionary associated with this location and used when printing the location.
RegisterDescriptor Rose::BinaryAnalysis::ConcreteLocation::reg | ( | ) | const |
Register part of the location.
Returns the register part of the location. This returns a valid register descriptor if the location is either a register or an indirect (register plus offset) memory address. Otherwise it returns the empty register descriptor.
rose_addr_t Rose::BinaryAnalysis::ConcreteLocation::address | ( | ) | const |
Address part of the location.
Returns the address of the location if the location is a simple memory address. Otherwise, if the address is formed from a base register and an offset, or if the location is a register, then zero is returned.
int64_t Rose::BinaryAnalysis::ConcreteLocation::offset | ( | ) | const |
Offset part of the location.
Returns the signed offset when the location is a memory address formed from a register base value and an offset. Otherwise it returns zero.