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

Description

Description of a local stack variable within a function.

Definition at line 153 of file Variables.h.

#include <Rose/BinaryAnalysis/Variables.h>

Inheritance diagram for Rose::BinaryAnalysis::Variables::StackVariable:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::Variables::StackVariable:
Collaboration graph
[legend]

Classes

struct  Boundary
 Boundary between stack variables. More...
 

Public Types

enum class  Purpose {
  RETURN_ADDRESS ,
  FRAME_POINTER ,
  SPILL_AREA ,
  NORMAL ,
  UNKNOWN ,
  OTHER
}
 Purpose of variable. More...
 
using Boundaries = std::vector< Boundary >
 List of boundaries.
 

Public Member Functions

 StackVariable ()
 Default constructor.
 
 StackVariable (const Partitioner2::FunctionPtr &, int64_t frameOffset, rose_addr_t maxSizeBytes, Purpose, const AddressSet &definingInstructionVas=AddressSet(), const std::string &name="")
 Construct a variable descriptor.
 
 StackVariable (const StackVariable &)
 
const std::string & setDefaultName ()
 Give variable a defult name.
 
OffsetInterval interval () const
 Location within the function stack frame.
 
 operator bool () const
 Predicate to test whether variable is valid.
 
bool operator! () const
 Predicate to test whether variable is invalid.
 
Partitioner2::FunctionPtr function () const
 Property: Function owning the variable.
 
void function (const Partitioner2::FunctionPtr &)
 Property: Function owning the variable.
 
int64_t frameOffset () const
 Property: Frame offset.
 
void frameOffset (int64_t offset)
 Property: Frame offset.
 
Purpose purpose () const
 Property: Purpose.
 
void purpose (Purpose p)
 Property: Purpose.
 
bool operator== (const StackVariable &other) const
 Compare two local variables.
 
bool operator!= (const StackVariable &other) const
 Compare two local variables.
 
void print (std::ostream &) const
 Printing local variable.
 
std::string toString () const
 Printing local variable.
 
- Public Member Functions inherited from Rose::BinaryAnalysis::Variables::BaseVariable
 BaseVariable (const BaseVariable &)
 
rose_addr_t maxSizeBytes () const
 Property: Maximum variable size in bytes.
 
void maxSizeBytes (rose_addr_t size)
 Property: Maximum variable size in bytes.
 
const AddressSetdefiningInstructionVas () const
 Property: Addresses of instructions related to this variable.
 
AddressSetdefiningInstructionVas ()
 Property: Addresses of instructions related to this variable.
 
void definingInstructionVas (const AddressSet &vas)
 Property: Addresses of instructions related to this variable.
 
const InstructionSemantics::BaseSemantics::InputOutputPropertySetioProperties () const
 Property: I/O properties.
 
InstructionSemantics::BaseSemantics::InputOutputPropertySetioProperties ()
 Property: I/O properties.
 
void ioProperties (const InstructionSemantics::BaseSemantics::InputOutputPropertySet &set)
 Property: I/O properties.
 
const std::string & name () const
 Property: Optional variable name.
 
void name (const std::string &s)
 Property: Optional variable name.
 

Static Public Member Functions

static BoundaryinsertBoundary (Boundaries &, int64_t frameOffset, rose_addr_t insnVa)
 Insert a new boundary or adjust an existing boundary.
 

Additional Inherited Members

- Protected Member Functions inherited from Rose::BinaryAnalysis::Variables::BaseVariable
 BaseVariable ()
 Default constructor.
 
 BaseVariable (size_t maxSizeBytes, const AddressSet &definingInstructionVas, const std::string &name)
 Construct a variable with a given maximum size.
 

Member Typedef Documentation

◆ Boundaries

List of boundaries.

Definition at line 176 of file Variables.h.

Member Enumeration Documentation

◆ Purpose

Purpose of variable.

Enumerator
RETURN_ADDRESS 

Possible or known return address.

FRAME_POINTER 

Pointer to previous stack frame.

SPILL_AREA 

Callee-saved registers.

NORMAL 

Normal source code level variable.

UNKNOWN 

Purpose is unknown.

OTHER 

None of the above purposes.

Definition at line 156 of file Variables.h.

Constructor & Destructor Documentation

◆ StackVariable()

Rose::BinaryAnalysis::Variables::StackVariable::StackVariable ( )

Default constructor.

Creates an invalid (zero-sized) variable descriptor.

Member Function Documentation

◆ function() [1/2]

Partitioner2::FunctionPtr Rose::BinaryAnalysis::Variables::StackVariable::function ( ) const

Property: Function owning the variable.

A default constructed object will have a null function pointer. All other objects have a valid function pointer.

◆ function() [2/2]

void Rose::BinaryAnalysis::Variables::StackVariable::function ( const Partitioner2::FunctionPtr )

Property: Function owning the variable.

A default constructed object will have a null function pointer. All other objects have a valid function pointer.

◆ frameOffset() [1/2]

int64_t Rose::BinaryAnalysis::Variables::StackVariable::frameOffset ( ) const

Property: Frame offset.

This is the address of the variable relative to the function's start-of-frame. For multi-byte variables, this is the lowest address of the variable. Depending on the architecture, the start-of-frame could be higher or lower than the variable, thus the return value is signed.

◆ frameOffset() [2/2]

void Rose::BinaryAnalysis::Variables::StackVariable::frameOffset ( int64_t  offset)

Property: Frame offset.

This is the address of the variable relative to the function's start-of-frame. For multi-byte variables, this is the lowest address of the variable. Depending on the architecture, the start-of-frame could be higher or lower than the variable, thus the return value is signed.

◆ purpose() [1/2]

Purpose Rose::BinaryAnalysis::Variables::StackVariable::purpose ( ) const

Property: Purpose.

Areas of a stack frame serve different purposes. This property describes the purpose.

◆ purpose() [2/2]

void Rose::BinaryAnalysis::Variables::StackVariable::purpose ( Purpose  p)

Property: Purpose.

Areas of a stack frame serve different purposes. This property describes the purpose.

◆ setDefaultName()

const std::string & Rose::BinaryAnalysis::Variables::StackVariable::setDefaultName ( )

Give variable a defult name.

This variable's name is replaced by a generated name and the name is returned.

◆ operator==()

bool Rose::BinaryAnalysis::Variables::StackVariable::operator== ( const StackVariable other) const

Compare two local variables.

Local variables are equal if and only if they belong to the same function, have the same frame offset, and have the same maximum size or both are default constructed.

◆ operator!=()

Compare two local variables.

Local variables are equal if and only if they belong to the same function, have the same frame offset, and have the same maximum size or both are default constructed.

◆ insertBoundary()

static Boundary & Rose::BinaryAnalysis::Variables::StackVariable::insertBoundary ( Boundaries ,
int64_t  frameOffset,
rose_addr_t  insnVa 
)
static

Insert a new boundary or adjust an existing boundary.

The boundaries are assumed to be unsorted, and if a new boundary is inserted it is inserted at the end of the list.

◆ operator bool()

Rose::BinaryAnalysis::Variables::StackVariable::operator bool ( ) const
inlineexplicit

Predicate to test whether variable is valid.

Returns true if the variable is valid, i.e., if it has a non-zero size. Default constructed variables have a zero size.

Definition at line 273 of file Variables.h.

References interval(), and Sawyer::Container::Interval< T >::isEmpty().

◆ operator!()

bool Rose::BinaryAnalysis::Variables::StackVariable::operator! ( ) const
inline

Predicate to test whether variable is invalid.

Returns true if the variable is invalid, i.e., if it has a zero size.

Definition at line 280 of file Variables.h.

References interval(), and Sawyer::Container::Interval< T >::isEmpty().


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