ROSE  0.11.50.0
LinuxExecutor.h
1 #ifndef ROSE_BinaryAnalysis_Concolic_LinuxExecutor_H
2 #define ROSE_BinaryAnalysis_Concolic_LinuxExecutor_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_CONCOLIC_TESTING
5 #include <Rose/BinaryAnalysis/Concolic/BasicTypes.h>
6 
7 #include <boost/serialization/export.hpp>
8 #include <boost/serialization/access.hpp>
9 #include <boost/serialization/nvp.hpp>
10 #include <boost/serialization/base_object.hpp>
11 #include <Rose/BinaryAnalysis/Concolic/ConcreteExecutor.h>
12 #include <Sawyer/Optional.h>
13 #include <Sawyer/SharedPointer.h>
14 #include <string>
15 
16 namespace Rose {
17 namespace BinaryAnalysis {
18 namespace Concolic {
19 
21 class LinuxExecutor: public ConcreteExecutor {
22 public:
25 
27  typedef Sawyer::Optional<unsigned long> Persona;
28 
30  class Result: public ConcreteExecutorResult {
31  protected:
32  int exitStatus_;
33  std::string exitKind_;
34  std::string capturedOut_;
35  std::string capturedErr_;
37  private:
38  friend class boost::serialization::access;
39 
40  template<class S>
41  void serialize(S &s, const unsigned /*version*/) {
42  s & BOOST_SERIALIZATION_BASE_OBJECT_NVP(ConcreteExecutorResult);
43  s & BOOST_SERIALIZATION_NVP(exitStatus_);
44  s & BOOST_SERIALIZATION_NVP(exitKind_);
45  s & BOOST_SERIALIZATION_NVP(capturedOut_);
46  s & BOOST_SERIALIZATION_NVP(capturedErr_);
47  }
48 
49  public:
50  Result(double rank, int exitStatus);
51 
52  Result() {} // required for boost serialization
53 
61  int exitStatus() const { return exitStatus_; }
62  void exitStatus(int x);
68  std::string out() const { return capturedOut_; }
69  void out(const std::string& output) { capturedOut_ = output; }
70 
71  std::string err() const { return capturedErr_; }
72  void err(const std::string& output) { capturedErr_ = output; }
78  std::string exitKind() const { return exitKind_; }
79  /* @} */
80  };
81 
82 protected:
83  bool useAddressRandomization_; // enable/disable address space randomization in the OS
84 
85 protected:
86  explicit LinuxExecutor(const DatabasePtr&);
87 
88 public:
89  ~LinuxExecutor();
90 
92  static Ptr instance(const DatabasePtr&);
93 
100  bool useAddressRandomization() const { return useAddressRandomization_; }
101  void useAddressRandomization(bool b) { useAddressRandomization_ = b; }
104  virtual
105  ConcreteExecutorResult* execute(const TestCasePtr&) ROSE_OVERRIDE;
106 };
107 
108 } // namespace
109 } // namespace
110 } // namespace
111 
112 #endif
113 #endif
Sawyer::SharedPointer< Node > Ptr
Shared-ownership pointer to an expression Node.
Definition: SymbolicExpr.h:156
void serialize(std::ostream &output, Graph &graph)
Serialize a graph into a stream of bytes.
Holds a value or nothing.
Definition: Optional.h:49
Main namespace for the ROSE library.
Reference-counting intrusive smart pointer.
Definition: SharedPointer.h:68