ROSE  0.11.145.0
M68kSystem/TracingResult.h
1 #ifndef ROSE_BinaryAnalysis_Concolic_M68kSystem_TracingResult_H
2 #define ROSE_BinaryAnalysis_Concolic_M68kSystem_TracingResult_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_CONCOLIC_TESTING
5 #include <Rose/BinaryAnalysis/Concolic/BasicTypes.h>
6 
7 #include <Rose/BinaryAnalysis/Concolic/ConcreteResult.h>
8 #include <Sawyer/Trace.h>
9 
10 namespace Rose {
11 namespace BinaryAnalysis {
12 namespace Concolic {
13 namespace M68kSystem {
14 
16 class TracingResult: public Concolic::ConcreteResult {
18  // Types
20 private:
21  using Super = Concolic::ConcreteResult;
22 
23 public:
25  using Ptr = TracingResultPtr;
26 
29 
31  // Data members
33 private:
34  Trace trace_;
35 
37  // Serialization
39 private:
40  friend class boost::serialization::access;
41 
42  // This isn't the most efficient way to store the trace, but we use it for now because Sawyer::Container::Trace doesn't
43  // implement an internal seriazliation. So we convert the trace to a list of addresses and then save the addresses.
44  template<class S>
45  void save(S &s, const unsigned /*version*/) const {
46  s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Super);
47  std::vector<rose_addr_t> vas = trace_.toVector();
48  s & BOOST_SERIALIZATION_NVP(vas);
49  }
50 
51  template<class S>
52  void load(S &s, const unsigned /*version*/) {
53  s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Super);
54  std::vector<rose_addr_t> vas;
55  s & BOOST_SERIALIZATION_NVP(vas);
56  trace_.clear();
57  for (rose_addr_t va: vas)
58  trace_.append(va);
59  }
60 
61  BOOST_SERIALIZATION_SPLIT_MEMBER();
62 
64  // Construction
66 protected:
67  TracingResult(); // for boost::serialization
68  explicit TracingResult(double rank);
69 public:
70  ~TracingResult();
71 
72 public:
73  static Ptr instance(double rank);
74 
76  // Properties
78 public:
84  const Trace& trace() const;
85  Trace& trace();
87 };
88 
89 } // namespace
90 } // namespace
91 } // namespace
92 } // namespace
93 
94 #endif
95 #endif
Records and replays traces.
Definition: Trace.h:262
Main namespace for the ROSE library.
ROSE_DLL_API void load(SgProject *project, std::list< std::string > const &filepaths)
Load ASTs that have been saved to files.
Sawyer::SharedPointer< Node > Ptr
Reference counting pointer.