ROSE  0.9.9.109
BinaryStackVariable.h
1 #ifndef ROSE_BinaryAnalysis_StackVariable_H
2 #define ROSE_BinaryAnalysis_StackVariable_H
3 
4 #include <BaseSemantics2.h>
5 #include <MemoryCellList.h>
6 #include <Sawyer/Interval.h>
7 #include <boost/serialization/access.hpp>
8 
9 namespace Rose {
10 namespace BinaryAnalysis {
11 
14  int64_t offset;
15  size_t nBytes;
18 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
19 private:
20  friend class boost::serialization::access;
21 
22  template<class S>
23  void serialize(S &s, const unsigned version) {
24  s & BOOST_SERIALIZATION_NVP(offset);
25  s & BOOST_SERIALIZATION_NVP(nBytes);
26  s & BOOST_SERIALIZATION_NVP(address);
27  }
28 #endif
29 
30 public:
32  : offset(0), nBytes(0) {}
33  StackVariableLocation(int64_t offset, size_t nBytes, const InstructionSemantics2::BaseSemantics::SValuePtr &address)
34  : offset(offset), nBytes(nBytes), address(address) {}
35  typedef Sawyer::Container::Interval<int64_t> Interval;
36  Interval interval() const { return Interval::baseSize(offset, nBytes); }
37 };
38 
44 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
45 private:
46  friend class boost::serialization::access;
47 
48  template<class S>
49  void serialize(S &s, const unsigned version) {
50  s & BOOST_SERIALIZATION_NVP(writers);
51  s & BOOST_SERIALIZATION_NVP(ioProperties);
52  }
53 #endif
54 
55 public:
59  : writers(writers), ioProperties(ioProperties) {}
60  bool operator==(const StackVariableMeta &other) const {
61  return writers == other.writers && ioProperties == other.ioProperties;
62  }
63 };
64 
66 struct StackVariable {
70 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
71 private:
72  friend class boost::serialization::access;
73 
74  template<class S>
75  void serialize(S &s, const unsigned version) {
76  s & BOOST_SERIALIZATION_NVP(location);
77  s & BOOST_SERIALIZATION_NVP(meta);
78  }
79 #endif
80 
81 public:
82  StackVariable() {}
83  StackVariable(const StackVariableLocation &location, const StackVariableMeta &meta)
84  : location(location), meta(meta) {}
85 };
86 
88 typedef std::vector<StackVariable> StackVariables;
89 
90 } // namespace
91 } // namespace
92 
93 #endif
StackVariableMeta meta
Meta-data for the stack variable.
InstructionSemantics2::BaseSemantics::MemoryCellList::AddressSet writers
Instructions that wrote to a location.
Meta information for a stack variable.
A multi-byte variable that appears on the stack.
std::vector< StackVariable > StackVariables
Multiple stack variables.
Main namespace for the ROSE library.
int64_t offset
Signed offset from initial stack pointer.
InstructionSemantics2::BaseSemantics::SValuePtr address
Complete address, not just the stack offset.
static Interval baseSize(T lo, T size)
Construct an interval from one endpoint and a size.
Definition: Interval.h:161
Sawyer::Container::Set< rose_addr_t > AddressSet
Set of concrete virtual addresses.
Sawyer::SharedPointer< class SValue > SValuePtr
Shared-ownership pointer to a semantic value in any domain.
StackVariableLocation location
Location of the stack variable.
InstructionSemantics2::BaseSemantics::InputOutputPropertySet ioProperties
Properties of a location.
Information about the location of a stack variable.
Range of values delimited by endpoints.
Definition: Interval.h:33
Sawyer::Container::Set< InputOutputProperty > InputOutputPropertySet
Set of Boolean properties.
size_t nBytes
Size of variable in bytes.