ROSE  0.11.50.0
Concolic/SystemCall.h
1 #ifndef ROSE_BinaryAnalysis_Concolic_SystemCall_H
2 #define ROSE_BinaryAnalysis_Concolic_SystemCall_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_CONCOLIC_TESTING
5 
6 #include <Rose/BinaryAnalysis/Concolic/BasicTypes.h>
7 #include <Rose/BinaryAnalysis/InstructionSemantics2/BaseSemantics/Types.h>
8 #include <Rose/BinaryAnalysis/SymbolicExpr.h>
9 
10 #include <Sawyer/Optional.h>
11 #include <Sawyer/SharedObject.h>
12 
13 namespace Rose {
14 namespace BinaryAnalysis {
15 namespace Concolic {
16 
18 // System call context for callbacks
20 
24 class SyscallContext {
25 public:
26  SyscallContext() = delete;
27 
29  SyscallContext(const ArchitecturePtr&, const ExecutionEventPtr &syscallEvent,
30  const std::vector<ExecutionEventPtr> &relatedEvents);
31 
33  SyscallContext(const ArchitecturePtr&, const Emulation::RiscOperatorsPtr&,
34  const ExecutionEventPtr &syscallEvent);
35 
36  virtual ~SyscallContext();
37 
38  /*------------------------------------------------------------------------------------------------------------
39  * Inputs to the callback
40  *------------------------------------------------------------------------------------------------------------*/
41 
48  ConcolicPhase phase = ConcolicPhase::EMULATION;
49 
51  ArchitecturePtr architecture;
52 
56  Emulation::RiscOperatorsPtr ops;
57 
61  rose_addr_t ip = 0;
62 
68  std::vector<uint64_t> argsConcrete;
69 
75  ExecutionEventPtr syscallEvent;
76 
77  /*------------------------------------------------------------------------------------------------------------
78  * Inputs and outputs
79  *------------------------------------------------------------------------------------------------------------*/
80 
92  std::vector<ExecutionEventPtr> relatedEvents;
93 
105  ExecutionEventPtr returnEvent;
106 
112  SymbolicExpr::Ptr symbolicReturn;
113 };
114 
115 
117 // Callbacks to handle system calls.
119 
121 class SyscallCallback: public Sawyer::SharedObject {
122 public:
123  using Ptr = SyscallCallbackPtr;
124 
125 public:
126  virtual ~SyscallCallback() {}
127 
132  virtual bool operator()(bool handled, SyscallContext&) = 0;
133 
137  void hello(const std::string &myName, const SyscallContext&) const;
138 };
139 
140 } // namespace
141 } // namespace
142 } // namespace
143 
144 #endif
145 #endif
Sawyer::SharedPointer< Node > Ptr
Shared-ownership pointer to an expression Node.
Definition: SymbolicExpr.h:156
Main namespace for the ROSE library.
const char * ops(int64_t)
Convert ops enum constant to a string.
Definition: stringify.C:9413
Base class for reference counted objects.
Definition: SharedObject.h:64