ROSE 0.11.145.147
Classes | Public Types | Public Member Functions | List of all members
Rose::BinaryAnalysis::InstructionSemantics::TestSemantics< SValuePtr, RegisterStatePtr, MemoryStatePtr, StatePtr, RiscOperatorsPtr > Class Template Reference

Description

template<class SValuePtr, class RegisterStatePtr, class MemoryStatePtr, class StatePtr, class RiscOperatorsPtr>
class Rose::BinaryAnalysis::InstructionSemantics::TestSemantics< SValuePtr, RegisterStatePtr, MemoryStatePtr, StatePtr, RiscOperatorsPtr >

Provides functions for testing binary instruction semantics.

Most instruction semantics errors occur in two situations: an author of a subclass instantiates an incorrect SValue type, or a subclass fails to implement a virtual allocator (either due to the subclass author not implementing it, or due the the super class author adding new methods or changing method signatures). This test harness attempts to catch most of those kinds of changes.

To use this test harness, instantiate a RiscOperators object and call the TestSemantics<>::test() method. A BaseSemantics::Exception is thrown if an error is detected.

The template arguments for TestSemantics should be the smart pointer types of the classes used to build the RiscOperators that's passed to the test() method.

Definition at line 29 of file TestSemantics.h.

#include <Rose/BinaryAnalysis/InstructionSemantics/TestSemantics.h>

Classes

class  Exception
 
class  MemoryStateSubclass
 
class  RegisterStateSubclass
 
class  RiscOperatorsSubclass
 
class  StateSubclass
 
class  SValueSubclass
 

Public Types

typedef SValuePtr::Pointee SValue
 
typedef RegisterStatePtr::element_type RegisterState
 
typedef MemoryStatePtr::element_type MemoryState
 
typedef StatePtr::element_type State
 
typedef RiscOperatorsPtr::element_type RiscOperators
 

Public Member Functions

void require (bool assertion, const std::string &what_failed)
 
template<typename Pointer >
void nonnull (const Pointer &x, const std::string &what_failed)
 
template<class ToPtr , class FromPtr >
void check_type (const FromPtr &x, const std::string &what_failed)
 
void check_sval_type (const BaseSemantics::SValuePtr &x, const std::string &what_failed)
 
void test (const BaseSemantics::RiscOperatorsPtr &ops)
 
void test (const BaseSemantics::SValuePtr &protoval, const BaseSemantics::StatePtr &state, const BaseSemantics::RiscOperatorsPtr &ops)
 

Member Typedef Documentation

◆ SValue

template<class SValuePtr , class RegisterStatePtr , class MemoryStatePtr , class StatePtr , class RiscOperatorsPtr >
typedef SValuePtr::Pointee Rose::BinaryAnalysis::InstructionSemantics::TestSemantics< SValuePtr, RegisterStatePtr, MemoryStatePtr, StatePtr, RiscOperatorsPtr >::SValue

Definition at line 31 of file TestSemantics.h.

◆ RegisterState

template<class SValuePtr , class RegisterStatePtr , class MemoryStatePtr , class StatePtr , class RiscOperatorsPtr >
typedef RegisterStatePtr::element_type Rose::BinaryAnalysis::InstructionSemantics::TestSemantics< SValuePtr, RegisterStatePtr, MemoryStatePtr, StatePtr, RiscOperatorsPtr >::RegisterState

Definition at line 32 of file TestSemantics.h.

◆ MemoryState

template<class SValuePtr , class RegisterStatePtr , class MemoryStatePtr , class StatePtr , class RiscOperatorsPtr >
typedef MemoryStatePtr::element_type Rose::BinaryAnalysis::InstructionSemantics::TestSemantics< SValuePtr, RegisterStatePtr, MemoryStatePtr, StatePtr, RiscOperatorsPtr >::MemoryState

Definition at line 33 of file TestSemantics.h.

◆ State

