crucible-0.7: Crucible is a library for language-agnostic symbolic simulation
Copyright(c) Galois Inc 2018
LicenseBSD3
MaintainerJoe Hendrix <jhendrix@galois.com>
Stabilityprovisional
Safe HaskellSafe-Inferred
LanguageHaskell2010

Lang.Crucible.Simulator

Description

This module reexports the parts of the symbolic simulator codebase that are most relevant for users. Additional types and operations are exported from the relevant submodules if necessary.

Synopsis

Register values

type family RegValue (sym :: Type) (tp :: CrucibleType) :: Type where ... Source #

Maps register types to the runtime representation.

Equations

RegValue sym (BaseToType bt) = SymExpr sym bt 
RegValue sym (FloatType fi) = SymInterpretedFloat sym fi 
RegValue sym AnyType = AnyValue sym 
RegValue sym UnitType = () 
RegValue sym NatType = SymNat sym 
RegValue sym CharType = Word16 
RegValue sym (FunctionHandleType a r) = FnVal sym a r 
RegValue sym (MaybeType tp) = PartExpr (Pred sym) (RegValue sym tp) 
RegValue sym (VectorType tp) = Vector (RegValue sym tp) 
RegValue sym (SequenceType tp) = SymSequence sym (RegValue sym tp) 
RegValue sym (StructType ctx) = Assignment (RegValue' sym) ctx 
RegValue sym (VariantType ctx) = Assignment (VariantBranch sym) ctx 
RegValue sym (ReferenceType tp) = MuxTree sym (RefCell tp) 
RegValue sym (WordMapType w tp) = WordMap sym w tp 
RegValue sym (RecursiveType nm ctx) = RolledType sym nm ctx 
RegValue sym (IntrinsicType nm ctx) = Intrinsic sym nm ctx 
RegValue sym (StringMapType tp) = Map Text (PartExpr (Pred sym) (RegValue sym tp)) 

newtype RegValue' sym tp Source #

A newtype wrapper around RegValue. This is wrapper necessary because RegValue is a type family and, as such, cannot be partially applied.

Constructors

RV 

Fields

Variants

newtype VariantBranch sym tp Source #

Constructors

VB 

Fields

injectVariant Source #

Arguments

:: IsExprBuilder sym 
=> sym

symbolic backend

-> CtxRepr ctx

Types of the variant branches

-> Index ctx tp

Which branch

-> RegValue sym tp

The value to inject

-> RegValue sym (VariantType ctx) 

Construct a VariantType value by identifying which branch of the variant to construct, and providing a value of the correct type.

Any Values

data AnyValue sym where Source #

Constructors

AnyValue :: TypeRepr tp -> RegValue sym tp -> AnyValue sym 

Function Values

data FnVal (sym :: Type) (args :: Ctx CrucibleType) (res :: CrucibleType) where Source #

Represents a function closure.

Constructors

ClosureFnVal :: !(FnVal sym (args ::> tp) ret) -> !(TypeRepr tp) -> !(RegValue sym tp) -> FnVal sym args ret 
VarargsFnVal :: !(FnHandle (args ::> VectorType AnyType) ret) -> !(CtxRepr addlArgs) -> FnVal sym (args <+> addlArgs) ret 
HandleFnVal :: !(FnHandle a r) -> FnVal sym a r 

Instances

Instances details
Show (FnVal sym a r) Source # 
Instance details

Defined in Lang.Crucible.Simulator.RegValue

Methods

showsPrec :: Int -> FnVal sym a r -> ShowS #

show :: FnVal sym a r -> String #

showList :: [FnVal sym a r] -> ShowS #

fnValType :: FnVal sym args res -> TypeRepr (FunctionHandleType args res) Source #

Extract the runtime representation of the type of the given FnVal

Recursive Values

newtype RolledType sym nm ctx Source #

Constructors

RolledType 

Fields

Register maps

data RegEntry sym tp Source #

The value of a register.

Constructors

RegEntry 

Fields

newtype RegMap sym (ctx :: Ctx CrucibleType) Source #

A set of registers in an execution frame.

Constructors

RegMap 

Fields

emptyRegMap :: RegMap sym EmptyCtx Source #

Create a new set of registers.

regVal :: RegMap sym ctx -> Reg ctx tp -> RegValue sym tp Source #

assignReg :: TypeRepr tp -> RegValue sym tp -> RegMap sym ctx -> RegMap sym (ctx ::> tp) Source #

reg :: forall n sym ctx tp. Idx n ctx tp => RegMap sym ctx -> RegValue sym tp Source #

SimError

data SimErrorReason Source #

Class for exceptions generated by simulator.

Constructors

GenericSimError !String 
Unsupported !CallStack !String

We can't do that (yet?). The call stack identifies where in the Haskell code the error occured.

ReadBeforeWriteSimError !String 
AssertFailureSimError !String !String

An assertion failed. The first parameter is a short description. The second is a more detailed explanation.

ResourceExhausted String

A loop iteration count, or similar resource limit, was exceeded.

SimGlobalState

data GlobalVar (tp :: CrucibleType) Source #

A global variable.

Constructors

GlobalVar 

Instances

Instances details
TestEquality GlobalVar Source # 
Instance details

Defined in Lang.Crucible.CFG.Common

Methods

testEquality :: forall (a :: k) (b :: k). GlobalVar a -> GlobalVar b -> Maybe (a :~: b) #

OrdF GlobalVar Source # 
Instance details

Defined in Lang.Crucible.CFG.Common

Methods

compareF :: forall (x :: k) (y :: k). GlobalVar x -> GlobalVar y -> OrderingF x y #

leqF :: forall (x :: k) (y :: k). GlobalVar x -> GlobalVar y -> Bool #

ltF :: forall (x :: k) (y :: k). GlobalVar x -> GlobalVar y -> Bool #

geqF :: forall (x :: k) (y :: k). GlobalVar x -> GlobalVar y -> Bool #

gtF :: forall (x :: k) (y :: k). GlobalVar x -> GlobalVar y -> Bool #

ShowF GlobalVar Source # 
Instance details

Defined in Lang.Crucible.CFG.Common

Methods

withShow :: forall p q (tp :: k) a. p GlobalVar -> q tp -> (Show (GlobalVar tp) => a) -> a #

showF :: forall (tp :: k). GlobalVar tp -> String #

showsPrecF :: forall (tp :: k). Int -> GlobalVar tp -> String -> String #

Show (GlobalVar tp) Source # 
Instance details

Defined in Lang.Crucible.CFG.Common

Methods

showsPrec :: Int -> GlobalVar tp -> ShowS #

show :: GlobalVar tp -> String #

showList :: [GlobalVar tp] -> ShowS #

Pretty (GlobalVar tp) Source # 
Instance details

Defined in Lang.Crucible.CFG.Common

Methods

pretty :: GlobalVar tp -> Doc ann #

prettyList :: [GlobalVar tp] -> Doc ann #

data SymGlobalState (sym :: Type) Source #

A map from global variables to their value.

emptyGlobals :: SymGlobalState sym Source #

The empty set of global variable bindings.

GlobalPair

data GlobalPair sym (v :: Type) Source #

A value of some type v together with a global state.

Constructors

GlobalPair 

Fields

gpValue :: Lens (GlobalPair sym u) (GlobalPair sym v) u v Source #

Access the value stored in the global pair.

gpGlobals :: Simple Lens (GlobalPair sym u) (SymGlobalState sym) Source #

Access the globals stored in the global pair.

AbortedResult

data AbortedResult sym ext where Source #

An execution path that was prematurely aborted. Note, an abort does not necessarily indicate an error condition. An execution path might abort because it became infeasible (inconsistent path conditions), because the program called an exit primitive, or because of a true error condition (e.g., a failed assertion).

Constructors

AbortedExec :: !AbortExecReason -> !(GlobalPair sym (SimFrame sym ext l args)) -> AbortedResult sym ext

A single aborted execution with the execution state at time of the abort and the reason.

AbortedExit :: !ExitCode -> AbortedResult sym ext

An aborted execution that was ended by a call to exit.

AbortedBranch :: !ProgramLoc -> !(Pred sym) -> !(AbortedResult sym ext) -> !(AbortedResult sym ext) -> AbortedResult sym ext

Two separate threads of execution aborted after a symbolic branch, possibly for different reasons.

Partial result

data PartialResult sym ext (v :: Type) Source #

A PartialResult represents the result of a computation that might be only partially defined. If the result is a TotalResult, the the result is fully defined; however if it is a PartialResult, then some of the computation paths that led to this result aborted for some reason, and the resulting value is only defined if the associated condition is true.

Constructors

TotalRes !(GlobalPair sym v)

A TotalRes indicates that the the global pair is always defined.

PartialRes !ProgramLoc !(Pred sym) !(GlobalPair sym v) !(AbortedResult sym ext)

PartialRes indicates that the global pair may be undefined under some circumstances. The predicate specifies under what conditions the GlobalPair is defined. The AbortedResult describes the circumstances under which the result would be partial.

partialValue :: Lens (PartialResult sym ext u) (PartialResult sym ext v) (GlobalPair sym u) (GlobalPair sym v) Source #

Access the value stored in the partial result.

Execution states

data ExecResult p sym ext (r :: Type) Source #

Executions that have completed either due to (partial or total) successful completion or by some abort condition.

Constructors

FinishedResult !(SimContext p sym ext) !(PartialResult sym ext r)

At least one execution path resulted in some return result.

AbortedResult !(SimContext p sym ext) !(AbortedResult sym ext)

All execution paths resulted in an abort condition, and there is no result to return.

TimeoutResult !(ExecState p sym ext r)

An execution stopped somewhere in the middle of a run because a timeout condition occurred.

data ExecState p sym ext (rtp :: Type) Source #

An ExecState represents an intermediate state of executing a Crucible program. The Crucible simulator executes by transitioning between these different states until it results in a ResultState, indicating the program has completed.

Constructors

ResultState !(ExecResult p sym ext rtp)

The ResultState is used to indicate that the program has completed.

forall f a. AbortState !AbortExecReason !(SimState p sym ext rtp f a)

An abort state indicates that the included SimState encountered an abort event while executing its next step. The state needs to be unwound to its nearest enclosing branch point and resumed.

forall f a r. UnwindCallState !(ValueFromValue p sym ext rtp r) !(AbortedResult sym ext) !(SimState p sym ext rtp f a)

An unwind call state occurs when we are about to leave the context of a function call because of an abort. The included ValueFromValue is the context of the call site we are about to unwind into, and the AbortedResult indicates the reason we are aborting.

forall f a ret. CallState !(ReturnHandler ret p sym ext rtp f a) !(ResolvedCall p sym ext ret) !(SimState p sym ext rtp f a)

A call state is entered when we are about to make a function call to the included call frame, which has already resolved the implementation and arguments to the function.

forall f a ret. TailCallState !(ValueFromValue p sym ext rtp ret) !(ResolvedCall p sym ext ret) !(SimState p sym ext rtp f a)

A tail-call state is entered when we are about to make a function call to the included call frame, and this is the last action we need to take in the current caller. Note, we can only enter a tail-call state if there are no pending merge points in the caller. This means that sometimes calls that appear to be in tail-call position may nonetheless have to be treated as ordinary calls.

forall f a ret. ReturnState !FunctionName !(ValueFromValue p sym ext rtp ret) !(RegEntry sym ret) !(SimState p sym ext rtp f a)

A return state is entered after the final return value of a function is computed, and just before we resolve injecting the return value back into the caller's context.

forall blocks r args. RunningState !(RunningStateInfo blocks args) !(SimState p sym ext rtp (CrucibleLang blocks r) ('Just args))

A running state indicates the included SimState is ready to enter and execute a Crucible basic block, or to resume a basic block from a call site.

forall f args postdom_args. SymbolicBranchState !(Pred sym) !(PausedFrame p sym ext rtp f) !(PausedFrame p sym ext rtp f) !(CrucibleBranchTarget f postdom_args) !(SimState p sym ext rtp f ('Just args))

A symbolic branch state indicates that the execution needs to branch on a non-trivial symbolic condition. The included Pred is the condition to branch on. The first PausedFrame is the path that corresponds to the Pred being true, and the second is the false branch.

forall f a. ControlTransferState !(ControlResumption p sym ext rtp f) !(SimState p sym ext rtp f ('Just a))

A control transfer state is entered just prior to invoking a control resumption. Control resumptions are responsible for transitioning from the end of one basic block to another, although there are also some intermediate states related to resolving switch statements.

forall args ret. OverrideState !(Override p sym ext args ret) !(SimState p sym ext rtp (OverrideLang ret) ('Just args))

An override state indicates the included SimState is prepared to execute a code override.

forall f args. BranchMergeState !(CrucibleBranchTarget f args) !(SimState p sym ext rtp f args)

A branch merge state occurs when the included SimState is in the process of transferring control to the included CrucibleBranchTarget. We enter a BranchMergeState every time we need to _check_ if there is a pending branch, even if no branch is pending. During this process, paths may have to be merged. If several branches must merge at the same control point, this state may be entered several times in succession before returning to a RunningState.

forall ret.rtp ~ RegEntry sym ret => InitialState !(SimContext p sym ext) !(SymGlobalState sym) !(AbortHandler p sym ext (RegEntry sym ret)) !(TypeRepr ret) !(ExecCont p sym ext (RegEntry sym ret) (OverrideLang ret) ('Just EmptyCtx))

An initial state indicates the state of a simulator just before execution begins. It specifies all the initial data necessary to begin simulating. The given ExecCont will be executed in a fresh SimState representing the default starting call frame.

type ExecCont p sym ext r f a = ReaderT (SimState p sym ext r f a) IO (ExecState p sym ext r) Source #

An action which will construct an ExecState given a current SimState. Such continuations correspond to a single transition of the simulator transition system.

execResultContext :: ExecResult p sym ext r -> SimContext p sym ext Source #

Simulator context

Function bindings

data Override p sym ext (args :: Ctx CrucibleType) ret Source #

A definition of a function's semantics, given as a Haskell action.

Constructors

Override 

Fields

data FnState p sym ext (args :: Ctx CrucibleType) (ret :: CrucibleType) Source #

State used to indicate what to do when function is called. A function may either be defined by writing a Haskell Override or by giving a Crucible control-flow graph representation.

Constructors

UseOverride !(Override p sym ext args ret) 
forall blocks. UseCFG !(CFG ext blocks args ret) !(CFGPostdom blocks) 

newtype FunctionBindings p sym ext Source #

A map from function handles to their semantics.

Constructors

FnBindings 

Fields

Extensions

data ExtensionImpl p sym ext Source #

In order to start executing a simulator, one must provide an implementation of the extension syntax. This includes an evaluator for the added expression forms, and an evaluator for the added statement forms.

Constructors

ExtensionImpl 

Fields

type EvalStmtFunc p sym ext = forall rtp blocks r ctx tp'. StmtExtension ext (RegEntry sym) tp' -> CrucibleState p sym ext rtp blocks r ctx -> IO (RegValue sym tp', CrucibleState p sym ext rtp blocks r ctx) Source #

The type of functions that interpret extension statements. These have access to the main simulator state, and can make fairly arbitrary changes to it.

emptyExtensionImpl :: ExtensionImpl p sym () Source #

Trivial implementation for the "empty" extension, which adds no additional syntactic forms.

SimContext record

type IsSymInterfaceProof sym a = (IsSymInterface sym => a) -> a Source #

data SimContext (personality :: Type) (sym :: Type) (ext :: Type) Source #

Top-level state record for the simulator. The state contained in this record remains persistent across all symbolic simulator actions. In particular, it is not rolled back when the simulator returns previous program points to explore additional paths, etc.

Constructors

SimContext 

Fields

initSimContext Source #

Arguments

:: IsSymBackend sym bak 
=> bak

Symbolic backend

-> IntrinsicTypes sym

Implementations of intrinsic types

-> HandleAllocator

Handle allocator for creating new function handles

-> Handle

Handle to write output to

-> FunctionBindings personality sym ext

Initial bindings for function handles

-> ExtensionImpl personality sym ext

Semantics for extension syntax

-> personality

Initial value for custom user state

-> SimContext personality sym ext 

Create a new SimContext with the given bindings.

ctxSymInterface :: Getter (SimContext p sym ext) sym Source #

Access the symbolic backend inside a SimContext.

functionBindings :: Lens' (SimContext p sym ext) (FunctionBindings p sym ext) Source #

A map from function handles to their semantics.

cruciblePersonality :: Lens' (SimContext p sym ext) p Source #

Access the custom user-state inside the SimContext.

profilingMetrics :: Lens' (SimContext p sym ext) (Map Text (Metric p sym ext)) Source #

SimState

data SimState p sym ext rtp f (args :: Maybe (Ctx CrucibleType)) Source #

A SimState contains the execution context, an error handler, and the current execution tree. It captures the entire state of the symbolic simulator.

Instances

Instances details
MonadState (SimState p sym ext rtp (OverrideLang ret) ('Just args)) (OverrideSim p sym ext rtp args ret) Source # 
Instance details

Defined in Lang.Crucible.Simulator.OverrideSim

Methods

get :: OverrideSim p sym ext rtp args ret (SimState p sym ext rtp (OverrideLang ret) ('Just args)) #

put :: SimState p sym ext rtp (OverrideLang ret) ('Just args) -> OverrideSim p sym ext rtp args ret () #

state :: (SimState p sym ext rtp (OverrideLang ret) ('Just args) -> (a, SimState p sym ext rtp (OverrideLang ret) ('Just args))) -> OverrideSim p sym ext rtp args ret a #

initSimState Source #

Arguments

:: SimContext p sym ext

initial SimContext state

-> SymGlobalState sym

state of Crucible global variables

-> AbortHandler p sym ext (RegEntry sym ret)

initial abort handler

-> TypeRepr ret 
-> IO (SimState p sym ext (RegEntry sym ret) (OverrideLang ret) ('Just EmptyCtx)) 

Create an initial SimState

defaultAbortHandler :: IsSymInterface sym => AbortHandler p sym ext rtp Source #

The default abort handler calls abortExecAndLog.

newtype AbortHandler p sym ext rtp Source #

An abort handler indicates to the simulator what actions to take when an abort occurs. Usually, one should simply use the defaultAbortHandler from Lang.Crucible.Simulator, which unwinds the tree context to the nearest branch point and correctly resumes simulation. However, for some use cases, it may be desirable to take additional or alternate actions on abort events; in which case, the library user may replace the default abort handler with their own.

Constructors

AH 

Fields

type CrucibleState p sym ext rtp blocks ret args = SimState p sym ext rtp (CrucibleLang blocks ret) ('Just args) Source #

A simulator state that is currently executing Crucible instructions.

stateContext :: Simple Lens (SimState p sym ext r f a) (SimContext p sym ext) Source #

Access the SimContext inside a SimState

Intrinsic types

class IntrinsicClass (sym :: Type) (nm :: Symbol) Source #

Type family for intrinsic type representations. Intrinsic types are identified by a type-level Symbol, and this typeclass allows backends to define implementations for these types.

An instance of this class defines both an instance for the Intrinsic type family (which defines the runtime representation for this intrinsic type) and also the muxIntrinsic method (which defines how to merge to intrinsic values when the simulator reaches a merge point).

Note: Instances of this will typically end up as orphan instances. This warning is normally quite important, as orphan instances allow one to define multiple instances for a particular class. However, in this case, IntrinsicClass contains a type family, and GHC will globally check consistency of all type family instances. Consequently, there can be at most one implementation of IntrinsicClass in a program.

Minimal complete definition

muxIntrinsic

Instances

Instances details
IntrinsicClass sym "BoundedExecFrameData" Source # 
Instance details

Defined in Lang.Crucible.Simulator.BoundedExec

Associated Types

type Intrinsic sym "BoundedExecFrameData" ctx Source #

Methods

pushBranchIntrinsic :: forall (ctx :: Ctx CrucibleType). sym -> IntrinsicTypes sym -> SymbolRepr "BoundedExecFrameData" -> CtxRepr ctx -> Intrinsic sym "BoundedExecFrameData" ctx -> IO (Intrinsic sym "BoundedExecFrameData" ctx) Source #

abortBranchIntrinsic :: forall (ctx :: Ctx CrucibleType). sym -> IntrinsicTypes sym -> SymbolRepr "BoundedExecFrameData" -> CtxRepr ctx -> Intrinsic sym "BoundedExecFrameData" ctx -> IO (Intrinsic sym "BoundedExecFrameData" ctx) Source #

muxIntrinsic :: forall (ctx :: Ctx CrucibleType). sym -> IntrinsicTypes sym -> SymbolRepr "BoundedExecFrameData" -> CtxRepr ctx -> Pred sym -> Intrinsic sym "BoundedExecFrameData" ctx -> Intrinsic sym "BoundedExecFrameData" ctx -> IO (Intrinsic sym "BoundedExecFrameData" ctx) Source #

IntrinsicClass sym "BoundedRecursionData" Source # 
Instance details

Defined in Lang.Crucible.Simulator.BoundedRecursion

Associated Types

type Intrinsic sym "BoundedRecursionData" ctx Source #

Methods

pushBranchIntrinsic :: forall (ctx :: Ctx CrucibleType). sym -> IntrinsicTypes sym -> SymbolRepr "BoundedRecursionData" -> CtxRepr ctx -> Intrinsic sym "BoundedRecursionData" ctx -> IO (Intrinsic sym "BoundedRecursionData" ctx) Source #

abortBranchIntrinsic :: forall (ctx :: Ctx CrucibleType). sym -> IntrinsicTypes sym -> SymbolRepr "BoundedRecursionData" -> CtxRepr ctx -> Intrinsic sym "BoundedRecursionData" ctx -> IO (Intrinsic sym "BoundedRecursionData" ctx) Source #

muxIntrinsic :: forall (ctx :: Ctx CrucibleType). sym -> IntrinsicTypes sym -> SymbolRepr "BoundedRecursionData" -> CtxRepr ctx -> Pred sym -> Intrinsic sym "BoundedRecursionData" ctx -> Intrinsic sym "BoundedRecursionData" ctx -> IO (Intrinsic sym "BoundedRecursionData" ctx) Source #

data IntrinsicMuxFn (sym :: Type) (nm :: Symbol) where Source #

The IntrinsicMuxFn datatype allows an IntrinsicClass instance to be packaged up into a value. This allows us to get access to IntrinsicClass instance methods (the muxIntrinsic method in particular) at runtime even for symbol names that are not known statically.

By packaging up a type class instance (rather than just providing some method with the same signature as muxIntrinsic) we get the compiler to ensure that a single distinguished implementation is always used for each backend/symbol name combination. This prevents any possible confusion between different parts of the system.

Constructors

IntrinsicMuxFn :: IntrinsicClass sym nm => IntrinsicMuxFn sym nm 

type IntrinsicTypes sym = MapF SymbolRepr (IntrinsicMuxFn sym) Source #

IntrinsicTypes is a map from symbol name representatives to IntrinsicMuxFn values. Such a map is useful for providing access to intrinsic type implementations that are not known statically at compile time.

emptyIntrinsicTypes :: IntrinsicTypes sym Source #

An empty collection of intrinsic types, for cases where no additional types are required

Evaluation

executeCrucible Source #

Arguments

:: forall p sym ext rtp. (IsSymInterface sym, IsSyntaxExtension ext) 
=> [ExecutionFeature p sym ext rtp]

Execution features to install

-> ExecState p sym ext rtp

Execution state to begin executing

-> IO (ExecResult p sym ext rtp) 

Given a SimState and an execution continuation, apply the continuation and execute the resulting computation until completion.

This function is responsible for catching AbortExecReason exceptions and UserError exceptions and invoking the errorHandler contained in the state.

singleStepCrucible Source #

Arguments

:: (IsSymInterface sym, IsSyntaxExtension ext) 
=> Int

Current verbosity

-> ExecState p sym ext rtp 
-> IO (ExecState p sym ext rtp) 

Run a single step of the Crucible symbolic simulator.

evalReg :: Monad m => Reg ctx tp -> ReaderT (CrucibleState p sym ext rtp blocks r ctx) m (RegValue sym tp) Source #

Retrieve the value of a register.

evalArgs :: Monad m => Assignment (Reg ctx) args -> ReaderT (CrucibleState p sym ext rtp blocks r ctx) m (RegMap sym args) Source #

Evaluate the actual arguments for a function call or block transfer.

stepStmt Source #

Arguments

:: forall p sym ext rtp blocks r ctx ctx'. (IsSymInterface sym, IsSyntaxExtension ext) 
=> Int

Current verbosity

-> Stmt ext ctx ctx'

Statement to evaluate

-> StmtSeq ext blocks r ctx'

Remaining statements in the block

-> ExecCont p sym ext rtp (CrucibleLang blocks r) ('Just ctx) 

Evaluation operation for evaluating a single straight-line statement of the Crucible evaluator.

This is allowed to throw user exceptions or SimError.

stepTerm Source #

Arguments

:: forall p sym ext rtp blocks r ctx. (IsSymInterface sym, IsSyntaxExtension ext) 
=> Int

Verbosity

-> TermStmt blocks r ctx

Terminating statement to evaluate

-> ExecCont p sym ext rtp (CrucibleLang blocks r) ('Just ctx) 

Evaluation operation for evaluating a single block-terminator statement of the Crucible evaluator.

This is allowed to throw user exceptions or SimError.

stepBasicBlock Source #

Arguments

:: (IsSymInterface sym, IsSyntaxExtension ext) 
=> Int

Current verbosity

-> ExecCont p sym ext rtp (CrucibleLang blocks r) ('Just ctx) 

Main evaluation operation for running a single step of basic block evaluation.

This is allowed to throw user exceptions or SimError.

data ExecutionFeature p sym ext rtp Source #

An execution feature represents a computation that is allowed to intercept the processing of execution states to perform additional processing at each intermediate state. A list of execution features is accepted by executeCrucible. After each step of the simulator, the execution features are consulted, each in turn. After all the execution features have run, the main simulator code is executed to advance the simulator one step.

If an execution feature wishes to make changes to the execution state before further execution happens, the return value can be used to return a modified state. If this happens, the current stack of execution features is abandoned and a fresh step starts over immediately from the top of the execution features. In essence, each execution feature can preempt all following execution features and the main simulator loop. In other words, the main simulator only gets reached if every execution feature returns Nothing. It is important, therefore, that execution features make only a bounded number of modification in a row, or the main simulator loop will be starved out.

data GenericExecutionFeature sym Source #

A generic execution feature is an execution feature that is agnostic to the execution environment, and is therefore polymorphic over the p, ext and rtp variables.

timeoutFeature :: NominalDiffTime -> IO (GenericExecutionFeature sym) Source #

This feature will terminate the execution of a crucible simulator with a TimeoutResult after a given interval of wall-clock time has elapsed.

OverrideSim monad