1#ifndef ROSE_BinaryAnalysis_Concolic_ExecutionEvent_H
2#define ROSE_BinaryAnalysis_Concolic_ExecutionEvent_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_CONCOLIC_TESTING
6#include <Rose/BinaryAnalysis/Concolic/BasicTypes.h>
7#include <Rose/BinaryAnalysis/Concolic/Database.h>
8#include <Rose/BinaryAnalysis/Concolic/ExecutionLocation.h>
9#include <Rose/BinaryAnalysis/SymbolicExpression.h>
10#include <Combinatorics.h>
13namespace BinaryAnalysis {
66 using Ptr = ExecutionEventPtr;
146 std::string timestamp_;
147 TestCasePtr testCase_;
149 ExecutionLocation location_;
153 Action action_ = Action::NONE;
156 std::vector<uint8_t> bytes_;
157 SymbolicExpressionPtr variable_, value_, expression_;
176 static Ptr instance();
179 static Ptr noAction(
const TestCasePtr&,
const ExecutionLocation&, rose_addr_t ip);
183 static Ptr bulkMemoryMap(
const TestCasePtr&,
const ExecutionLocation&, rose_addr_t ip,
184 const AddressInterval &where,
unsigned permissions);
187 static Ptr bulkMemoryUnmap(
const TestCasePtr&,
const ExecutionLocation&, rose_addr_t ip,
188 const AddressInterval &where);
193 static Ptr bulkMemoryWrite(
const TestCasePtr&,
const ExecutionLocation&, rose_addr_t ip,
194 const AddressInterval &where,
const std::vector<uint8_t> &bytes);
199 static Ptr bulkMemoryHash(
const TestCasePtr&,
const ExecutionLocation&, rose_addr_t ip,
200 const AddressInterval &where,
const Combinatorics::Hasher::Digest&);
203 static Ptr memoryWrite(
const TestCasePtr&,
const ExecutionLocation&, rose_addr_t ip,
204 const AddressInterval &where,
const SymbolicExpressionPtr &
variable,
205 const SymbolicExpressionPtr &value,
const SymbolicExpressionPtr &expression);
208 static Ptr bulkRegisterWrite(
const TestCasePtr&,
const ExecutionLocation&, rose_addr_t ip,
212 static Ptr registerWrite(
const TestCasePtr&,
const ExecutionLocation&, rose_addr_t ip,
213 RegisterDescriptor where,
const SymbolicExpressionPtr &
variable,
214 const SymbolicExpressionPtr &value,
const SymbolicExpressionPtr &expression);
217 static Ptr osSyscall(
const TestCasePtr&,
const ExecutionLocation&, rose_addr_t ip,
218 unsigned function,
const std::vector<uint64_t> &arguments);
221 static Ptr osSharedMemory(
const TestCasePtr&,
const ExecutionLocation&, rose_addr_t ip,
222 const AddressInterval &where,
const SymbolicExpressionPtr &
variable,
223 const SymbolicExpressionPtr &value,
const SymbolicExpressionPtr &expression);
236 TestCasePtr testCase()
const;
237 void testCase(
const TestCasePtr&);
250 const std::string& timestamp()
const;
251 void timestamp(
const std::string&);
262 std::string name()
const;
263 void name(
const std::string&);
273 ExecutionLocation location()
const;
274 void location(
const ExecutionLocation&);
286 rose_addr_t instructionPointer()
const;
287 void instructionPointer(rose_addr_t);
314 void memoryLocation(
const AddressInterval&);
325 RegisterDescriptor registerDescriptor()
const;
326 void registerDescriptor(RegisterDescriptor);
337 unsigned permissions()
const;
338 void permissions(
unsigned);
349 const std::vector<uint8_t>& bytes()
const;
350 void bytes(
const std::vector<uint8_t>&);
370 const Combinatorics::Hasher::Digest&
hash()
const;
371 void hash(
const Combinatorics::Hasher::Digest&);
383 SymbolicExpressionPtr
variable()
const;
384 void variable(
const SymbolicExpressionPtr&);
397 SymbolicExpressionPtr value()
const;
398 void value(
const SymbolicExpressionPtr&);
414 SymbolicExpressionPtr expression()
const;
415 void expression(
const SymbolicExpressionPtr&);
425 unsigned syscallFunction()
const;
426 void syscallFunction(
unsigned);
438 std::vector<uint64_t> syscallArguments()
const;
439 void syscallArguments(
const std::vector<uint64_t>&);
458 void inputType(InputType,
size_t idx1,
size_t idx2);
459 std::pair<size_t, size_t> inputIndices()
const;
472 SymbolicExpressionPtr inputVariable()
const;
487 SymbolicExpressionPtr calculateResult(
const SymbolicExpression::ExprExprHashMap &bindings)
const;
496 std::string printableName(
const DatabasePtr &db = DatabasePtr());
504 void toYaml(std::ostream&,
const DatabasePtr&, std::string prefix);
510 friend class DatabaseAccess;
513 static void recreateTable(Sawyer::Database::Connection);
516 void toDatabase(
const DatabasePtr&, ExecutionEventId);
519 void fromDatabase(
const DatabasePtr&, ExecutionEventId);
Creates SharedPointer from this.
Base class for reference counted objects.
Sawyer::SharedPointer< Node > Ptr
Reference counting pointer.
Hash hash(const std::vector< Ptr > &)
Hash zero or more expressions.
Sawyer::Container::Interval< Address > AddressInterval
An interval of addresses.
const size_t INVALID_INDEX
Invalid array index.
void copy(const Word *src, const BitRange &srcRange, Word *dst, const BitRange &dstRange)
Copy some bits.
const char * InputType(int64_t)
Convert Rose::BinaryAnalysis::Concolic::InputType enum constant to a string.
const char * Action(int64_t)
Convert Rose::BinaryAnalysis::FeasiblePath::PathProcessor::Action enum constant to a string.