template<class SValuePtr , class RegisterStatePtr , class MemoryStatePtr , class StatePtr , class RiscOperatorsPtr >
typedef StatePtr::element_type Rose::BinaryAnalysis::InstructionSemantics::TestSemantics< SValuePtr, RegisterStatePtr, MemoryStatePtr, StatePtr, RiscOperatorsPtr >::State

Definition at line 34 of file TestSemantics.h.

◆ RiscOperators

template<class SValuePtr , class RegisterStatePtr , class MemoryStatePtr , class StatePtr , class RiscOperatorsPtr >
typedef RiscOperatorsPtr::element_type Rose::BinaryAnalysis::InstructionSemantics::TestSemantics< SValuePtr, RegisterStatePtr, MemoryStatePtr, StatePtr, RiscOperatorsPtr >::RiscOperators

Definition at line 35 of file TestSemantics.h.

Member Function Documentation

◆ require()

template<class SValuePtr , class RegisterStatePtr , class MemoryStatePtr , class StatePtr , class RiscOperatorsPtr >
void Rose::BinaryAnalysis::InstructionSemantics::TestSemantics< SValuePtr, RegisterStatePtr, MemoryStatePtr, StatePtr, RiscOperatorsPtr >::require ( bool  assertion,
const std::string &  what_failed 
)
inline

Definition at line 42 of file TestSemantics.h.

◆ nonnull()

template<class SValuePtr , class RegisterStatePtr , class MemoryStatePtr , class StatePtr , class RiscOperatorsPtr >
template<typename Pointer >
void Rose::BinaryAnalysis::InstructionSemantics::TestSemantics< SValuePtr, RegisterStatePtr, MemoryStatePtr, StatePtr, RiscOperatorsPtr >::nonnull ( const Pointer &  x,
const std::string &  what_failed 
)
inline

Definition at line 48 of file TestSemantics.h.

◆ check_type()

template<class SValuePtr , class RegisterStatePtr , class MemoryStatePtr , class StatePtr , class RiscOperatorsPtr >
template<class ToPtr , class FromPtr >
void Rose::BinaryAnalysis::InstructionSemantics::TestSemantics< SValuePtr, RegisterStatePtr, MemoryStatePtr, StatePtr, RiscOperatorsPtr >::check_type ( const FromPtr &  x,
const std::string &  what_failed 
)
inline

Definition at line 55 of file TestSemantics.h.

◆ check_sval_type()

template<class SValuePtr , class RegisterStatePtr , class MemoryStatePtr , class StatePtr , class RiscOperatorsPtr >
void Rose::BinaryAnalysis::InstructionSemantics::TestSemantics< SValuePtr, RegisterStatePtr, MemoryStatePtr, StatePtr, RiscOperatorsPtr >::check_sval_type ( const BaseSemantics::SValuePtr x,
const std::string &  what_failed 
)
inline

Definition at line 64 of file TestSemantics.h.

◆ test() [1/2]

template<class SValuePtr , class RegisterStatePtr , class MemoryStatePtr , class StatePtr , class RiscOperatorsPtr >
void Rose::BinaryAnalysis::InstructionSemantics::TestSemantics< SValuePtr, RegisterStatePtr, MemoryStatePtr, StatePtr, RiscOperatorsPtr >::test ( const BaseSemantics::RiscOperatorsPtr ops)
inline

Definition at line 111 of file TestSemantics.h.

◆ test() [2/2]

template<class SValuePtr , class RegisterStatePtr , class MemoryStatePtr , class StatePtr , class RiscOperatorsPtr >
void Rose::BinaryAnalysis::InstructionSemantics::TestSemantics< SValuePtr, RegisterStatePtr, MemoryStatePtr, StatePtr, RiscOperatorsPtr >::test ( const BaseSemantics::SValuePtr protoval,
const BaseSemantics::StatePtr state,
const BaseSemantics::RiscOperatorsPtr ops 
)
inline

Definition at line 120 of file TestSemantics.h.


The documentation for this class was generated from the following file: