Frama-C API - Make_LOffset
Parameters
module V : sig ... end
module Offsetmap : Offsetmap_sig.S with type v = V.t and type widen_hint = V.widen_hint
module _ : Default_offsetmap with type v := V.t and type offsetmap := Offsetmap.t
Signature
type v = V.t
type of the values associated to a location
type offsetmap = Offsetmap.t
type of the maps associated to a base
type widen_hint_base = V.widen_hint
widening hints for each base
include Datatype.S_with_collections with type t = lmap
include Datatype.S with type t = lmap
include Datatype.S_no_copy with type t = lmap
val packed_descr : Structural_descr.pack
Packed version of the descriptor.
val reprs : t list
List of representants of the descriptor.
val hash : t -> int
Hash function: same spec than Hashtbl.hash
.
val mem_project : (Project_skeleton.t -> bool) -> t -> bool
mem_project f x
must return true
iff there is a value p
of type Project.t
in x
such that f p
returns true
.
module Set : Datatype.Set with type elt = t
module Map : Datatype.Map with type key = t
module Hashtbl : Datatype.Hashtbl with type key = t
val pretty : Stdlib.Format.formatter -> t -> unit
val pretty_debug : Stdlib.Format.formatter -> t -> unit
General shape
val top : t
val is_top : t -> bool
val empty_map : t
Empty map. Casual users do not need this except to create a custom initial state.
val is_empty_map : t -> bool
val bottom : t
Every location is associated to the value bottom
of type v
in this state. This state can be reached only in dead code.
val is_reachable : t -> bool
Join and inclusion
module Make_Narrow (_ : sig ... end) : sig ... end
type widen_hint = Base.t -> widen_hint_base
Widening hint for each base.
val widen : ?priority:Base.Set.t -> ?hint:widen_hint -> t -> t -> t
widen ~priority ~hint m1 m2
performs a widening on m2
, assuming that m1
was the previous state. The relation is_included m1 m2
must hold. priority
is an optional set of bases that must be widened in priority. hint
defines optional hint for each base.
Finding values
val find : ?conflate_bottom:bool -> t -> Locations.location -> v Lattice_bounds.or_bottom
val copy_offsetmap : Locations.Location_Bits.t -> Integer.t -> t -> offsetmap Lattice_bounds.or_bottom
copy_offsetmap alarms loc size m
returns the superposition of the ranges of size
bits starting at loc
within m
. size
must be strictly greater than zero. Return None
if all pointed addresses are invalid in m
.
val find_base : Base.t -> t -> offsetmap Lattice_bounds.or_top_bottom
val find_base_or_default : Base.t -> t -> offsetmap Lattice_bounds.or_top_bottom
Same as find_base
, but return the default values for bases that are not currently present in the map. Prefer the use of this function to find_base
, unless you explicitly want to see if the base is bound.
Binding variables
val add_binding : exact:bool -> t -> Locations.location -> v -> t
add_binding ~exact initial_mem loc v
simulates the effect of writing v
at location loc
, in the initial memory state given by initial_mem
. If loc
is not writable, bottom
is returned. If exact
is true, and loc
is a precise location, a strong update is performed. Only locations that may be valid are written. Returns the resulting memory after the write.
val paste_offsetmap : from:offsetmap -> dst_loc:Locations.Location_Bits.t -> size:Integer.t -> exact:bool -> t -> t
paste_offsetmap ~from ~dst_loc ~size ~exact m
copies from
, which is supposed to be exactly size
bits, and pastes them at dst_loc
in m
. The copy is exact if and only if dst_loc
is exact, and exact
is true. Only the locations that may be valid are written.
add_base b o m
adds base b
bound to o
, replacing any previous bindings of b
. No effect on Top
or Bottom
.
Creates the offsetmap described by size
, v
and size_v
, and binds it to the base. No effect on Top
or Bottom
.
Filters
Remove from the map all the bases that do not satisfy the predicate.
val filter_by_shape : 'a Hptmap.Shape(Base.Base).t -> t -> t
Remove from the map all the bases that are not also present in the given Base.t
-indexed tree.
val replace_base : Base.substitution -> t -> t
replace_bases substitition map
replaces some bases in map
according to substitution
. If substitution
conflates different bases, the offsetmaps bound to these bases are joined.
Iterators
Notice that some iterators require an argument of type map
: the cases Top
and Bottom
must be handled separately. All the iterators below only present bases that are bound to non-default values, according to the function is_default_offsetmap
of the function Lmap.Make_Loffset
.
Cached iterators
These functions are meant to be partially applied to all their arguments but the final one (the map). They must be called at the toplevel of OCaml modules, as they create persistent caches.
Misc
val remove_variables : Cil_types.varinfo list -> t -> t
val shape : map -> offsetmap Hptmap.Shape(Base.Base).t
Shape of the map. This can be used for simultaneous iterations on other maps indexed by type Base.Base.t
.