| Copyright | (c) Galois Inc 2014-2018 |
|---|---|
| License | BSD3 |
| Maintainer | Joe Hendrix <jhendrix@galois.com> |
| Stability | provisional |
| Safe Haskell | None |
| Language | Haskell2010 |
Lang.Crucible.Simulator.ExecutionTree
Description
Execution trees record the state of the simulator as it explores execution paths through a program. This module defines the collection of datatypes that record the state of a running simulator and basic lenses and accessors for these types. See Lang.Crucible.Simulator.Operations for the definitions of operations that manipulate these datastructures to drive them through the simulator state machine.
Synopsis
- data GlobalPair sym v = GlobalPair {
- _gpValue :: !v
- _gpGlobals :: !(SymGlobalState sym)
- gpValue :: forall sym u v f. Functor f => (u -> f v) -> GlobalPair sym u -> f (GlobalPair sym v)
- gpGlobals :: forall sym u f. Functor f => (SymGlobalState sym -> f (SymGlobalState sym)) -> GlobalPair sym u -> f (GlobalPair sym u)
- type TopFrame sym ext f (args :: Maybe (Ctx CrucibleType)) = GlobalPair sym (SimFrame sym ext f args)
- crucibleTopFrame :: forall sym ext (blocks :: Ctx (Ctx CrucibleType)) (r :: CrucibleType) (args :: Ctx CrucibleType) (args' :: Ctx CrucibleType) f. Functor f => (CallFrame sym ext blocks r args -> f (CallFrame sym ext blocks r args')) -> TopFrame sym ext (CrucibleLang blocks r) ('Just args) -> f (TopFrame sym ext (CrucibleLang blocks r) ('Just args'))
- overrideTopFrame :: forall sym ext (r :: CrucibleType) (args :: Ctx CrucibleType) (r' :: CrucibleType) (args' :: Ctx CrucibleType) f. Functor f => (OverrideFrame sym r args -> f (OverrideFrame sym r' args')) -> TopFrame sym ext (OverrideLang r) ('Just args) -> f (TopFrame sym ext (OverrideLang r') ('Just args'))
- data CrucibleBranchTarget f (args :: Maybe (Ctx CrucibleType)) where
- BlockTarget :: forall (blocks :: Ctx (Ctx CrucibleType)) (args1 :: Ctx CrucibleType) (r :: CrucibleType). !(BlockID blocks args1) -> CrucibleBranchTarget (CrucibleLang blocks r) ('Just args1)
- ReturnTarget :: forall f. CrucibleBranchTarget f ('Nothing :: Maybe (Ctx CrucibleType))
- ppBranchTarget :: forall f (args :: Maybe (Ctx CrucibleType)). CrucibleBranchTarget f args -> String
- data AbortedResult sym ext where
- AbortedExec :: forall sym ext l (args :: Maybe (Ctx CrucibleType)). !AbortExecReason -> !(GlobalPair sym (SimFrame sym ext l args)) -> AbortedResult sym ext
- AbortedExit :: forall sym ext l (args :: Maybe (Ctx CrucibleType)). !ExitCode -> !(GlobalPair sym (SimFrame sym ext l args)) -> AbortedResult sym ext
- AbortedBranch :: forall sym ext. !ProgramLoc -> !(Pred sym) -> !(AbortedResult sym ext) -> !(AbortedResult sym ext) -> AbortedResult sym ext
- data SomeFrame (f :: fk -> argk -> Type) = SomeFrame !(f l a)
- filterCrucibleFrames :: SomeFrame (SimFrame sym ext) -> Maybe ProgramLoc
- arFrames :: forall sym ext f. Applicative f => (SomeFrame (SimFrame sym ext) -> f (SomeFrame (SimFrame sym ext))) -> AbortedResult sym ext -> f (AbortedResult sym ext)
- ppExceptionContext :: [SomeFrame (SimFrame sym ext)] -> Doc ann
- data PartialResult sym ext v
- = TotalRes !(GlobalPair sym v)
- | PartialRes !ProgramLoc !(Pred sym) !(GlobalPair sym v) !(AbortedResult sym ext)
- type PartialResultFrame sym ext f (args :: Maybe (Ctx CrucibleType)) = PartialResult sym ext (SimFrame sym ext f args)
- partialValue :: forall sym ext u v f. Functor f => (GlobalPair sym u -> f (GlobalPair sym v)) -> PartialResult sym ext u -> f (PartialResult sym ext v)
- data ExecResult p sym ext rtp
- = FinishedResult !(SimContext p sym ext) !(PartialResult sym ext rtp)
- | AbortedResult !(SimContext p sym ext) !(AbortedResult sym ext)
- | TimeoutResult !(ExecState p sym ext rtp)
- data ExecState p sym ext rtp
- = ResultState !(ExecResult p sym ext rtp)
- | AbortState !AbortExecReason !(SimState p sym ext rtp f a)
- | UnwindCallState !(ValueFromValue p sym ext rtp r) !(AbortedResult sym ext) !(SimState p sym ext rtp f a)
- | CallState !(ReturnHandler ret p sym ext rtp f a) !(ResolvedCall p sym ext ret) !(SimState p sym ext rtp f a)
- | TailCallState !(ValueFromValue p sym ext rtp ret) !(ResolvedCall p sym ext ret) !(SimState p sym ext rtp f a)
- | ReturnState !FunctionName !(ValueFromValue p sym ext rtp ret) !(RegEntry sym ret) !(SimState p sym ext rtp f a)
- | RunningState !(RunningStateInfo blocks args) !(SimState p sym ext rtp (CrucibleLang blocks r) ('Just 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))
- | ControlTransferState !(ControlResumption p sym ext rtp f) !(SimState p sym ext rtp f ('Just a))
- | OverrideState !(Override p sym ext args ret) !(SimState p sym ext rtp (OverrideLang ret) ('Just args))
- | BranchMergeState !(CrucibleBranchTarget f args) !(SimState p sym ext rtp f args)
- | 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 :: Ctx CrucibleType)))
- type ExecCont p sym ext rtp f (args :: Maybe (Ctx CrucibleType)) = ReaderT (SimState p sym ext rtp f args) IO (ExecState p sym ext rtp)
- data RunningStateInfo (blocks :: Ctx (Ctx CrucibleType)) (args :: Ctx CrucibleType)
- = RunBlockStart !(BlockID blocks args)
- | RunBlockEnd !(Some (BlockID blocks))
- | RunReturnFrom !FunctionName
- | RunPostBranchMerge !(BlockID blocks args)
- data ResolvedCall p sym ext (ret :: CrucibleType) where
- OverrideCall :: forall p sym ext (args :: Ctx CrucibleType) (ret :: CrucibleType). !(Override p sym ext args ret) -> !(OverrideFrame sym ret args) -> ResolvedCall p sym ext ret
- CrucibleCall :: forall (blocks :: Ctx (Ctx CrucibleType)) (args :: Ctx CrucibleType) sym ext (ret :: CrucibleType) p. !(BlockID blocks args) -> !(CallFrame sym ext blocks ret args) -> ResolvedCall p sym ext ret
- resolvedCallHandle :: forall p sym ext (ret :: CrucibleType). ResolvedCall p sym ext ret -> SomeHandle
- execResultContext :: ExecResult p sym ext r -> SimContext p sym ext
- setExecResultContext :: SimContext p sym ext -> ExecResult p sym ext r -> ExecResult p sym ext r
- execStateContext :: ExecState p sym ext r -> SimContext p sym ext
- setExecStateContext :: SimContext p sym ext -> ExecState p sym ext r -> ExecState p sym ext r
- execStateSimState :: ExecState p sym ext r -> Maybe (SomeSimState p sym ext r)
- execResultGlobals :: Monad f => (SimContext p sym ext -> ProgramLoc -> Pred sym -> SymGlobalState sym -> SymGlobalState sym -> f (SymGlobalState sym)) -> ExecResult p sym ext rtp -> f (SymGlobalState sym)
- execStateGlobals :: Monad f => (SimContext p sym ext -> ProgramLoc -> Pred sym -> SymGlobalState sym -> SymGlobalState sym -> f (SymGlobalState sym)) -> ExecState p sym ext rtp -> f (SymGlobalState sym)
- data ValueFromValue p sym ext ret (top_return :: CrucibleType)
- = VFVCall !(ValueFromFrame p sym ext ret caller) !(SimFrame sym ext caller args) !(ReturnHandler top_return p sym ext ret caller args)
- | VFVPartial !(ValueFromValue p sym ext ret top_return) !ProgramLoc !(Pred sym) !(AbortedResult sym ext)
- | ret ~ RegEntry sym top_return => VFVEnd
- data ValueFromFrame p sym ext ret f
- = VFFBranch !(ValueFromFrame p sym ext ret f) !FrameIdentifier !ProgramLoc !(Pred sym) !(VFFOtherPath p sym ext ret f args) !(CrucibleBranchTarget f args)
- | VFFPartial !(ValueFromFrame p sym ext ret f) !ProgramLoc !(Pred sym) !(AbortedResult sym ext) !PendingPartialMerges
- | VFFEnd !(ValueFromValue p sym ext ret (FrameRetType f))
- data PendingPartialMerges
- data ResolvedJump sym (blocks :: Ctx (Ctx CrucibleType)) = ResolvedJump !(BlockID blocks args) !(RegMap sym args)
- data ControlResumption p sym ext rtp f where
- ContinueResumption :: forall sym (blocks :: Ctx (Ctx CrucibleType)) p ext rtp (r :: CrucibleType). !(ResolvedJump sym blocks) -> ControlResumption p sym ext rtp (CrucibleLang blocks r)
- CheckMergeResumption :: forall sym (blocks :: Ctx (Ctx CrucibleType)) p ext rtp (r :: CrucibleType). !(ResolvedJump sym blocks) -> ControlResumption p sym ext rtp (CrucibleLang blocks r)
- SwitchResumption :: forall sym (blocks :: Ctx (Ctx CrucibleType)) p ext rtp (r :: CrucibleType). ![(Pred sym, ResolvedJump sym blocks)] -> ControlResumption p sym ext rtp (CrucibleLang blocks r)
- OverrideResumption :: forall p sym ext rtp (r :: CrucibleType) (args :: Ctx CrucibleType). ExecCont p sym ext rtp (OverrideLang r) ('Just args) -> !(RegMap sym args) -> ControlResumption p sym ext rtp (OverrideLang r)
- data PausedFrame p sym ext rtp f = PausedFrame {
- pausedFrame :: !(PartialResultFrame sym ext f ('Just old_args))
- resume :: !(ControlResumption p sym ext rtp f)
- pausedLoc :: !(Maybe ProgramLoc)
- data VFFOtherPath p sym ext ret f (args :: Maybe (Ctx CrucibleType))
- = VFFActivePath !(PausedFrame p sym ext ret f)
- | VFFCompletePath !(Assumptions sym) !(PartialResultFrame sym ext f args)
- type family FrameRetType f :: CrucibleType where ...
- data ReturnHandler (ret :: CrucibleType) p sym ext root f (args :: Maybe (Ctx CrucibleType)) where
- ReturnToOverride :: forall sym (ret :: CrucibleType) p ext root (r :: CrucibleType) (args1 :: Ctx CrucibleType). (RegEntry sym ret -> SimState p sym ext root (OverrideLang r) ('Just args1) -> IO (ExecState p sym ext root)) -> ReturnHandler ret p sym ext root (OverrideLang r) ('Just args1)
- ReturnToCrucible :: forall (ret :: CrucibleType) ext (blocks :: Ctx (Ctx CrucibleType)) (r :: CrucibleType) (ctx :: Ctx CrucibleType) p sym root. TypeRepr ret -> StmtSeq ext blocks r (ctx ::> ret) -> ReturnHandler ret p sym ext root (CrucibleLang blocks r) ('Just ctx)
- TailReturnToCrucible :: forall (ret :: CrucibleType) (r :: CrucibleType) p sym ext root (blocks :: Ctx (Ctx CrucibleType)) (args :: Maybe (Ctx CrucibleType)). ret ~ r => ReturnHandler ret p sym ext root (CrucibleLang blocks r) args
- data ActiveTree p sym ext root f (args :: Maybe (Ctx CrucibleType)) = ActiveTree {
- _actContext :: !(ValueFromFrame p sym ext root f)
- _actResult :: !(PartialResultFrame sym ext f args)
- singletonTree :: forall sym ext f (args :: Maybe (Ctx CrucibleType)) p. TopFrame sym ext f args -> ActiveTree p sym ext (RegEntry sym (FrameRetType f)) f args
- activeFrames :: forall ctx sym ext root a (args :: Maybe (Ctx CrucibleType)). ActiveTree ctx sym ext root a args -> [SomeFrame (SimFrame sym ext)]
- actContext :: forall p sym ext root f1 (args :: Maybe (Ctx CrucibleType)) f2. Functor f2 => (ValueFromFrame p sym ext root f1 -> f2 (ValueFromFrame p sym ext root f1)) -> ActiveTree p sym ext root f1 args -> f2 (ActiveTree p sym ext root f1 args)
- actFrame :: forall p sym ext root f1 (args :: Maybe (Ctx CrucibleType)) (args' :: Maybe (Ctx CrucibleType)) f2. Functor f2 => (TopFrame sym ext f1 args -> f2 (TopFrame sym ext f1 args')) -> ActiveTree p sym ext root f1 args -> f2 (ActiveTree p sym ext root f1 args')
- data Override p sym ext (args :: Ctx CrucibleType) (ret :: CrucibleType) = Override {
- overrideName :: FunctionName
- overrideHandler :: forall r. ExecCont p sym ext r (OverrideLang ret) ('Just args)
- data FnState p sym ext (args :: Ctx CrucibleType) (ret :: CrucibleType)
- = UseOverride !(Override p sym ext args ret)
- | UseCFG !(CFG ext blocks args ret) !(CFGPostdom blocks)
- newtype FunctionBindings p sym ext = FnBindings {
- fnBindings :: FnHandleMap (FnState p sym ext)
- data ExtensionImpl p sym ext = ExtensionImpl {
- extensionEval :: forall bak rtp (blocks :: Ctx (Ctx CrucibleType)) (r :: CrucibleType) (ctx :: Ctx CrucibleType). IsSymBackend sym bak => bak -> IntrinsicTypes sym -> (Int -> String -> IO ()) -> CrucibleState p sym ext rtp blocks r ctx -> EvalAppFunc sym (ExprExtension ext)
- extensionExec :: EvalStmtFunc p sym ext
- type EvalStmtFunc p sym ext = forall rtp (blocks :: Ctx (Ctx CrucibleType)) (r :: CrucibleType) (ctx :: Ctx CrucibleType) (tp' :: CrucibleType). 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)
- emptyExtensionImpl :: ExtensionImpl p sym ()
- type IsSymInterfaceProof sym a = (IsSymInterface sym => a) -> a
- data SimContext p sym ext = SimContext {
- _ctxBackend :: !(SomeBackend sym)
- ctxSolverProof :: !(forall a. IsSymInterfaceProof sym a)
- ctxIntrinsicTypes :: !(IntrinsicTypes sym)
- simHandleAllocator :: !HandleAllocator
- printHandle :: !Handle
- extensionImpl :: ExtensionImpl p sym ext
- _functionBindings :: !(FunctionBindings p sym ext)
- _cruciblePersonality :: !p
- _profilingMetrics :: !(Map Text (Metric p sym ext))
- newtype Metric p sym ext = Metric {}
- initSimContext :: IsSymBackend sym bak => bak -> IntrinsicTypes sym -> HandleAllocator -> Handle -> FunctionBindings personality sym ext -> ExtensionImpl personality sym ext -> personality -> SimContext personality sym ext
- withBackend :: SimContext personality sym ext -> (forall bak. IsSymBackend sym bak => bak -> a) -> a
- ctxSymInterface :: forall p sym ext f. (Contravariant f, Functor f) => (sym -> f sym) -> SimContext p sym ext -> f (SimContext p sym ext)
- functionBindings :: forall p sym ext f. Functor f => (FunctionBindings p sym ext -> f (FunctionBindings p sym ext)) -> SimContext p sym ext -> f (SimContext p sym ext)
- cruciblePersonality :: forall p sym ext f. Functor f => (p -> f p) -> SimContext p sym ext -> f (SimContext p sym ext)
- profilingMetrics :: forall p sym ext f. Functor f => (Map Text (Metric p sym ext) -> f (Map Text (Metric p sym ext))) -> SimContext p sym ext -> f (SimContext p sym ext)
- data SimState p sym ext rtp f (args :: Maybe (Ctx CrucibleType)) = SimState {
- _stateContext :: !(SimContext p sym ext)
- _abortHandler :: !(AbortHandler p sym ext rtp)
- _stateTree :: !(ActiveTree p sym ext rtp f args)
- data SomeSimState p sym ext rtp = SomeSimState !(SimState p sym ext rtp f args)
- initSimState :: forall p sym ext (ret :: CrucibleType). SimContext p sym ext -> SymGlobalState sym -> AbortHandler p sym ext (RegEntry sym ret) -> TypeRepr ret -> IO (SimState p sym ext (RegEntry sym ret) (OverrideLang ret) ('Just (EmptyCtx :: Ctx CrucibleType)))
- stateLocation :: forall p sym ext r f1 (a :: Maybe (Ctx CrucibleType)) f2. (Contravariant f2, Functor f2) => (Maybe ProgramLoc -> f2 (Maybe ProgramLoc)) -> SimState p sym ext r f1 a -> f2 (SimState p sym ext r f1 a)
- newtype AbortHandler p sym ext rtp = AH {
- runAH :: forall l (args :: Maybe (Ctx CrucibleType)). AbortExecReason -> ExecCont p sym ext rtp l args
- type CrucibleState p sym ext rtp (blocks :: Ctx (Ctx CrucibleType)) (ret :: CrucibleType) (args :: Ctx CrucibleType) = SimState p sym ext rtp (CrucibleLang blocks ret) ('Just args)
- stateTree :: forall p sym ext rtp f1 (a :: Maybe (Ctx CrucibleType)) g (b :: Maybe (Ctx CrucibleType)) f2. Functor f2 => (ActiveTree p sym ext rtp f1 a -> f2 (ActiveTree p sym ext rtp g b)) -> SimState p sym ext rtp f1 a -> f2 (SimState p sym ext rtp g b)
- abortHandler :: forall p sym ext r f1 (a :: Maybe (Ctx CrucibleType)) f2. Functor f2 => (AbortHandler p sym ext r -> f2 (AbortHandler p sym ext r)) -> SimState p sym ext r f1 a -> f2 (SimState p sym ext r f1 a)
- stateContext :: forall p sym ext r f1 (a :: Maybe (Ctx CrucibleType)) f2. Functor f2 => (SimContext p sym ext -> f2 (SimContext p sym ext)) -> SimState p sym ext r f1 a -> f2 (SimState p sym ext r f1 a)
- stateCrucibleFrame :: forall p sym ext rtp (blocks :: Ctx (Ctx CrucibleType)) (r :: CrucibleType) (a :: Ctx CrucibleType) (a' :: Ctx CrucibleType) f. Functor f => (CallFrame sym ext blocks r a -> f (CallFrame sym ext blocks r a')) -> SimState p sym ext rtp (CrucibleLang blocks r) ('Just a) -> f (SimState p sym ext rtp (CrucibleLang blocks r) ('Just a'))
- stateSymInterface :: forall p sym ext r f1 (a :: Maybe (Ctx CrucibleType)) f2. (Contravariant f2, Functor f2) => (sym -> f2 sym) -> SimState p sym ext r f1 a -> f2 (SimState p sym ext r f1 a)
- stateSolverProof :: forall p sym ext r f (args :: Maybe (Ctx CrucibleType)). SimState p sym ext r f args -> forall a. IsSymInterfaceProof sym a
- stateIntrinsicTypes :: forall p sym ext r f1 (args :: Maybe (Ctx CrucibleType)) f2. (Contravariant f2, Functor f2) => (IntrinsicTypes sym -> f2 (IntrinsicTypes sym)) -> SimState p sym ext r f1 args -> f2 (SimState p sym ext r f1 args)
- stateOverrideFrame :: forall p sym ext q (r :: CrucibleType) (a :: Ctx CrucibleType) (a' :: Ctx CrucibleType) f. Functor f => (OverrideFrame sym r a -> f (OverrideFrame sym r a')) -> SimState p sym ext q (OverrideLang r) ('Just a) -> f (SimState p sym ext q (OverrideLang r) ('Just a'))
- stateGlobals :: forall p sym ext q f1 (args :: Maybe (Ctx CrucibleType)) f2. Functor f2 => (SymGlobalState sym -> f2 (SymGlobalState sym)) -> SimState p sym ext q f1 args -> f2 (SimState p sym ext q f1 args)
- stateConfiguration :: forall p sym ext r f1 (args :: Maybe (Ctx CrucibleType)) f2. (Contravariant f2, Functor f2) => (Config -> f2 Config) -> SimState p sym ext r f1 args -> f2 (SimState p sym ext r f1 args)
GlobalPair
data GlobalPair sym v Source #
A value of some type v together with a global state.
Type parameters:
sym: instance ofIsSymInterfacev: type of the value
Constructors
| GlobalPair | |
Fields
| |
gpValue :: forall sym u v f. Functor f => (u -> f v) -> GlobalPair sym u -> f (GlobalPair sym v) Source #
Access the value stored in the global pair.
gpGlobals :: forall sym u f. Functor f => (SymGlobalState sym -> f (SymGlobalState sym)) -> GlobalPair sym u -> f (GlobalPair sym u) Source #
Access the globals stored in the global pair.
TopFrame
type TopFrame sym ext f (args :: Maybe (Ctx CrucibleType)) = GlobalPair sym (SimFrame sym ext f args) Source #
The currently-executing frame plus the global state associated with it.
Type parameters:
sym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionf: the type of the top frame (CrucibleLangorOverrideLang)args: arguments to this frame (seeSimFrame)
crucibleTopFrame :: forall sym ext (blocks :: Ctx (Ctx CrucibleType)) (r :: CrucibleType) (args :: Ctx CrucibleType) (args' :: Ctx CrucibleType) f. Functor f => (CallFrame sym ext blocks r args -> f (CallFrame sym ext blocks r args')) -> TopFrame sym ext (CrucibleLang blocks r) ('Just args) -> f (TopFrame sym ext (CrucibleLang blocks r) ('Just args')) Source #
Access the Crucible call frame inside a TopFrame.
overrideTopFrame :: forall sym ext (r :: CrucibleType) (args :: Ctx CrucibleType) (r' :: CrucibleType) (args' :: Ctx CrucibleType) f. Functor f => (OverrideFrame sym r args -> f (OverrideFrame sym r' args')) -> TopFrame sym ext (OverrideLang r) ('Just args) -> f (TopFrame sym ext (OverrideLang r') ('Just args')) Source #
CrucibleBranchTarget
data CrucibleBranchTarget f (args :: Maybe (Ctx CrucibleType)) where Source #
A CrucibleBranchTarget identifies a program location that is a
potential join point. Each label is a merge point, and there is
an additional implicit join point at function returns.
Constructors
| BlockTarget :: forall (blocks :: Ctx (Ctx CrucibleType)) (args1 :: Ctx CrucibleType) (r :: CrucibleType). !(BlockID blocks args1) -> CrucibleBranchTarget (CrucibleLang blocks r) ('Just args1) | |
| ReturnTarget :: forall f. CrucibleBranchTarget f ('Nothing :: Maybe (Ctx CrucibleType)) |
Instances
| TestEquality (CrucibleBranchTarget f :: Maybe (Ctx CrucibleType) -> Type) Source # | |
Defined in Lang.Crucible.Simulator.CallFrame Methods testEquality :: forall (a :: Maybe (Ctx CrucibleType)) (b :: Maybe (Ctx CrucibleType)). CrucibleBranchTarget f a -> CrucibleBranchTarget f b -> Maybe (a :~: b) # | |
ppBranchTarget :: forall f (args :: Maybe (Ctx CrucibleType)). CrucibleBranchTarget f args -> String Source #
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).
Type parameters:
sym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extension
Constructors
| AbortedExec :: forall sym ext l (args :: Maybe (Ctx CrucibleType)). !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 :: forall sym ext l (args :: Maybe (Ctx CrucibleType)). !ExitCode -> !(GlobalPair sym (SimFrame sym ext l args)) -> AbortedResult sym ext | An aborted execution that was ended by a call to |
| AbortedBranch :: forall sym ext. !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. |
data SomeFrame (f :: fk -> argk -> Type) Source #
This represents an execution frame where its frame type and arguments have been hidden.
The type parameter f is usually SimFrame.
Constructors
| SomeFrame !(f l a) |
filterCrucibleFrames :: SomeFrame (SimFrame sym ext) -> Maybe ProgramLoc Source #
Return the program locations of all the Crucible frames.
arFrames :: forall sym ext f. Applicative f => (SomeFrame (SimFrame sym ext) -> f (SomeFrame (SimFrame sym ext))) -> AbortedResult sym ext -> f (AbortedResult sym ext) Source #
Iterate over frames in the result.
Partial result
data PartialResult sym ext v 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.
Type parameters:
sym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionv: Type of the result of the computation
Constructors
| TotalRes !(GlobalPair sym v) | A |
| PartialRes !ProgramLoc !(Pred sym) !(GlobalPair sym v) !(AbortedResult sym ext) |
|
type PartialResultFrame sym ext f (args :: Maybe (Ctx CrucibleType)) = PartialResult sym ext (SimFrame sym ext f args) Source #
partialValue :: forall sym ext u v f. Functor f => (GlobalPair sym u -> f (GlobalPair sym v)) -> PartialResult sym ext u -> f (PartialResult sym ext v) Source #
Access the value stored in the partial result.
Execution states
data ExecResult p sym ext rtp Source #
Executions that have completed either due to (partial or total) successful completion or by some abort condition.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionrtp: type of the return value
Constructors
| FinishedResult !(SimContext p sym ext) !(PartialResult sym ext rtp) | 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 rtp) | An execution stopped somewhere in the middle of a run because a timeout condition occurred. |
data ExecState p sym ext rtp 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.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionrtp: type of the return value
Constructors
| ResultState !(ExecResult p sym ext rtp) | The |
| AbortState !AbortExecReason !(SimState p sym ext rtp f a) | An abort state indicates that the included |
| 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 |
| 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. |
| 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. |
| 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. |
| RunningState !(RunningStateInfo blocks args) !(SimState p sym ext rtp (CrucibleLang blocks r) ('Just args)) | A running state indicates the included |
| 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 |
| 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. |
| OverrideState !(Override p sym ext args ret) !(SimState p sym ext rtp (OverrideLang ret) ('Just args)) | An override state indicates the included |
| BranchMergeState !(CrucibleBranchTarget f args) !(SimState p sym ext rtp f args) | A branch merge state occurs when the included |
| 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 :: Ctx CrucibleType))) | 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
|
type ExecCont p sym ext rtp f (args :: Maybe (Ctx CrucibleType)) = ReaderT (SimState p sym ext rtp f args) IO (ExecState p sym ext rtp) Source #
An action which will construct an ExecState given a current
SimState. Such continuations correspond to a single transition
of the simulator transition system.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionrtp: type of the return valuef: the type of the top frame (CrucibleLangorOverrideLang)args: arguments to the current frame (seeSimFrame)
data RunningStateInfo (blocks :: Ctx (Ctx CrucibleType)) (args :: Ctx CrucibleType) Source #
Some additional information attached to a RunningState
that indicates how we got to this running state.
Type parameters:
blocks: types of variables in scope from previous blocksargs: arguments to this block
Constructors
| RunBlockStart !(BlockID blocks args) | This indicates that we are now in a |
| RunBlockEnd !(Some (BlockID blocks)) | This indicates that we are in a |
| RunReturnFrom !FunctionName | This indicates that we are in a |
| RunPostBranchMerge !(BlockID blocks args) | This indicates that we are now in a |
data ResolvedCall p sym ext (ret :: CrucibleType) where Source #
The result of resolving a function call.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionret:CrucibleTypeof the return value
Constructors
| OverrideCall :: forall p sym ext (args :: Ctx CrucibleType) (ret :: CrucibleType). !(Override p sym ext args ret) -> !(OverrideFrame sym ret args) -> ResolvedCall p sym ext ret | A resolved function call to an override. |
| CrucibleCall :: forall (blocks :: Ctx (Ctx CrucibleType)) (args :: Ctx CrucibleType) sym ext (ret :: CrucibleType) p. !(BlockID blocks args) -> !(CallFrame sym ext blocks ret args) -> ResolvedCall p sym ext ret | A resolved function call to a Crucible function. |
resolvedCallHandle :: forall p sym ext (ret :: CrucibleType). ResolvedCall p sym ext ret -> SomeHandle Source #
execResultContext :: ExecResult p sym ext r -> SimContext p sym ext Source #
setExecResultContext :: SimContext p sym ext -> ExecResult p sym ext r -> ExecResult p sym ext r Source #
execStateContext :: ExecState p sym ext r -> SimContext p sym ext Source #
setExecStateContext :: SimContext p sym ext -> ExecState p sym ext r -> ExecState p sym ext r Source #
execStateSimState :: ExecState p sym ext r -> Maybe (SomeSimState p sym ext r) Source #
Arguments
| :: Monad f | |
| => (SimContext p sym ext -> ProgramLoc -> Pred sym -> SymGlobalState sym -> SymGlobalState sym -> f (SymGlobalState sym)) | How to handle Common options include concretizing the |
| -> ExecResult p sym ext rtp | |
| -> f (SymGlobalState sym) |
Extract the SymGlobalState from an ExecResult.
Arguments
| :: Monad f | |
| => (SimContext p sym ext -> ProgramLoc -> Pred sym -> SymGlobalState sym -> SymGlobalState sym -> f (SymGlobalState sym)) | How to handle Common options include concretizing the |
| -> ExecState p sym ext rtp | |
| -> f (SymGlobalState sym) |
Extract the SymGlobalState from an ExecState.
Simulator context trees
Main context data structures
data ValueFromValue p sym ext ret (top_return :: CrucibleType) Source #
This type contains information about the current state of the exploration
of the branching structure of a program. The ValueFromValue states correspond
to stack call frames in a more traditional simulator environment.
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionret: global return type of the entire executiontop_return: return type of the top-most call on the stack.
Constructors
| VFVCall !(ValueFromFrame p sym ext ret caller) !(SimFrame sym ext caller args) !(ReturnHandler top_return p sym ext ret caller args) |
|
| VFVPartial !(ValueFromValue p sym ext ret top_return) !ProgramLoc !(Pred sym) !(AbortedResult sym ext) | A partial value. The predicate indicates what needs to hold to avoid the partiality. The AbortedResult describes what could go wrong if the predicate does not hold. |
| ret ~ RegEntry sym top_return => VFVEnd | The top return value, indicating the program termination point. |
Instances
| Pretty (ValueFromValue p ext sym root rp) Source # | |
Defined in Lang.Crucible.Simulator.ExecutionTree Methods pretty :: ValueFromValue p ext sym root rp -> Doc ann # prettyList :: [ValueFromValue p ext sym root rp] -> Doc ann # | |
data ValueFromFrame p sym ext ret f Source #
This type contains information about the current state of the exploration
of the branching structure of a program. The ValueFromFrame states correspond
to the structure of symbolic branching that occurs within a single function call.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionret: global return type of the entire executionf: the type of the top frame (CrucibleLangorOverrideLang)
Constructors
| VFFBranch !(ValueFromFrame p sym ext ret f) !FrameIdentifier !ProgramLoc !(Pred sym) !(VFFOtherPath p sym ext ret f args) !(CrucibleBranchTarget f args) | We are working on a branch; this could be the first or the second
of both branches (see the |
| VFFPartial !(ValueFromFrame p sym ext ret f) !ProgramLoc !(Pred sym) !(AbortedResult sym ext) !PendingPartialMerges | We are on a branch where the other branch was aborted before getting to the merge point. |
| VFFEnd !(ValueFromValue p sym ext ret (FrameRetType f)) | When we are finished with this branch we should return from the function. |
Instances
| Pretty (ValueFromFrame p ext sym ret f) Source # | |
Defined in Lang.Crucible.Simulator.ExecutionTree Methods pretty :: ValueFromFrame p ext sym ret f -> Doc ann # prettyList :: [ValueFromFrame p ext sym ret f] -> Doc ann # | |
data PendingPartialMerges Source #
Data about whether the surrounding context is expecting a merge to occur or not. If the context sill expects a merge, we need to take some actions to indicate that the merge will not occur; otherwise there is no special work to be done.
Constructors
| NoNeedToAbort | Don't indicate an abort condition in the context |
| NeedsToBeAborted | Indicate an abort condition in the context when we get there again. |
Paused Frames
data ResolvedJump sym (blocks :: Ctx (Ctx CrucibleType)) Source #
A ResolvedJump is a block label together with a collection of
actual arguments that are expected by that block. These data
are sufficient to actually transfer control to the named label.
Type parameters:
sym: instance ofIsSymInterfaceblocks: types of variables in scope from previous blocks
Constructors
| ResolvedJump !(BlockID blocks args) !(RegMap sym args) |
data ControlResumption p sym ext rtp f where Source #
When a path of execution is paused by the symbolic simulator
(while it first explores other paths), a ControlResumption
indicates what actions must later be taken in order to resume
execution of that path.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionrtp: type of the return valuef: the type of the top frame (CrucibleLangorOverrideLang)
Constructors
| ContinueResumption :: forall sym (blocks :: Ctx (Ctx CrucibleType)) p ext rtp (r :: CrucibleType). !(ResolvedJump sym blocks) -> ControlResumption p sym ext rtp (CrucibleLang blocks r) | When resuming a paused frame with a |
| CheckMergeResumption :: forall sym (blocks :: Ctx (Ctx CrucibleType)) p ext rtp (r :: CrucibleType). !(ResolvedJump sym blocks) -> ControlResumption p sym ext rtp (CrucibleLang blocks r) | When resuming with a |
| SwitchResumption :: forall sym (blocks :: Ctx (Ctx CrucibleType)) p ext rtp (r :: CrucibleType). ![(Pred sym, ResolvedJump sym blocks)] -> ControlResumption p sym ext rtp (CrucibleLang blocks r) | When resuming a paused frame with a |
| OverrideResumption :: forall p sym ext rtp (r :: CrucibleType) (args :: Ctx CrucibleType). ExecCont p sym ext rtp (OverrideLang r) ('Just args) -> !(RegMap sym args) -> ControlResumption p sym ext rtp (OverrideLang r) | When resuming a paused frame with an |
data PausedFrame p sym ext rtp f Source #
A PausedFrame represents a path of execution that has been postponed
while other paths are explored. It consists of a (potentially partial)
SimFrame together with some information about how to resume execution
of that frame.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionrtp: type of the return valuef: the type of the top frame (CrucibleLangorOverrideLang)
Constructors
| PausedFrame | |
Fields
| |
Sibling paths
data VFFOtherPath p sym ext ret f (args :: Maybe (Ctx CrucibleType)) Source #
This describes the state of the sibling path at a symbolic branch point.
A symbolic branch point starts with the sibling in the VFFActivePath
state, which indicates that the sibling path still needs to be executed.
After the first path to be explored has reached the merge point, the
places of the two paths are exchanged, and the completed path is
stored in the VFFCompletePath state until the second path also
reaches its merge point. The two paths will then be merged,
and execution will continue beyond the merge point.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionrtp: type of the return valuef: the type of the top frame (CrucibleLangorOverrideLang)args: arguments to this frame (seeSimFrame)
Constructors
| VFFActivePath !(PausedFrame p sym ext ret f) | This corresponds the a path that still needs to be analyzed. |
| VFFCompletePath !(Assumptions sym) !(PartialResultFrame sym ext f args) | This is a completed execution path. |
Instances
| Pretty (VFFOtherPath ctx sym ext r f a) Source # | |
Defined in Lang.Crucible.Simulator.ExecutionTree Methods pretty :: VFFOtherPath ctx sym ext r f a -> Doc ann # prettyList :: [VFFOtherPath ctx sym ext r f a] -> Doc ann # | |
type family FrameRetType f :: CrucibleType where ... Source #
Equations
| FrameRetType (CrucibleLang b r) = r | |
| FrameRetType (OverrideLang r) = r |
ReturnHandler
data ReturnHandler (ret :: CrucibleType) p sym ext root f (args :: Maybe (Ctx CrucibleType)) where Source #
A ReturnHandler indicates what actions to take to resume
executing in a caller's context once a function call has completed and
the return value is available.
Type parameters:
ret: the type of the return value that is expectedp: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionroot: global return type of the entire computationf: the frame type of the caller (CrucibleLangorOverrideLang)args: types of the local variables in scope prior to the call (seeSimFrame)
Constructors
| ReturnToOverride :: forall sym (ret :: CrucibleType) p ext root (r :: CrucibleType) (args1 :: Ctx CrucibleType). (RegEntry sym ret -> SimState p sym ext root (OverrideLang r) ('Just args1) -> IO (ExecState p sym ext root)) -> ReturnHandler ret p sym ext root (OverrideLang r) ('Just args1) | The |
| ReturnToCrucible :: forall (ret :: CrucibleType) ext (blocks :: Ctx (Ctx CrucibleType)) (r :: CrucibleType) (ctx :: Ctx CrucibleType) p sym root. TypeRepr ret -> StmtSeq ext blocks r (ctx ::> ret) -> ReturnHandler ret p sym ext root (CrucibleLang blocks r) ('Just ctx) | The |
| TailReturnToCrucible :: forall (ret :: CrucibleType) (r :: CrucibleType) p sym ext root (blocks :: Ctx (Ctx CrucibleType)) (args :: Maybe (Ctx CrucibleType)). ret ~ r => ReturnHandler ret p sym ext root (CrucibleLang blocks r) args | The |
ActiveTree
data ActiveTree p sym ext root f (args :: Maybe (Ctx CrucibleType)) Source #
An active execution tree contains at least one active execution. The data structure is organized so that the current execution can be accessed rapidly.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionroot: global return type of the entire computationf: the frame type of the caller (CrucibleLangorOverrideLang) -- -args: arguments to the current frame (seeSimFrame)
Constructors
| ActiveTree | |
Fields
| |
singletonTree :: forall sym ext f (args :: Maybe (Ctx CrucibleType)) p. TopFrame sym ext f args -> ActiveTree p sym ext (RegEntry sym (FrameRetType f)) f args Source #
Create a tree with a single top frame.
activeFrames :: forall ctx sym ext root a (args :: Maybe (Ctx CrucibleType)). ActiveTree ctx sym ext root a args -> [SomeFrame (SimFrame sym ext)] Source #
Return the call stack of all active frames, in reverse activation order (i.e., with callees appearing before callers).
actContext :: forall p sym ext root f1 (args :: Maybe (Ctx CrucibleType)) f2. Functor f2 => (ValueFromFrame p sym ext root f1 -> f2 (ValueFromFrame p sym ext root f1)) -> ActiveTree p sym ext root f1 args -> f2 (ActiveTree p sym ext root f1 args) Source #
Access the calling context of the currently-active frame
actFrame :: forall p sym ext root f1 (args :: Maybe (Ctx CrucibleType)) (args' :: Maybe (Ctx CrucibleType)) f2. Functor f2 => (TopFrame sym ext f1 args -> f2 (TopFrame sym ext f1 args')) -> ActiveTree p sym ext root f1 args -> f2 (ActiveTree p sym ext root f1 args') Source #
Access the currently-active frame
Simulator context
Function bindings
data Override p sym ext (args :: Ctx CrucibleType) (ret :: CrucibleType) Source #
A definition of a function's semantics, given as a Haskell action.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionargs: types of arguments to the overrideret: return type of the override
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.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionargs: argument typesret: return type
Constructors
| UseOverride !(Override p sym ext args ret) | |
| UseCFG !(CFG ext blocks args ret) !(CFGPostdom blocks) |
newtype FunctionBindings p sym ext Source #
A map from function handles to their semantics.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extension
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.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extension
Constructors
| ExtensionImpl | |
Fields
| |
type EvalStmtFunc p sym ext = forall rtp (blocks :: Ctx (Ctx CrucibleType)) (r :: CrucibleType) (ctx :: Ctx CrucibleType) (tp' :: CrucibleType). 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.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extension
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 p sym ext 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.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extension
Constructors
| SimContext | |
Fields
| |
newtype Metric p sym ext Source #
Some kind of Integer to be collected during execution.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extension
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.
withBackend :: SimContext personality sym ext -> (forall bak. IsSymBackend sym bak => bak -> a) -> a Source #
ctxSymInterface :: forall p sym ext f. (Contravariant f, Functor f) => (sym -> f sym) -> SimContext p sym ext -> f (SimContext p sym ext) Source #
Access the symbolic backend inside a SimContext.
functionBindings :: forall p sym ext f. Functor f => (FunctionBindings p sym ext -> f (FunctionBindings p sym ext)) -> SimContext p sym ext -> f (SimContext p sym ext) Source #
A map from function handles to their semantics.
cruciblePersonality :: forall p sym ext f. Functor f => (p -> f p) -> SimContext p sym ext -> f (SimContext p sym ext) Source #
Custom state inside the SimContext.
Crucible itself is entirely polymorphic over p. Downstream applications can
instantiate it to any sort of state that they would like to associate with a
SimContext.
For example, applications based on
macaw-symbolic
can instantiate this to a structure holding enough information to perform
incremental code discovery. See ambient-verifier's
AmbientSimulatorState.
Code that needs to store some state in the personality but doesn't wish to fix a particular type can use the "classy lenses" approach, e.g.,
class HasFooState p where
fooState :: Lens' p FooState
For examples of this approach, see
profilingMetrics :: forall p sym ext f. Functor f => (Map Text (Metric p sym ext) -> f (Map Text (Metric p sym ext))) -> SimContext p sym ext -> f (SimContext 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.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionrtp: type of the return valuef: the type of the top frame (CrucibleLangorOverrideLang)args: arguments to the current frame (seeSimFrame)
Constructors
| SimState | |
Fields
| |
Instances
| MonadState (SimState p sym ext rtp (OverrideLang ret) ('Just args)) (OverrideSim p sym ext rtp args ret) Source # | |
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 # | |
data SomeSimState p sym ext rtp Source #
Constructors
| SomeSimState !(SimState p sym ext rtp f args) |
Arguments
| :: forall p sym ext (ret :: CrucibleType). SimContext p sym ext | initial |
| -> 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 :: Ctx CrucibleType))) |
Create an initial SimState
stateLocation :: forall p sym ext r f1 (a :: Maybe (Ctx CrucibleType)) f2. (Contravariant f2, Functor f2) => (Maybe ProgramLoc -> f2 (Maybe ProgramLoc)) -> SimState p sym ext r f1 a -> f2 (SimState p sym ext r f1 a) Source #
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.
Type parameters:
p: seecruciblePersonalitysym: instance ofIsSymInterfaceext: language extension, see Lang.Crucible.CFG.Extensionrtp: type of the return value
Constructors
| AH | |
Fields
| |
type CrucibleState p sym ext rtp (blocks :: Ctx (Ctx CrucibleType)) (ret :: CrucibleType) (args :: Ctx CrucibleType) = SimState p sym ext rtp (CrucibleLang blocks ret) ('Just args) Source #
A simulator state that is currently executing Crucible instructions.
Lenses and accessors
stateTree :: forall p sym ext rtp f1 (a :: Maybe (Ctx CrucibleType)) g (b :: Maybe (Ctx CrucibleType)) f2. Functor f2 => (ActiveTree p sym ext rtp f1 a -> f2 (ActiveTree p sym ext rtp g b)) -> SimState p sym ext rtp f1 a -> f2 (SimState p sym ext rtp g b) Source #
Access the active tree associated with a state.
abortHandler :: forall p sym ext r f1 (a :: Maybe (Ctx CrucibleType)) f2. Functor f2 => (AbortHandler p sym ext r -> f2 (AbortHandler p sym ext r)) -> SimState p sym ext r f1 a -> f2 (SimState p sym ext r f1 a) Source #
Access the current abort handler of a state.
stateContext :: forall p sym ext r f1 (a :: Maybe (Ctx CrucibleType)) f2. Functor f2 => (SimContext p sym ext -> f2 (SimContext p sym ext)) -> SimState p sym ext r f1 a -> f2 (SimState p sym ext r f1 a) Source #
Access the SimContext inside a SimState
stateCrucibleFrame :: forall p sym ext rtp (blocks :: Ctx (Ctx CrucibleType)) (r :: CrucibleType) (a :: Ctx CrucibleType) (a' :: Ctx CrucibleType) f. Functor f => (CallFrame sym ext blocks r a -> f (CallFrame sym ext blocks r a')) -> SimState p sym ext rtp (CrucibleLang blocks r) ('Just a) -> f (SimState p sym ext rtp (CrucibleLang blocks r) ('Just a')) Source #
Access the Crucible call frame inside a SimState
stateSymInterface :: forall p sym ext r f1 (a :: Maybe (Ctx CrucibleType)) f2. (Contravariant f2, Functor f2) => (sym -> f2 sym) -> SimState p sym ext r f1 a -> f2 (SimState p sym ext r f1 a) Source #
Get the symbolic interface out of a SimState
stateSolverProof :: forall p sym ext r f (args :: Maybe (Ctx CrucibleType)). SimState p sym ext r f args -> forall a. IsSymInterfaceProof sym a Source #
Provide the IsSymInterface typeclass dictionary from a SimState
stateIntrinsicTypes :: forall p sym ext r f1 (args :: Maybe (Ctx CrucibleType)) f2. (Contravariant f2, Functor f2) => (IntrinsicTypes sym -> f2 (IntrinsicTypes sym)) -> SimState p sym ext r f1 args -> f2 (SimState p sym ext r f1 args) Source #
Get the intrinsic type map out of a SimState
stateOverrideFrame :: forall p sym ext q (r :: CrucibleType) (a :: Ctx CrucibleType) (a' :: Ctx CrucibleType) f. Functor f => (OverrideFrame sym r a -> f (OverrideFrame sym r a')) -> SimState p sym ext q (OverrideLang r) ('Just a) -> f (SimState p sym ext q (OverrideLang r) ('Just a')) Source #
Access the override frame inside a SimState
stateGlobals :: forall p sym ext q f1 (args :: Maybe (Ctx CrucibleType)) f2. Functor f2 => (SymGlobalState sym -> f2 (SymGlobalState sym)) -> SimState p sym ext q f1 args -> f2 (SimState p sym ext q f1 args) Source #
Access the globals inside a SimState
stateConfiguration :: forall p sym ext r f1 (args :: Maybe (Ctx CrucibleType)) f2. (Contravariant f2, Functor f2) => (Config -> f2 Config) -> SimState p sym ext r f1 args -> f2 (SimState p sym ext r f1 args) Source #
Get the configuration object out of a SimState