ROSE  0.11.98.0
ConcreteLocation.h
1 #ifndef ROSE_BinaryAnalysis_ConcreteLocation_H
2 #define ROSE_BinaryAnalysis_ConcreteLocation_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 
6 #include <Rose/BinaryAnalysis/BasicTypes.h>
7 #include <Rose/BinaryAnalysis/RegisterDescriptor.h>
8 #include <Rose/Location.h>
9 
10 #include <boost/serialization/access.hpp>
11 #include <ostream>
12 #include <Sawyer/Optional.h>
13 #include <string>
14 
15 namespace Rose {
16 namespace BinaryAnalysis {
17 
26 class ConcreteLocation: public Location {
27 public:
29  enum Type {
34  };
35 
36 private:
37  RegisterDescriptor reg_;
39  RegisterDictionaryPtr regdict_;
40 
41 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
42 private:
43  friend class boost::serialization::access;
44 
45  template<class S>
46  void serialize(S &s, const unsigned /*version*/) {
47  s & BOOST_SERIALIZATION_NVP(reg_);
48  s & BOOST_SERIALIZATION_NVP(va_);
49  s & BOOST_SERIALIZATION_NVP(regdict_);
50  }
51 #endif
52 
53 public:
59  virtual ~ConcreteLocation();
60 
63  ConcreteLocation& operator=(const ConcreteLocation&);
64 
76  explicit ConcreteLocation(RegisterDescriptor);
77  explicit ConcreteLocation(RegisterDescriptor, const RegisterDictionaryPtr&);
83  explicit ConcreteLocation(rose_addr_t);
84 
89  ConcreteLocation(RegisterDescriptor, int64_t offset);
90 
92  static ConcreteLocation parse(const std::string&);
93 
94  // Inherited methods
95  virtual bool isValid() const override;
96  virtual std::string toString() const override;
97  virtual void print(std::ostream&) const override;
98  virtual std::string printableName() const override;
99  virtual bool isEqual(const Location&) const override;
100  virtual bool operator<(const Location&) const override;
101  virtual bool operator<=(const Location&) const override;
102  virtual bool operator>(const Location&) const override;
103  virtual bool operator>=(const Location&) const override;
104 
109  void print(std::ostream&, const RegisterDictionaryPtr&) const;
110 
115  int compare(const ConcreteLocation&) const;
116 
118  Type type() const;
119 
125  RegisterDictionaryPtr registerDictionary() const;
126  void registerDictionary(const RegisterDictionaryPtr&);
133  RegisterDescriptor reg() const;
134 
139  rose_addr_t address() const;
140 
145  int64_t offset() const;
146 };
147 
148 } // namespace
149 } // namespace
150 
151 #endif
152 #endif
Used by default-constructed locations.
rose_addr_t address() const
Address part of the location.
virtual bool isEqual(const Location &) const override
Equality and inequality.
Parameter in memory relative to a register.
RegisterDescriptor reg() const
Register part of the location.
Parameter is at a fixed memory address.
Type type() const
Type of location.
static ConcreteLocation parse(const std::string &)
Parse a concrete location from a string.
RegisterDictionaryPtr registerDictionary() const
Property: Register dictionary.
Main namespace for the ROSE library.
int64_t offset() const
Offset part of the location.
int compare(const ConcreteLocation &) const
Compare two concrete locations.
virtual void print(std::ostream &) const override
Output location to a stream.
Describes (part of) a physical CPU register.
Base class for location types.
Definition: Location.h:23
Binary analysis.
ConcreteLocation()
Default constructor.
virtual bool isValid() const override
Test whether this object is valid.
virtual std::string toString() const override
Convert location to string.
virtual std::string printableName() const override
Convert location to escaped, parsable string.