Module Memory_domain.Memory

Parameters

module Value : Value
module Lift : Value_to_address with module Value := Value and module Address := Address

Signature

module Address = Address
module Value = Value
include Domain_sig.Minimal with module Context = Value.Context with type boolean = Value.boolean
include Domain_sig.Minimal_No_Boolean with module Context = Value.Context with type boolean = Value.boolean
include Domain_sig.With_Id
val unique_id : Domain_sig.Fresh_id.t
val name : string
include Domain_sig.With_Context with module Context = Value.Context
module Context = Value.Context
val root_context : unit -> Context.t
val context_pretty : Stdlib.Format.formatter -> Context.t -> unit
type boolean = Value.boolean
include Domain_sig.With_Assume with module Context := Context and type boolean := boolean
val assume : Context.t -> boolean -> Context.t option

Corresponds to the creation of a new basic block, accessible only if the condition is met. None means bottom.

val imperative_assume : Context.t -> boolean -> unit

Because the transfer functions imperatively change the context, they cannot use assume, that returns a new context. Temporarily, we provide this instead (it should be applied only to fresh symbolic variables and not modify the set of valuations of the other symbolic variables. In particular, the condition must never make the context bottom).

The good long-term solution would be to make every transfer function return a new Context.t option, viewing the context as some state monad.

include Domain_sig.With_Nondet with module Context := Context
val typed_nondet2 : Context.t -> Context.t -> 'a Context.in_tuple -> Context.t * 'a Context.out_tuple
val nondet_same_context : Context.t -> 'a Context.in_tuple -> 'a Context.out_tuple
include Domain_sig.With_Fixpoint_Computation with module Context := Context
val mu_context_open : Context.t -> Context.t
val typed_fixpoint_step : init:Context.t -> arg:Context.t -> body:Context.t -> (bool * 'a Context.in_tuple) -> bool * (close:bool -> 'a Context.out_tuple * Context.t)
include Domain_sig.With_Boolean with module Context := Context and type boolean := boolean
module Boolean : Datatype_sig.S with type t = boolean
val boolean_pretty : Context.t -> Stdlib.Format.formatter -> boolean -> unit
val serialize_boolean : Context.t -> boolean -> Context.t -> boolean -> 'a Context.in_acc -> (boolean, 'a) Context.result
val boolean_empty : Context.t -> boolean
val boolean_unknown : Context.t -> boolean
val query_boolean : Context.t -> boolean -> Lattices.Quadrivalent.t
type address = Address.binary
type memory
val pretty : Context.t -> Stdlib.Format.formatter -> memory -> unit
val load : size:int -> Context.t -> memory -> address -> Value.binary
val typed_load : size:int -> Context.t -> memory -> address -> Types.Ctypes.typ -> Value.binary
val store : size:int -> Context.t -> memory -> address -> Value.binary -> memory
val typed_store : size:int -> Context.t -> memory -> address -> Types.Ctypes.typ -> Value.binary -> memory
val serialize : Context.t -> memory -> Context.t -> memory -> 'a Context.in_acc -> (memory, 'a) Context.result
val malloc : id:Transfer_functions.Malloc_id.t -> malloc_size:int -> Context.t -> memory -> address * memory

Allocates a separated block of memory, identified by id. The values initially contained is empty.

val free : Context.t -> memory -> address -> memory

Free a memory region.

val unknown : level:int -> Context.t -> memory

An initial, unknown region.

val memory_empty : Context.t -> memory

An empty region, with no bound address.

include Memory_Queries with module Context := Context and type memory := memory and type address := address
val should_focus : size:int -> Context.t -> memory -> address -> (address * int * int) option

should_focus ~size ctx mem addr asks the domain whether it is useful to "focus" (or "unfold", i.e. try to represent precisely the memory region pointed to by addr, as long as aliasing info ensures that it is sound) a loaded value. If the answer is yes, then the returned value should contain three things about the region to focus: its base, its size and the offset of addr in it.

val may_alias : ptr_size:int -> Context.t -> size1:int -> size2:int -> address -> address -> bool

may_alias ~ptr_size ~size1 ~size2 ctx addr1 addr2 should return whether the region starting at addr1 of size size1 and the region starting at addr2 of size size2 may have a non-empty intersection. This function is used by focusing abstractions to discard a focused region when writing in a possibly aliased address. ptr_size is only the size of bath addr1 and addr2.