1#ifndef ROSE_BinaryAnalysis_Variables_StackVariable_H
2#define ROSE_BinaryAnalysis_Variables_StackVariable_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
6#include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h>
7#include <Rose/BinaryAnalysis/Variables/BaseVariable.h>
9#include <Sawyer/IntervalMap.h>
11#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
12#include <boost/serialization/access.hpp>
16namespace BinaryAnalysis {
48 int64_t stackOffset_ = 0;
51#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
53 friend class boost::serialization::access;
56 void serialize(S &s,
const unsigned version) {
58 s & BOOST_SERIALIZATION_NVP(function_);
59 s & BOOST_SERIALIZATION_NVP(stackOffset_);
61 s & BOOST_SERIALIZATION_NVP(purpose_);
73 const std::vector<InstructionAccess> &definingInstructions = std::vector<InstructionAccess>(),
74 const std::string &
name =
"");
150 explicit operator bool()
const {
Base class describing a source-level variable.
rose_addr_t maxSizeBytes() const
Property: Maximum variable size in bytes.
const std::string & name() const
Property: Optional variable name.
Information about how an instruction accesses a variable.
Description of a local stack variable within a function.
std::string toString() const
Printing local variable.
OffsetInterval interval() const
Location of variable w.r.t.
const std::string & setDefaultName()
Give variable a defult name.
friend std::ostream & operator<<(std::ostream &, const Rose::BinaryAnalysis::Variables::StackVariable &)
Print local variable descriptor.
static void printBoundary(std::ostream &, const Boundary &, const std::string &prefix="")
Print information about a boundary.
bool operator==(const StackVariable &other) const
Compare two local variables.
bool operator!=(const StackVariable &other) const
Compare two local variables.
static Boundary & insertBoundary(Boundaries &, int64_t stackOffset, const InstructionAccess &)
Insert a new boundary or adjust an existing boundary.
std::vector< Boundary > Boundaries
List of boundaries.
Purpose purpose() const
Property: Purpose.
void stackOffset(int64_t offset)
Property: Stack offset.
int64_t stackOffset() const
Property: Stack offset.
void print(std::ostream &) const
Printing local variable.
Purpose
Purpose of variable.
@ OTHER
None of the above purposes.
@ NORMAL
Normal source code level variable.
@ UNKNOWN
Purpose is unknown.
@ RETURN_ADDRESS
Possible or known return address.
@ SPILL_AREA
Callee-saved registers.
@ FRAME_POINTER
Pointer to previous stack frame.
@ STACK_POINTER
Saved stack pointer.
static Boundary & insertBoundaryImplied(Boundaries &, int64_t stackOffset)
Insert a new boundary or adjust an existing boundary.
StackVariable(const Partitioner2::FunctionPtr &, int64_t stackOffset, rose_addr_t maxSizeBytes, Purpose, const std::vector< InstructionAccess > &definingInstructions=std::vector< InstructionAccess >(), const std::string &name="")
Construct a variable descriptor.
StackVariable()
Default constructor.
void purpose(Purpose p)
Property: Purpose.
void function(const Partitioner2::FunctionPtr &)
Property: Function owning the variable.
bool operator!() const
Predicate to test whether variable is invalid.
Partitioner2::FunctionPtr function() const
Property: Function owning the variable.
Range of values delimited by endpoints.
bool isEmpty() const
True if interval is empty.
void print(const GlobalVariables &, const Partitioner2::PartitionerConstPtr &, std::ostream &out, const std::string &prefix="")
Print info about multiple global variables.
Boundary between stack variables.
std::vector< InstructionAccess > definingInsns
Instructions that define this boundary.
Purpose purpose
Purpose of addresses above this boundary.
int64_t stackOffset
Offset from function's initial stack pointer.