ROSE 0.11.145.192
GlobalVariable.h
1#ifndef ROSE_BinaryAnalysis_Variables_GlobalVariable_H
2#define ROSE_BinaryAnalysis_Variables_GlobalVariable_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
5
6#include <Rose/BinaryAnalysis/AddressInterval.h>
7#include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h>
8#include <Rose/BinaryAnalysis/Variables/BaseVariable.h>
9
10#include <Sawyer/IntervalMap.h>
11
12namespace Rose {
13namespace BinaryAnalysis {
14namespace Variables {
15
18 Address address_ = 0; // starting (lowest) virtual address
19
20#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
21private:
22 friend class boost::serialization::access;
23
24 template<class S>
25 void serialize(S &s, const unsigned /*version*/) {
26 s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(BaseVariable);
27 s & BOOST_SERIALIZATION_NVP(address_);
28 }
29#endif
30
31public:
36
42 GlobalVariable(Address startingAddress, rose_addr_t maxSizeBytes,
43 const std::vector<InstructionAccess> &definingInstructions = std::vector<InstructionAccess>(),
44 const std::string &name = "");
45
47
54 void address(Address va);
60 const std::string& setDefaultName();
61
67 bool operator==(const GlobalVariable &other) const;
68 bool operator!=(const GlobalVariable &other) const;
73
77 void print(std::ostream&) const;
78 std::string toString() const;
85 explicit operator bool() const {
86 return !interval().isEmpty();
87 }
88
92 bool operator!() const {
93 return interval().isEmpty();
94 }
95
97 friend std::ostream& operator<<(std::ostream&, const Rose::BinaryAnalysis::Variables::GlobalVariable&);
98};
99
106
112void erase(GlobalVariables&, const AddressInterval &toErase);
113
118void print(const GlobalVariables&,const Partitioner2::PartitionerConstPtr&, std::ostream &out, const std::string &prefix = "");
119
129
130} // namespace
131} // namespace
132} // namespace
133
134#endif
135#endif
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.
Description of a global variable.
bool operator!=(const GlobalVariable &other) const
Compare two global variable descriptors.
Address address() const
Property: Starting address.
bool operator==(const GlobalVariable &other) const
Compare two global variable descriptors.
void address(Address va)
Property: Starting address.
std::string toString() const
Printing global variable.
const std::string & setDefaultName()
Give variable a defult name.
GlobalVariable(Address startingAddress, rose_addr_t maxSizeBytes, const std::vector< InstructionAccess > &definingInstructions=std::vector< InstructionAccess >(), const std::string &name="")
Constructor.
AddressInterval interval() const
Location of variable in memory.
bool operator!() const
Predicate to test whether variable is invalid.
void print(std::ostream &) const
Printing global variable.
friend std::ostream & operator<<(std::ostream &, const Rose::BinaryAnalysis::Variables::GlobalVariable &)
Print global variable descriptor.
bool isEmpty() const
True if interval is empty.
Definition Interval.h:230
Converts text to messages.
Definition Message.h:1396
void print(const GlobalVariables &, const Partitioner2::PartitionerConstPtr &, std::ostream &out, const std::string &prefix="")
Print info about multiple global variables.
void erase(GlobalVariables &, const AddressInterval &toErase)
Erase some global variables.
AddressInterval isInconsistent(const GlobalVariables &, Sawyer::Message::Stream &)
Check that the map is consistent.
std::uint64_t Address
Address.
Definition Address.h:11
The ROSE library.