ROSE 0.11.145.147
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Rose::BinaryAnalysis::ConcreteLocation Class Reference

Description

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>

Inheritance diagram for Rose::BinaryAnalysis::ConcreteLocation:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::ConcreteLocation:
Collaboration graph
[legend]

Public Types

enum  Type {
  NO_LOCATION ,
  REGISTER ,
  RELATIVE ,
  ABSOLUTE
}
 Type of location. More...
 

Public Member Functions

 ConcreteLocation ()
 Default constructor.
 
 ConcreteLocation (const ConcreteLocation &)
 Copy constructor.
 
ConcreteLocationoperator= (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.
 

Member Enumeration Documentation

◆ Type

Type of location.

Enumerator
NO_LOCATION 

Used by default-constructed locations.

REGISTER 

Parameter is in a register.

RELATIVE 

Parameter in memory relative to a register.

E.g., stack.

ABSOLUTE 

Parameter is at a fixed memory address.

Definition at line 29 of file ConcreteLocation.h.

Constructor & Destructor Documentation

◆ ConcreteLocation() [1/6]

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.

◆ ConcreteLocation() [2/6]

Rose::BinaryAnalysis::ConcreteLocation::ConcreteLocation ( RegisterDescriptor  )
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.

◆ ConcreteLocation() [3/6]

Rose::BinaryAnalysis::ConcreteLocation::ConcreteLocation ( RegisterDescriptor  ,
const RegisterDictionaryPtr  
)
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.

◆ ConcreteLocation() [4/6]

Rose::BinaryAnalysis::ConcreteLocation::ConcreteLocation ( rose_addr_t  )
explicit

Address location.

Construct a concrete location that refers to an address in memory.

◆ ConcreteLocation() [5/6]

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.

◆ ConcreteLocation() [6/6]

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.

Member Function Documentation

◆ isValid()

virtual bool Rose::BinaryAnalysis::ConcreteLocation::isValid ( ) const
overridevirtual

Test whether this object is valid.

Implements Rose::Location.

◆ toString()

virtual std::string Rose::BinaryAnalysis::ConcreteLocation::toString ( ) const
overridevirtual

Convert location to string.

Returns a string representation of the location. This representation is not necessarily parsable.

See also, print.

Implements Rose::Location.

◆ print() [1/2]

virtual void Rose::BinaryAnalysis::ConcreteLocation::print ( std::ostream &  ) const
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.

◆ printableName()

virtual std::string Rose::BinaryAnalysis::ConcreteLocation::printableName ( ) const
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.

◆ isEqual()

virtual bool Rose::BinaryAnalysis::ConcreteLocation::isEqual ( const Location other) const
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.

◆ operator<()

virtual bool Rose::BinaryAnalysis::ConcreteLocation::operator< ( const Location ) const
overridevirtual

Implements Rose::Location.

◆ operator<=()

virtual bool Rose::BinaryAnalysis::ConcreteLocation::operator<= ( const Location ) const
overridevirtual

Implements Rose::Location.

◆ operator>()

virtual bool Rose::BinaryAnalysis::ConcreteLocation::operator> ( const Location ) const
overridevirtual

Implements Rose::Location.

◆ operator>=()

virtual bool Rose::BinaryAnalysis::ConcreteLocation::operator>= ( const Location ) const
overridevirtual

Implements Rose::Location.

◆ print() [2/2]

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.

◆ compare()

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.

◆ registerDictionary() [1/2]

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.

◆ registerDictionary() [2/2]

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.

◆ reg()

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.

◆ address()

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.

◆ offset()

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.


The documentation for this class was generated from the following file: