Module Machine.State

Machine State.

Any component can have its own state. In fact, components can have a global state and a local state.

The Primus Machine is an implementation of the Non-deterministic abstract machine, and thus can have more than one state. Basically, every time a non-deterministic event happens a machine can be forked (cloned). The Global state is never replicated, and a machine can have only one global state, that is shared across all clones of a machine, and can be used as a communication channel between the clones. The local state is duplicated at each clone.

type 'a t

'a t is a type of state that holds a value of type 'a, and can be constructed from the base context of type 'c.

type 'a state = 'a t
type void

a type that has no values

type uuid = (void, void, void) Core_kernel.format

uuid is a string literal representing an UUID.

It should have the form:

XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,

where X is a hex-digit, e.g.,

53dcf68a-c7c8-4915-ae38-9f5b6f574201

val declare : ?inspect:('a -> Core_kernel.Sexp.t) -> uuid:uuid -> name:string -> (Bap.Std.project -> 'a) -> 'a t

declare ~inspect ~uuid ~name make declares a state with the given uuid and name. The name is not required to be unique, while uuid is obviously required to be unique.

See uuid type description for the uuid representation. A new uuid can be obtained in the Linux system is provided by the uuidgen command.

val inspect : 'a t -> 'a -> Core_kernel.Sexp.t

inspect state value introspects given value of the state.

val name : 'a t -> string

name state a state name that was given during the construction.