ROSE 0.11.145.147
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/InstructionSemantics/BaseSemantics/BasicTypes.h>
8#include <Rose/BinaryAnalysis/SymbolicExpression.h>
9
10#include <Sawyer/Optional.h>
11#include <Sawyer/SharedObject.h>
12
13namespace Rose {
14namespace BinaryAnalysis {
15namespace Concolic {
16
18// System call context for callbacks
20
24class SyscallContext {
25public:
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
104 ExecutionEventPtr returnEvent;
105
111 SymbolicExpression::Ptr symbolicReturn;
112};
113
114
116// Callbacks to handle system calls.
118
120class SyscallCallback: public Sawyer::SharedObject {
121public:
122 using Ptr = SyscallCallbackPtr;
123
124public:
125 virtual ~SyscallCallback() {}
126
131 virtual bool operator()(bool handled, SyscallContext&) = 0;
132
136 void hello(const std::string &myName, const SyscallContext&) const;
137
139 void notAnInput(SyscallContext&, const ExecutionEventPtr&) const;
140};
141
142} // namespace
143} // namespace
144} // namespace
145
146#endif
147#endif
Base class for reference counted objects.
Sawyer::SharedPointer< Node > Ptr
Reference counting pointer.
The ROSE library.
const char * ConcolicPhase(int64_t)
Convert Rose::BinaryAnalysis::Concolic::ConcolicPhase enum constant to a string.
const char * ops(int64_t)
Convert ops enum constant to a string.