"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Rose/BinaryAnalysis/Concolic/ExecutionEvent.h" between
rose-0.11.49.0.tar.gz and rose-0.11.50.0.tar.gz

About: ROSE is a compiler infrastructure to build source-to-source program transformation and analysis tools for large-scale C, C++, UPC, Fortran, OpenMP, Java, Python and PHP applications.

ExecutionEvent.h  (rose-0.11.49.0):ExecutionEvent.h  (rose-0.11.50.0)
#ifndef ROSE_BinaryAnalysis_Concolic_ExecutionEvent_H #ifndef ROSE_BinaryAnalysis_Concolic_ExecutionEvent_H
#define ROSE_BinaryAnalysis_Concolic_ExecutionEvent_H #define ROSE_BinaryAnalysis_Concolic_ExecutionEvent_H
#include <featureTests.h> #include <featureTests.h>
#ifdef ROSE_ENABLE_CONCOLIC_TESTING #ifdef ROSE_ENABLE_CONCOLIC_TESTING
#include <Rose/BinaryAnalysis/Concolic/BasicTypes.h> #include <Rose/BinaryAnalysis/Concolic/BasicTypes.h>
#include <Rose/BinaryAnalysis/Concolic/Database.h> #include <Rose/BinaryAnalysis/Concolic/Database.h>
#include <Rose/BinaryAnalysis/Concolic/ExecutionLocation.h>
#include <Rose/BinaryAnalysis/Debugger.h> #include <Rose/BinaryAnalysis/Debugger.h>
#include <Combinatorics.h> // rose #include <Combinatorics.h> // rose
namespace Rose { namespace Rose {
namespace BinaryAnalysis { namespace BinaryAnalysis {
namespace Concolic { namespace Concolic {
/** Execution event. /** Execution event.
* *
* An execution event is some event that happens during concrete execution befo re and/or after which the execution must be * An execution event is some event that happens during concrete execution befo re and/or after which the execution must be
skipping to change at line 47 skipping to change at line 48
MAP_MEMORY, // Add addresses to the memory map MAP_MEMORY, // Add addresses to the memory map
UNMAP_MEMORY, // Remove addresses from the memory map UNMAP_MEMORY, // Remove addresses from the memory map
WRITE_MEMORY, // Change values in the memory map WRITE_MEMORY, // Change values in the memory map
HASH_MEMORY, // Verify that a memory region hashes to a particular value HASH_MEMORY, // Verify that a memory region hashes to a particular value
WRITE_REGISTER, // Change value of a sin gle register WRITE_REGISTER, // Change value of a sin gle register
RESTORE_REGISTERS, // Set all register valu es RESTORE_REGISTERS, // Set all register valu es
// System calls. The scalar value is the system call number and the byte s hold the system call concrete // System calls. The scalar value is the system call number and the byte s hold the system call concrete
// arguments. Additional events may follow in order to reproduce the eff ects of the system call. // arguments. Additional events may follow in order to reproduce the eff ects of the system call.
OS_SYSCALL, OS_SYSCALL,
// Shared memory reads. The scalar value is the memory address, and addi
tional events may follow in order
// to reproduce the effect of the read. This is because we can't affect
the read by first writing to the address
// since (1) execution events are replayed after the instruction is exec
uted concretely, and (2) the shared
// memory at that address might not follow typical memory semantics--a r
ead might not return the value just
// written, and (3) the memory might not be writable.
OS_SHM_READ,
}; };
private: private:
// !!!!!!! DONT FORGET TO UPDATE ExecutionEvent::copy !!!!!!!!! // !!!!!!! DONT FORGET TO UPDATE ExecutionEvent::copy !!!!!!!!!
std::string timestamp_; // time of creation, nee ded by the database std::string timestamp_; // time of creation, nee ded by the database
TestCasePtr testCase_; // each event belongs to a particular test case TestCasePtr testCase_; // each event belongs to a particular test case
// Event identification // Event identification
ExecutionLocation location_; // location event occurs ExecutionLocation location_; // location event occurs
size_t instructionPointer_ = 0; // value of instruction pointer when event occurs size_t instructionPointer_ = 0; // value of instruction pointer when event occurs
skipping to change at line 69 skipping to change at line 77
// Association with a symbolic input variable // Association with a symbolic input variable
InputType inputType_ = InputType::NONE; // type of input InputType inputType_ = InputType::NONE; // type of input
SymbolicExpr::Ptr inputVariable_; // associated symbolic v ariable, if any SymbolicExpr::Ptr inputVariable_; // associated symbolic v ariable, if any
size_t inputI1_ = 0, inputI2_ = 0; // InputVariable fields size_t inputI1_ = 0, inputI2_ = 0; // InputVariable fields
// Action to be taken, based on event type // Action to be taken, based on event type
Action action_ = Action::NONE; // type of action to per form on the subordinate when replaying Action action_ = Action::NONE; // type of action to per form on the subordinate when replaying
AddressInterval memoryLocation_; // memory locations affe cted by the action, if any AddressInterval memoryLocation_; // memory locations affe cted by the action, if any
uint64_t scalar_ = 0; // scalar value uint64_t scalar_ = 0; // scalar value
std::vector<uint8_t> bytes_; // byte data needed by a ction, if any std::vector<uint8_t> bytes_; // byte data needed by a ction, if any
SymbolicExpr::Ptr symbolic_; // symbolic expression f or action, if any
// !!!!!!! DONT FORGET TO UPDATE ExecutionEvent::copy !!!!!!!!! // !!!!!!! DONT FORGET TO UPDATE ExecutionEvent::copy !!!!!!!!!
protected: protected:
ExecutionEvent(); ExecutionEvent();
public: public:
~ExecutionEvent(); ~ExecutionEvent();
public: public:
/** Allocating constructor. */ /** Allocating constructor. */
static Ptr instance(); static Ptr instance();
skipping to change at line 162 skipping to change at line 171
const AddressInterval &addresses, const Combin atorics::Hasher::Digest&); const AddressInterval &addresses, const Combin atorics::Hasher::Digest&);
static Ptr instanceHashMemory(rose_addr_t ip, static Ptr instanceHashMemory(rose_addr_t ip,
const AddressInterval &addresses, const Combin atorics::Hasher::Digest&); const AddressInterval &addresses, const Combin atorics::Hasher::Digest&);
/** @} */ /** @} */
/** Allocating constructor describing one register. /** Allocating constructor describing one register.
* *
* Create an event at a particular location that will set the specified reg ister to the specified value when replayed. * Create an event at a particular location that will set the specified reg ister to the specified value when replayed.
* If the test case and location are unspecified then the returned event is unbound. * If the test case and location are unspecified then the returned event is unbound.
* *
* The value should normally be concrete, but may be symbolic if this event
follows a shared memory read event for
* the same instruction.
*
* @{ */ * @{ */
static Ptr instanceWriteRegister(const TestCasePtr&, const ExecutionLocation &, rose_addr_t ip, static Ptr instanceWriteRegister(const TestCasePtr&, const ExecutionLocation &, rose_addr_t ip,
RegisterDescriptor, uint64_t value); RegisterDescriptor, uint64_t value);
static Ptr instanceWriteRegister(rose_addr_t ip, static Ptr instanceWriteRegister(rose_addr_t ip,
RegisterDescriptor, uint64_t value); RegisterDescriptor, uint64_t value);
static Ptr instanceWriteRegister(const TestCasePtr&, const ExecutionLocation
&, rose_addr_t ip,
RegisterDescriptor, const SymbolicExpr::Ptr
&value);
static Ptr instanceWriteRegister(rose_addr_t ip,
RegisterDescriptor, const SymbolicExpr::Ptr
&value);
/** @} */ /** @} */
/** Allocating constructor describing all registers. /** Allocating constructor describing all registers.
* *
* Create an even at a particular location that will initialize all registe rs to previously obtained values. If the * Create an even at a particular location that will initialize all registe rs to previously obtained values. If the
* test case and location are unspecified then the returned event is unboun d. * test case and location are unspecified then the returned event is unboun d.
* *
* @{ */ * @{ */
static Ptr instanceRestoreRegisters(const TestCasePtr&, const ExecutionLocat ion&, rose_addr_t ip, static Ptr instanceRestoreRegisters(const TestCasePtr&, const ExecutionLocat ion&, rose_addr_t ip,
const Debugger::AllRegisters&); const Debugger::AllRegisters&);
skipping to change at line 195 skipping to change at line 211
* and registers in the subordinate process. If the test case and location are unspecified then the returned event is * and registers in the subordinate process. If the test case and location are unspecified then the returned event is
* unbound. * unbound.
* *
* @{ */ * @{ */
static Ptr instanceSyscall(const TestCasePtr&, const ExecutionLocation&, ros e_addr_t ip, static Ptr instanceSyscall(const TestCasePtr&, const ExecutionLocation&, ros e_addr_t ip,
uint64_t functionNumber, const std::vector<uint64 _t> &arguments); uint64_t functionNumber, const std::vector<uint64 _t> &arguments);
static Ptr instanceSyscall(rose_addr_t ip, static Ptr instanceSyscall(rose_addr_t ip,
uint64_t functionNumber, const std::vector<uint64 _t> &arguments); uint64_t functionNumber, const std::vector<uint64 _t> &arguments);
/** @} */ /** @} */
/** Allocating constructor for marking a shared memory read.
*
* A shared memory read event is a marker indicating that a read is occurri
ng from a shared memory location. Usually the
* action only affects the simulated operating system and will be followed
by zero or more additional events to take care
* of the side effects of the read operation. On RISC architectures, these
side effects are typically just to move the
* read value into a register, but on CISC machines it might be more. If th
e test case and location are unspecified then
* the returned event is unbound.
*
* @{ */
static Ptr instanceSharedMemoryRead(const TestCasePtr&, const ExecutionLocat
ion&, rose_addr_t ip,
rose_addr_t memoryAddress, size_t nBytes
);
static Ptr instanceSharedMemoryRead(rose_addr_t ip, rose_addr_t memoryAddres
s, size_t nBytes);
/** @} */
/** Make a copy of this event. */ /** Make a copy of this event. */
Ptr copy() const; Ptr copy() const;
/** Bind an execution event to a test case and location. /** Bind an execution event to a test case and location.
* *
* The @ref testCase and @ref location properties are set to the specified values. */ * The @ref testCase and @ref location properties are set to the specified values. */
void bind(const TestCasePtr&, const ExecutionLocation&); void bind(const TestCasePtr&, const ExecutionLocation&);
/** Property: Owning test case. /** Property: Owning test case.
* *
skipping to change at line 270 skipping to change at line 300
* *
* Name of the symbolic variable associated with this event, if any. * Name of the symbolic variable associated with this event, if any.
* *
* @{ */ * @{ */
const SymbolicExpr::Ptr& inputVariable() const { const SymbolicExpr::Ptr& inputVariable() const {
return inputVariable_; return inputVariable_;
} }
void inputVariable(const SymbolicExpr::Ptr &v) { void inputVariable(const SymbolicExpr::Ptr &v) {
inputVariable_ = v; inputVariable_ = v;
} }
void inputVariable(const InstructionSemantics2::BaseSemantics::SValuePtr &va riable);
/** @} */ /** @} */
/** Property: Input variable integer field one. /** Property: Input variable integer field one.
* *
* Stores input variable information depending on the @ref inputType. * Stores input variable information depending on the @ref inputType.
* *
* @{ */ * @{ */
size_t inputI1() const { size_t inputI1() const {
return inputI1_; return inputI1_;
} }
skipping to change at line 326 skipping to change at line 357
/** Property: Bytes for action. /** Property: Bytes for action.
* *
* This property holds any byte data necessary for the action. * This property holds any byte data necessary for the action.
* *
* @{ */ * @{ */
const std::vector<uint8_t>& bytes() const; const std::vector<uint8_t>& bytes() const;
std::vector<uint8_t>& bytes(); std::vector<uint8_t>& bytes();
void bytes(const std::vector<uint8_t>&); void bytes(const std::vector<uint8_t>&);
/** @} */ /** @} */
/** Property: Bytes returned as a symbolic value.
*
* The return value is a symbolic expression of type integer, whose width i
s eight times the number of bytes
* stored for the event. The bytes are assumed to be little endian. */
SymbolicExpr::Ptr bytesAsSymbolic() const;
/** Property: Words for action. /** Property: Words for action.
* *
* This property interprets the @ref bytes as 64-bit little endian words. * This property interprets the @ref bytes as 64-bit little endian words.
* *
* @{ */ * @{ */
std::vector<uint64_t> words() const; std::vector<uint64_t> words() const;
void words(const std::vector<uint64_t>&); void words(const std::vector<uint64_t>&);
/** @} */ /** @} */
/** Returns the bytes as a register value collection. */ /** Returns the bytes as a register value collection. */
skipping to change at line 347 skipping to change at line 384
/** Property: Scalar value. /** Property: Scalar value.
* *
* Some events store a scalar value. The value is 64 bits but the interpret ation depends on the event type. * Some events store a scalar value. The value is 64 bits but the interpret ation depends on the event type.
* *
* @{ */ * @{ */
uint64_t scalar() const; uint64_t scalar() const;
void scalar(uint64_t); void scalar(uint64_t);
/** @} */ /** @} */
/** Property: Symbolic value.
*
* Some events store a symbolic expression. Usually these expressions are s
ymbolic because they refer to an
* input variable(s) and will become concrete once concrete values are prov
ided for that variable(s).
*
* @{ */
SymbolicExpr::Ptr symbolic() const;
void symbolic(const SymbolicExpr::Ptr&);
/** @} */
/** Print as YAML node. */ /** Print as YAML node. */
void toYaml(std::ostream&, const DatabasePtr&, std::string prefix); void toYaml(std::ostream&, const DatabasePtr&, std::string prefix);
/** Returns printable name of execution event for diagnostic output. /** Returns printable name of execution event for diagnostic output.
* *
* Returns a string suitable for printing to a terminal, containing the wor ds "execution event", the database ID if * Returns a string suitable for printing to a terminal, containing the wor ds "execution event", the database ID if
* appropriate, and the execution event name using C-style double-quoted st ring literal syntax if not empty. The database * appropriate, and the execution event name using C-style double-quoted st ring literal syntax if not empty. The database
* ID is shown if a non-null database is specified and this executon event exists in that database. */ * ID is shown if a non-null database is specified and this executon event exists in that database. */
std::string printableName(const DatabasePtr &db = DatabasePtr()); std::string printableName(const DatabasePtr &db = DatabasePtr());
}; };
 End of changes. 9 change blocks. 
0 lines changed or deleted 65 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)