package mopsa
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=37966e98ffeebcedc09bd6e9b2b81f69
sha512=40d4d826c25f680766c07eccbabdf5e8a4fa023016e8a164e4e4f6b3781c8484dc4df437055721dfd19b9db8fb7fe3b61236c4833186d346fc7204a68d01eaaa
doc/mopsa.mopsa_analyzer/Mopsa_analyzer/MopsaLib/index.html
Module Mopsa_analyzer.MopsaLibSource
Essential modules.
include module type of struct include Mopsa_utils end
module Bitfields = Mopsa_utils.Bitfieldsmodule CongUtils = Mopsa_utils.CongUtilsmodule Containers = Mopsa_utils.Containersmodule ItvUtils = Mopsa_utils.ItvUtilsinclude module type of struct include Framework.Core.All end
include module type of struct include Core.Ast.Semantic end
include module type of struct include Core.Ast.Constant end
type constant = Core.Ast.Constant.constant = ..Extensible constants
compare_constant c1 c2 provides a total order between any pair c1 and c2 of registered constants
val pp_constant : Format.formatter -> constant -> unitpp_constant fmt c pretty-prints a registered constant c with formatter fmt
Registration
val register_constant : constant Mopsa_utils.Core.TypeExt.info -> unitregister_constant info registers a new constant with a comparison function info.compare and a pretty-printer info.print
val register_constant_compare :
constant Mopsa_utils.Core.TypeExt.compare ->
unitregister_constant_compare compare registers a new comparison function for constants
val register_constant_pp : constant Mopsa_utils.Core.TypeExt.print -> unitregister_constant_compare compare registers a new pretty-printer for constants
Common constants
include module type of struct include Framework.Core.Ast.Expr end
type expr_kind = Framework.Core.Ast.Expr.expr_kind = ..Extensible type of expression kinds
type expr = Framework.Core.Ast.Expr.expr = {ekind : expr_kind;(*kind of the expression
*)etyp : Framework.Core.Ast.Typ.typ;(*type of the expression
*)erange : Mopsa_utils.Core.Location.range;(*location range of the expression
*)etrans : expr Core.Ast.Semantic.SemanticMap.t;(*translations of the expression into other semantics
*)ehistory : expr list;(*History of preceding evaluations of the expression
*)esynthetic : bool;(*whether the expression was generated dynamically during the analysis
*)
}Expressions
compare_expr e1 e2 implements a total order between expressions
val pp_expr : Format.formatter -> expr -> unitpp_expr fmt e pretty-prints expression e with format fmt
val etyp : expr -> Framework.Core.Ast.Typ.typGet the type of an expression
val erange : expr -> Mopsa_utils.Core.Location.rangeGet the location of an expression
val etrans : expr -> expr Core.Ast.Semantic.SemanticMap.tGet the translation map of an expression
val esynthetic : expr -> boolCheck if an expression is synthetic
val mk_expr :
?etyp:Framework.Core.Ast.Typ.typ ->
?etrans:expr Core.Ast.Semantic.SemanticMap.t ->
?ehistory:expr list ->
?esynthetic:bool ->
expr_kind ->
Mopsa_utils.Core.Location.range ->
exprConstruct an expression
val add_expr_translation : Core.Ast.Semantic.semantic -> expr -> expr -> exprAdd a translation of an expression
val get_expr_translations : expr -> expr Core.Ast.Semantic.SemanticMap.tGet all translations of an expression
val get_expr_translation : Core.Ast.Semantic.semantic -> expr -> exprGet the translation of an expression into a given semantic
Get the ancestor expression verifying a predicate
Registration
val register_expr : expr Mopsa_utils.Core.TypeExt.info -> unitregister_expr info registers new expressions with their comparison function info.compare and pretty-printer info.print
val register_expr_compare : expr Mopsa_utils.Core.TypeExt.compare -> unitregister_expr_compare compare registers a new expression comparison
val register_expr_pp : expr Mopsa_utils.Core.TypeExt.print -> unitregister_expr_compare compare registers a new expression printer
Some common expressions
Variable expressions
type expr_kind += | E_var of Framework.Core.Ast.Var.var * Framework.Core.Ast.Var.mode option(*optional access mode overloading the variable's access mode
*)
Variables
val mk_var :
?esynthetic:bool ->
Framework.Core.Ast.Var.var ->
?mode:Framework.Core.Ast.Var.mode option ->
Mopsa_utils.Core.Location.range ->
exprCreate a variable expression
val var_mode :
Framework.Core.Ast.Var.var ->
Framework.Core.Ast.Var.mode option ->
Framework.Core.Ast.Var.modeGet the overloaded access mode of a variable
Heap addresses expressions
type expr_kind += | E_addr of Framework.Core.Ast.Addr.addr * Framework.Core.Ast.Var.mode option(*optional access mode overloading the address access mode
*)| E_alloc_addr of Framework.Core.Ast.Addr.addr_kind * Framework.Core.Ast.Var.mode
Heap addresses
val mk_addr :
?esynthetic:bool ->
Framework.Core.Ast.Addr.addr ->
?etyp:Framework.Core.Ast.Typ.typ ->
?mode:Framework.Core.Ast.Var.mode option ->
Mopsa_utils.Core.Location.range ->
exprCreate an address expression
val mk_alloc_addr :
?esynthetic:bool ->
?mode:Framework.Core.Ast.Var.mode ->
Framework.Core.Ast.Addr.addr_kind ->
Mopsa_utils.Core.Location.range ->
exprCreate an allocation expression
Constant expressions
Constants
val mk_constant :
?esynthetic:bool ->
?etyp:Framework.Core.Ast.Typ.typ ->
Core.Ast.Constant.constant ->
Mopsa_utils.Core.Location.range ->
exprCreate a constant expression
val mk_top :
?esynthetic:bool ->
Framework.Core.Ast.Typ.typ ->
Mopsa_utils.Core.Location.range ->
exprCreate ⊤ expression of a given type
Unary expressions
Unary operator expressions
val mk_unop :
?esynthetic:bool ->
?etyp:Framework.Core.Ast.Typ.typ ->
Framework.Core.Ast.Operator.operator ->
expr ->
Mopsa_utils.Core.Location.range ->
exprCreate a unary operator expression
val mk_not :
?esynthetic:bool ->
expr ->
Mopsa_utils.Core.Location.range ->
exprmk_not e range returns the negation of expression e using the operator Operator.O_log_not
Binary expressions
Binary operator expressions
val mk_binop :
?esynthetic:bool ->
?etyp:Framework.Core.Ast.Typ.typ ->
expr ->
Framework.Core.Ast.Operator.operator ->
expr ->
Mopsa_utils.Core.Location.range ->
exprCreate a binary operator expression
Expressions containers
module ExprSet = Mopsa_analyzer.Framework.Core.All.ExprSetSets of expression
module ExprMap = Mopsa_analyzer.Framework.Core.All.ExprMapMaps of expressions
include module type of struct include Framework.Core.Ast.Stmt end
type stmt_kind = Framework.Core.Ast.Stmt.stmt_kind = ..Extensible kinds of statements
type stmt = Framework.Core.Ast.Stmt.stmt = {skind : stmt_kind;(*kind of the statement
*)srange : Mopsa_utils.Core.Location.range;(*location range of the statement
*)ssynthetic : bool;(*whether the statement is generated during the analysis
*)
}Statements
val mk_stmt :
?ssynthetic:bool ->
stmt_kind ->
Mopsa_utils.Core.Location.range ->
stmtCreate a statement
val srange : stmt -> Mopsa_utils.Core.Location.rangeGet the location range of a statement
val ssynthetic : stmt -> boolWhether the statement is generated during the analysis
val pp_stmt : Format.formatter -> stmt -> unitPretty-printer of statements
Registration
val register_stmt : stmt Mopsa_utils.Core.TypeExt.info -> unitregister_stmt info registers a new statement by registering its compare function info.compare and pretty-printer info.print
val register_stmt_compare : stmt Mopsa_utils.Core.TypeExt.compare -> unitRegister a comparison function for statements
val register_stmt_pp : stmt Mopsa_utils.Core.TypeExt.print -> unitRegister a pretty-printer function for statements
Blocks
type block = stmt listBlocks are sequences of statements
val pp_block : Format.formatter -> block -> unitPretty-printer for blocks
Common statements
type stmt_kind += | S_program of Core.Ast.Program.program * string list option(*Command-line arguments as given to Mopsa after
*)--
Programs
Assignments
val mk_assign :
?ssynthetic:bool ->
Framework.Core.Ast.Expr.expr ->
Framework.Core.Ast.Expr.expr ->
Mopsa_utils.Core.Location.range ->
stmtmk_assign lhs rhs range creates the assignment lhs = rhs;
Tests
val mk_assume :
?ssynthetic:bool ->
Framework.Core.Ast.Expr.expr ->
Mopsa_utils.Core.Location.range ->
stmtCreate a test statement
type stmt_kind += | S_add of Framework.Core.Ast.Expr.expr(*Add a dimension to the environment
*)| S_remove of Framework.Core.Ast.Expr.expr(*Remove a dimension from the environment and invalidate all references to it
*)| S_invalidate of Framework.Core.Ast.Expr.expr(*Invalidate all references to a dimension without removing it
*)| S_rename of Framework.Core.Ast.Expr.expr * Framework.Core.Ast.Expr.expr(*new
*)| S_forget of Framework.Core.Ast.Expr.expr(*Forget a dimension by putting ⊤ (all possible values) in it. Note that the dimension is not removed
*)| S_project of Framework.Core.Ast.Expr.expr list(*Project the environment on the given list of dimensions. All other dimensions are removed
*)| S_expand of Framework.Core.Ast.Expr.expr * Framework.Core.Ast.Expr.expr list(*Expand a dimension into a list of other dimensions. The expanded dimension is untouched
*)| S_fold of Framework.Core.Ast.Expr.expr * Framework.Core.Ast.Expr.expr list(*Fold a list of dimensions into a single one. The folded dimensions are removed
*)| S_block of stmt list * Framework.Core.Ast.Var.var list(*local variables declared within the block
*)| S_breakpoint of string(*Trigger a breakpoint
*)
Dimensions
val mk_rename :
?ssynthetic:bool ->
Framework.Core.Ast.Expr.expr ->
Framework.Core.Ast.Expr.expr ->
Mopsa_utils.Core.Location.range ->
stmtUtility functions to create various statements for dimension management
val mk_rename_var :
?ssynthetic:bool ->
Framework.Core.Ast.Var.var ->
Framework.Core.Ast.Var.var ->
Mopsa_utils.Core.Location.range ->
stmtval mk_remove :
?ssynthetic:bool ->
Framework.Core.Ast.Expr.expr ->
Mopsa_utils.Core.Location.range ->
stmtval mk_remove_var :
?ssynthetic:bool ->
Framework.Core.Ast.Var.var ->
Mopsa_utils.Core.Location.range ->
stmtval mk_invalidate :
?ssynthetic:bool ->
Framework.Core.Ast.Expr.expr ->
Mopsa_utils.Core.Location.range ->
stmtval mk_invalidate_var :
?ssynthetic:bool ->
Framework.Core.Ast.Var.var ->
Mopsa_utils.Core.Location.range ->
stmtval mk_add :
?ssynthetic:bool ->
Framework.Core.Ast.Expr.expr ->
Mopsa_utils.Core.Location.range ->
stmtval mk_add_var :
?ssynthetic:bool ->
Framework.Core.Ast.Var.var ->
Mopsa_utils.Core.Location.range ->
stmtval mk_project :
?ssynthetic:bool ->
Framework.Core.Ast.Expr.expr list ->
Mopsa_utils.Core.Location.range ->
stmtval mk_project_vars :
?ssynthetic:bool ->
Framework.Core.Ast.Var.var list ->
Mopsa_utils.Core.Location.range ->
stmtval mk_forget :
?ssynthetic:bool ->
Framework.Core.Ast.Expr.expr ->
Mopsa_utils.Core.Location.range ->
stmtval mk_forget_var :
?ssynthetic:bool ->
Framework.Core.Ast.Var.var ->
Mopsa_utils.Core.Location.range ->
stmtval mk_expand :
?ssynthetic:bool ->
Framework.Core.Ast.Expr.expr ->
Framework.Core.Ast.Expr.expr list ->
Mopsa_utils.Core.Location.range ->
stmtval mk_expand_var :
?ssynthetic:bool ->
Framework.Core.Ast.Var.var ->
Framework.Core.Ast.Var.var list ->
Mopsa_utils.Core.Location.range ->
stmtval mk_fold :
?ssynthetic:bool ->
Framework.Core.Ast.Expr.expr ->
Framework.Core.Ast.Expr.expr list ->
Mopsa_utils.Core.Location.range ->
stmtval mk_fold_var :
?ssynthetic:bool ->
Framework.Core.Ast.Var.var ->
Framework.Core.Ast.Var.var list ->
Mopsa_utils.Core.Location.range ->
stmtval mk_breakpoint :
?ssynthetic:bool ->
string ->
Mopsa_utils.Core.Location.range ->
stmtContainers of statements
module StmtSet = Mopsa_analyzer.Framework.Core.All.StmtSetSets of statements
module StmtMap = Mopsa_analyzer.Framework.Core.All.StmtMapMaps of statements
include module type of struct include Framework.Core.Ast.Typ end
type typ = Framework.Core.Ast.Typ.typ = ..Extensible types
val pp_typ : Format.formatter -> typ -> unitPretty-print a type
Registration
val register_typ : typ Mopsa_utils.Core.TypeExt.info -> unitRegister a new type
val register_typ_compare : typ Mopsa_utils.Core.TypeExt.compare -> unitRegister a new type comparison
val register_typ_pp : typ Mopsa_utils.Core.TypeExt.print -> unitRegister a new type pretty-printer
Common types
include module type of struct include Core.Ast.Program end
type prog_kind = Core.Ast.Program.prog_kind = ..Extensible type of program kinds
type program = Core.Ast.Program.program = {prog_kind : prog_kind;(*kind of the program
*)prog_range : Mopsa_utils.Core.Location.range;(*program location
*)
}Programs
val pp_program : Format.formatter -> program -> unitPretty-printer for programs
Registration
val register_program : program Mopsa_utils.Core.TypeExt.info -> unitregister_program info registers a new program kind by registering its comparison function info.compare and pretty-printer info.print
val register_program_compare : program Mopsa_utils.Core.TypeExt.compare -> unitRegister a comparison function between programs
val register_program_pp : program Mopsa_utils.Core.TypeExt.print -> unitRegister a pretty-printer for programs
include module type of struct include Core.Ast.Frontend end
type frontend = Core.Ast.Frontend.frontend = {lang : string;(*Language of the frontend
*)parse : string list -> Core.Ast.Program.program;(*Parser function that translates a list of input source files into a Mopsa
*)Program.programon_panic : exn -> string list -> float -> unit;(*Function called when the analysis of a program terminates with an exception, and *when the output is in text mode*. Provided with the exception, list of files and analysis time. Current usecase: provide automated testcase reduction capabilities in the C analysis.
*)
}Frontends
val register_frontend : frontend -> unitRegister a new frontend
val find_language_frontend : string -> frontendFind the frontend of a given language
include module type of struct include Framework.Core.Ast.Operator end
type operator = Framework.Core.Ast.Operator.operator = ..Extensible type of operators
val pp_operator : Format.formatter -> operator -> unitPretty-printer of operators
Registration
val register_operator : operator Mopsa_utils.Core.TypeExt.info -> unitregister_operator info registers a new operator by registering its compare function info.compare and pretty-printer info.print
val register_operator_compare :
operator Mopsa_utils.Core.TypeExt.compare ->
unitRegister a comparison function for operators
val register_operator_pp : operator Mopsa_utils.Core.TypeExt.print -> unitRegister a pretty-printer for operators
Some common operators
type operator += | O_eq(*equality ==
*)| O_ne(*inequality !=
*)| O_lt(*less than <
*)| O_le(*less or equal <=
*)| O_gt(*greater than >
*)| O_ge(*greater or equal >=
*)| O_log_not(*logical negation
*)| O_log_or(*logical disjunction ||
*)| O_log_and(*logical conjunction &&
*)| O_log_xor(*logical strict disjonction xor
*)| O_cast(*type cast
*)
Common operators
val is_comparison_op : operator -> boolTest whether an operator is a comparison operator
val is_logic_op : operator -> boolTest whether an is a logical operator
include module type of struct include Framework.Core.Ast.Var end
val print_uniq_with_uid : bool refAccess modes
type var_kind = Framework.Core.Ast.Var.var_kind = ..Extensible kind of variables
type mode = Framework.Core.Ast.Var.mode = Access mode of a variable
val pp_mode : Format.formatter -> mode -> unitPretty-print an access mode
Variables
type var = Framework.Core.Ast.Var.var = {vname : string;(*unique name of the variable
*)vkind : var_kind;(*kind the variable
*)vtyp : Framework.Core.Ast.Typ.typ;(*type of the variable
*)vmode : mode;(*access mode of the variable
*)vsemantic : Core.Ast.Semantic.semantic;(*semantic of the variable
*)
}Variables
val vname : var -> stringAccessor function to the fields of a variable
val vtyp : var -> Framework.Core.Ast.Typ.typval vsemantic : var -> Core.Ast.Semantic.semanticval mkv :
string ->
var_kind ->
?mode:mode ->
?semantic:Core.Ast.Semantic.semantic ->
Framework.Core.Ast.Typ.typ ->
varCreate a variable with a unique name, a kind, a type and an access mode (STRONG if not given)
val pp_var : Format.formatter -> var -> unitPretty-print a variable
Registration
val register_var : var Mopsa_utils.Core.TypeExt.info -> unitRegister a new kind of variables
val register_var_compare : var Mopsa_utils.Core.TypeExt.compare -> unitRegister a new variable comparison
val register_var_pp : var Mopsa_utils.Core.TypeExt.print -> unitRegister a new variable pretty-printer
Common variables
type var_kind += | V_uniq of string * int(*Unique ID
*)| V_tmp of int(*Unique ID
*)| V_var_attr of var * string(*Attribute
*)| V_range_attr of Mopsa_utils.Core.Location.range * string(*Attribute
*)
val mk_uniq_var :
string ->
int ->
?mode:mode ->
Framework.Core.Ast.Typ.typ ->
varCreate a unique variable
val mk_fresh_uniq_var :
string ->
?mode:mode ->
Framework.Core.Ast.Typ.typ ->
unit ->
varCreate a fresh variable with a fresh ID
val mktmp : ?typ:Framework.Core.Ast.Typ.typ -> ?mode:mode -> unit -> varCreate a fresh temporary variable
val mk_attr_var :
var ->
string ->
?mode:mode ->
?semantic:Core.Ast.Semantic.semantic ->
Framework.Core.Ast.Typ.typ ->
varmk_attr_var v a t creates a variable representing an attribute a of another variable v
val mk_range_attr_var :
Mopsa_utils.Core.Location.range ->
string ->
?mode:mode ->
?semantic:Core.Ast.Semantic.semantic ->
Framework.Core.Ast.Typ.typ ->
varmk_range_attr_var r a t creates a variable representing an attribute a of a program location r
Containers for variables
module VarSet = Mopsa_analyzer.Framework.Core.All.VarSetSets of variables
module VarMap = Mopsa_analyzer.Framework.Core.All.VarMapMaps of variables
Deprecated
val get_orig_vname : var -> stringinclude module type of struct include Framework.Core.Ast.Addr end
type addr_kind = Framework.Core.Ast.Addr.addr_kind = ..Kind of heap addresses, used to store extra information.
val addr_kind_pp_chain : (Format.formatter -> addr_kind -> unit) refval pp_addr_kind : Format.formatter -> addr_kind -> unitval register_addr_kind : addr_kind Mopsa_utils.Core.TypeExt.info -> unittype addr_partitioning = Framework.Core.Ast.Addr.addr_partitioning = ..Addresses are grouped by static criteria to make them finite
val addr_partitioning_compare_chain :
(addr_partitioning -> addr_partitioning -> int) refval addr_partitioning_pp_chain :
(Format.formatter -> addr_partitioning -> unit) refval opt_hash_addr : bool refCommand line option to use hashes as address format
val pp_addr_partitioning_hash : Format.formatter -> addr_partitioning -> unitval pp_addr_partitioning :
?full:bool ->
Format.formatter ->
addr_partitioning ->
unitPrint a partitioning policy. Flag full overloads the option opt_hash_addr and displays the full partitioning string (not its hash, which is useful for creating unique names of addresses)
val pp_addr_partitioning_full : Format.formatter -> addr_partitioning -> unitval compare_addr_partitioning : addr_partitioning -> addr_partitioning -> intval register_addr_partitioning :
addr_partitioning Mopsa_utils.Core.TypeExt.info ->
unittype addr = Framework.Core.Ast.Addr.addr = {addr_kind : addr_kind;(*Kind of the address.
*)addr_partitioning : addr_partitioning;(*Partitioning policy of the address
*)addr_mode : Framework.Core.Ast.Var.mode;(*Assignment mode of address (string or weak)
*)
}Heap addresses.
val pp_addr : Format.formatter -> addr -> unitval addr_uniq_name : addr -> stringGet the unique name of an address. This is safer and faster than calling Format.asprintf "%s" pp_addr a when opt_hash_addr is set.
val addr_mode :
addr ->
Framework.Core.Ast.Var.mode option ->
Framework.Core.Ast.Var.modeAddress variables
val mk_addr_attr :
addr ->
string ->
Framework.Core.Ast.Typ.typ ->
Framework.Core.Ast.Var.varinclude module type of struct include Core.Ast.Visitor end
type parts = Core.Ast.Visitor.parts = {exprs : Framework.Core.Ast.Expr.expr list;(*sub-expressions
*)stmts : Framework.Core.Ast.Stmt.stmt list;(*sub-statements
*)
}Parts of a statement/expression
val structure_of_expr :
Framework.Core.Ast.Expr.expr ->
Framework.Core.Ast.Expr.expr structureGet the structure of an expression
val structure_of_stmt :
Framework.Core.Ast.Stmt.stmt ->
Framework.Core.Ast.Stmt.stmt structureGet the structure of a statement
val leaf : 'a -> 'a structureVisitor for leaf statements/expressions that have no sub-elements
Registration
type 'a visit_info = 'a Core.Ast.Visitor.visit_info = {compare : 'a Mopsa_utils.Core.TypeExt.compare;(*Comparison function for
*)'aprint : 'a Mopsa_utils.Core.TypeExt.print;(*Pretty-printer for
*)'a'visit : ('a -> 'a structure) -> 'a -> 'a structure;(*Visitor for
*)'a
}Registration descriptor for visitors
val register_expr_with_visitor :
Framework.Core.Ast.Expr.expr visit_info ->
unitRegister an expression with its visitor
val register_expr_visitor :
((Framework.Core.Ast.Expr.expr -> Framework.Core.Ast.Expr.expr structure) ->
Framework.Core.Ast.Expr.expr ->
Framework.Core.Ast.Expr.expr structure) ->
unitRegister a visitor of an expression
val register_stmt_with_visitor :
Framework.Core.Ast.Stmt.stmt visit_info ->
unitRegister a statement with its visitor
val register_stmt_visitor :
((Framework.Core.Ast.Stmt.stmt -> Framework.Core.Ast.Stmt.stmt structure) ->
Framework.Core.Ast.Stmt.stmt ->
Framework.Core.Ast.Stmt.stmt structure) ->
unitRegister a visitor of a statement
Visiting iterators
type 'a visit_action = 'a Core.Ast.Visitor.visit_action = Actions of a visiting iterator
val map_expr :
(Framework.Core.Ast.Expr.expr -> Framework.Core.Ast.Expr.expr visit_action) ->
(Framework.Core.Ast.Stmt.stmt -> Framework.Core.Ast.Stmt.stmt visit_action) ->
Framework.Core.Ast.Expr.expr ->
Framework.Core.Ast.Expr.exprmap_expr fe fs e transforms the expression e into a new one by applying visitor action fe and fs on its sub-expression and sub-statements respectively
val map_stmt :
(Framework.Core.Ast.Expr.expr -> Framework.Core.Ast.Expr.expr visit_action) ->
(Framework.Core.Ast.Stmt.stmt -> Framework.Core.Ast.Stmt.stmt visit_action) ->
Framework.Core.Ast.Stmt.stmt ->
Framework.Core.Ast.Stmt.stmtSimilar to map_expr but on statements
val fold_expr :
('a -> Framework.Core.Ast.Expr.expr -> 'a visit_action) ->
('a -> Framework.Core.Ast.Stmt.stmt -> 'a visit_action) ->
'a ->
Framework.Core.Ast.Expr.expr ->
'afold_expr fe fs e folds the accumulated result of visitors fe and fs on the structure of expression e
val fold_stmt :
('a -> Framework.Core.Ast.Expr.expr -> 'a visit_action) ->
('a -> Framework.Core.Ast.Stmt.stmt -> 'a visit_action) ->
'a ->
Framework.Core.Ast.Stmt.stmt ->
'aSimilar to fold_expr but on statements
val fold_map_expr :
('a ->
Framework.Core.Ast.Expr.expr ->
('a * Framework.Core.Ast.Expr.expr) visit_action) ->
('a ->
Framework.Core.Ast.Stmt.stmt ->
('a * Framework.Core.Ast.Stmt.stmt) visit_action) ->
'a ->
Framework.Core.Ast.Expr.expr ->
'a * Framework.Core.Ast.Expr.exprCombination of map and fold for expressions
val fold_map_stmt :
('a ->
Framework.Core.Ast.Expr.expr ->
('a * Framework.Core.Ast.Expr.expr) visit_action) ->
('a ->
Framework.Core.Ast.Stmt.stmt ->
('a * Framework.Core.Ast.Stmt.stmt) visit_action) ->
'a ->
Framework.Core.Ast.Stmt.stmt ->
'a * Framework.Core.Ast.Stmt.stmtCombination of map and fold for statements
val exists_expr :
(Framework.Core.Ast.Expr.expr -> bool) ->
(Framework.Core.Ast.Stmt.stmt -> bool) ->
Framework.Core.Ast.Expr.expr ->
boolval for_all_expr :
(Framework.Core.Ast.Expr.expr -> bool) ->
(Framework.Core.Ast.Stmt.stmt -> bool) ->
Framework.Core.Ast.Expr.expr ->
boolval iter_expr :
(Framework.Core.Ast.Expr.expr -> unit) ->
(Framework.Core.Ast.Stmt.stmt -> unit) ->
Framework.Core.Ast.Expr.expr ->
unitval exists_stmt :
(Framework.Core.Ast.Expr.expr -> bool) ->
(Framework.Core.Ast.Stmt.stmt -> bool) ->
Framework.Core.Ast.Stmt.stmt ->
boolval for_all_stmt :
(Framework.Core.Ast.Expr.expr -> bool) ->
(Framework.Core.Ast.Stmt.stmt -> bool) ->
Framework.Core.Ast.Stmt.stmt ->
boolval iter_stmt :
(Framework.Core.Ast.Expr.expr -> unit) ->
(Framework.Core.Ast.Stmt.stmt -> unit) ->
Framework.Core.Ast.Stmt.stmt ->
unitval exists_child_expr :
(Framework.Core.Ast.Expr.expr -> bool) ->
(Framework.Core.Ast.Stmt.stmt -> bool) ->
Framework.Core.Ast.Expr.expr ->
boolval for_all_child_expr :
(Framework.Core.Ast.Expr.expr -> bool) ->
(Framework.Core.Ast.Stmt.stmt -> bool) ->
Framework.Core.Ast.Expr.expr ->
boolval exists_child_stmt :
(Framework.Core.Ast.Expr.expr -> bool) ->
(Framework.Core.Ast.Stmt.stmt -> bool) ->
Framework.Core.Ast.Stmt.stmt ->
boolval for_all_child_stmt :
(Framework.Core.Ast.Expr.expr -> bool) ->
(Framework.Core.Ast.Stmt.stmt -> bool) ->
Framework.Core.Ast.Stmt.stmt ->
boolUtility functions
val is_leaf_expr : Framework.Core.Ast.Expr.expr -> boolTest whether an expression is a leaf expression
val is_atomic_expr : Framework.Core.Ast.Expr.expr -> boolTest whether an expression has no sub-statement
val is_atomic_stmt : Framework.Core.Ast.Stmt.stmt -> boolTest whether a statement has no sub-statement
val expr_vars : Framework.Core.Ast.Expr.expr -> Framework.Core.Ast.Var.var listGet all variables present in an expression
val stmt_vars : Framework.Core.Ast.Stmt.stmt -> Framework.Core.Ast.Var.var listGet all variables present in a statement
val is_var_in_expr :
Framework.Core.Ast.Var.var ->
Framework.Core.Ast.Expr.expr ->
boolCheck whether a variable appears in an expression
val is_var_in_stmt :
Framework.Core.Ast.Var.var ->
Framework.Core.Ast.Stmt.stmt ->
boolCheck whether a variable appears in a statement
Deprecated
val fold_sub_expr :
('a -> Framework.Core.Ast.Expr.expr -> 'a visit_action) ->
('a -> Framework.Core.Ast.Stmt.stmt -> 'a visit_action) ->
'a ->
Framework.Core.Ast.Expr.expr ->
'ainclude module type of struct include Framework.Core.Alarm end
Checks
**********
Domains can add new checks by extending the type check and registering them using register_check. Note that checks should be simple variant constructs without any argument.
type check = Framework.Core.Alarm.check = ..val pp_check : Format.formatter -> check -> unitPrint a check
val register_check :
((Format.formatter -> check -> unit) -> Format.formatter -> check -> unit) ->
unitRegister a check with its printer
Alarms
**********
Alarms are issues related to a check in a given range and a given callstack. Domains can add new kinds of alarms to store information related to the issue, such suspect values that raised the alarm. Nevertheless, domains can use the generic alarm A_generic of check if they don't have addition static information to attach to the alarm.
type alarm_kind = Framework.Core.Alarm.alarm_kind = ..type alarm = Framework.Core.Alarm.alarm = {alarm_kind : alarm_kind;alarm_check : check;alarm_range : Mopsa_utils.Core.Location.range;alarm_callstack : Mopsa_utils.Core.Callstack.callstack;
}val mk_alarm :
alarm_kind ->
Mopsa_utils.Core.Callstack.callstack ->
Mopsa_utils.Core.Location.range ->
alarmCreate an alarm
val range_of_alarm : alarm -> Mopsa_utils.Core.Location.rangeReturn the range of an alarm
val callstack_of_alarm : alarm -> Mopsa_utils.Core.Callstack.callstackReturn the callstack of an alarm
val pp_alarm : Format.formatter -> alarm -> unitPrint an alarm
val compare_alarm_kind : alarm_kind -> alarm_kind -> intCompare two kinds of alarms
val pp_alarm_kind : Format.formatter -> alarm_kind -> unitPrint an alarm kind
val join_alarm_kind : alarm_kind -> alarm_kind -> alarm_kind optionJoin two alarm kinds by merging the static information attached to them
val register_alarm_compare :
((alarm_kind -> alarm_kind -> int) -> alarm_kind -> alarm_kind -> int) ->
unitRegister a comparison function for alarms
val register_alarm_pp :
((Format.formatter -> alarm_kind -> unit) ->
Format.formatter ->
alarm_kind ->
unit) ->
unitRegister a print function for alarms
val register_alarm_check :
((alarm_kind -> check) -> alarm_kind -> check) ->
unitRegister a function giving the check of an alarm
val register_alarm_join :
((alarm_kind -> alarm_kind -> alarm_kind option) ->
alarm_kind ->
alarm_kind ->
alarm_kind option) ->
unitRegister a join function for alarms
type alarm_info = Framework.Core.Alarm.alarm_info = {check : (alarm_kind -> check) -> alarm_kind -> check;compare : (alarm_kind -> alarm_kind -> int) -> alarm_kind -> alarm_kind -> int;print : (Format.formatter -> alarm_kind -> unit) -> Format.formatter -> alarm_kind -> unit;join : (alarm_kind -> alarm_kind -> alarm_kind option) -> alarm_kind -> alarm_kind -> alarm_kind option;
}Registration record for a new kind of alarms
val register_alarm : alarm_info -> unitRegister a new kind of alarms
Diagnostic
**************
A diagnostic gives the status of all alarms raised at the program location for the same check
module AlarmSet = Mopsa_analyzer.Framework.Core.All.AlarmSetSet of alarms
type diagnostic_kind = Framework.Core.Alarm.diagnostic_kind = Kind of a diagnostic
type 'a diagnostic_ = 'a Framework.Core.Alarm.diagnostic_ = {diag_range : Mopsa_utils.Core.Location.range;diag_check : check;diag_kind : diagnostic_kind;diag_alarms : AlarmSet.t;diag_callstack : 'a;
}type diagnostic = Mopsa_utils.Core.Callstack.callstack diagnostic_type diagnosticWoCs = unit diagnostic_val mk_safe_diagnostic :
check ->
Mopsa_utils.Core.Callstack.callstack ->
Mopsa_utils.Core.Location.range ->
diagnosticCreate a diagnostic that says that a check is safe
val mk_error_diagnostic : alarm -> diagnosticCreate a diagnostic that says that a check is unsafe
val mk_warning_diagnostic :
check ->
Mopsa_utils.Core.Callstack.callstack ->
Mopsa_utils.Core.Location.range ->
diagnosticCreate a diagnostic that says that a check maybe unsafe
val mk_unreachable_diagnostic :
check ->
Mopsa_utils.Core.Callstack.callstack ->
Mopsa_utils.Core.Location.range ->
diagnosticCreate a diagnostic that says that a check is unreachable
val pp_diagnostic_kind : Format.formatter -> diagnostic_kind -> unitPrint a diagnostic kind
val pp_diagnostic : Format.formatter -> diagnostic -> unitPrint a diagnostic
val subset_diagnostic : diagnostic -> diagnostic -> boolCheck whether a diagnostic is covered by another
val join_diagnostic : diagnostic -> diagnostic -> diagnosticCompute the union of two diagnostics
val meet_diagnostic : diagnostic -> diagnostic -> diagnosticCompute the intersection of two diagnostics
val add_alarm_to_diagnostic : alarm -> diagnostic -> diagnosticAdd an alarm to a diagnostic
val compare_diagnostic : diagnostic -> diagnostic -> intCompare two diagnostics
Soundness assumption
************************
When a domain can't ensure total soundness when analyzing a piece of code, it can emit assumptions under which the result is still sound.
type assumption_scope = Framework.Core.Alarm.assumption_scope = | A_local of Mopsa_utils.Core.Location.range(*Local assumptions concern a specific location range in the program
*)| A_global(*Global assumptions can concern the entire program
*)
Scope of an assumption
type assumption_kind = Framework.Core.Alarm.assumption_kind = ..Domains can add new kinds of assumptions by extending the type assumption_kind
Generic assumptions for specifying potential unsoundness due to unsupported statements/expressions
type assumption = Framework.Core.Alarm.assumption = {assumption_scope : assumption_scope;assumption_kind : assumption_kind;
}val register_assumption : assumption_kind Mopsa_utils.Core.TypeExt.info -> unitRegister a new kind of assumptions
val pp_assumption_kind : Format.formatter -> assumption_kind -> unitPrint an assumption kind
val pp_assumption : Format.formatter -> assumption -> unitPrint an assumption
val compare_assumption_kind : assumption_kind -> assumption_kind -> intCompare two assumption kinds
val compare_assumption : assumption -> assumption -> intCompare two assumptions
val mk_global_assumption : assumption_kind -> assumptionCreate a global assumption
val mk_local_assumption :
assumption_kind ->
Mopsa_utils.Core.Location.range ->
assumptionCreate a local assumption
Analysis report
*******************
Alarms are organized in a report that maps each range and each check to a diagnostic. A report also contains the set of soundness assumptions made by the domains.
module RangeMap = Mopsa_analyzer.Framework.Core.All.RangeMapmodule RangeCallStackMap = Mopsa_analyzer.Framework.Core.All.RangeCallStackMapmodule CheckMap = Mopsa_analyzer.Framework.Core.All.CheckMapmodule AssumptionSet = Mopsa_analyzer.Framework.Core.All.AssumptionSettype report = Framework.Core.Alarm.report = {report_diagnostics : diagnostic CheckMap.t RangeCallStackMap.t;report_assumptions : AssumptionSet.t;
}val empty_report : reportReturn an empty report
val is_empty_report : report -> boolChecks whether a report is empty
val is_safe_report : report -> boolChecks whether a report is safe, i.e. it doesn't contain an error or a warning
val is_sound_report : report -> boolChecks whether a report is sound
val pp_report : Format.formatter -> report -> unitPrint a report
subset_report r1 r2 checks whether report r1 is included in r2
val filter_report : (diagnostic -> bool) -> report -> reportfilter_report p r keeps only diagnostics in report r that verify predicate p
add_alarm a r adds alarm a to a report r. If a diagnostic exists for the same range and the same check as a, join_diagnostic is used to join it with an error diagnostic containing a.
val set_diagnostic : diagnostic -> report -> reportset_diagnostic d r adds diagnostic d to r. Any existing diagnostic for the same range and the same check as d is removed.
val add_diagnostic : diagnostic -> report -> reportadd_diagnostic d r adds diagnostic d to r. If a diagnostic exists for the same range and the same check as d, join_diagnostic is used to join it with d.
val remove_diagnostic : diagnostic -> report -> reportRemove a diagnostic from a report
val find_diagnostic :
(Mopsa_utils.Core.Location.range * Mopsa_utils.Core.Callstack.callstack) ->
check ->
report ->
diagnosticfind_diagnostic range chk r finds the diagnostic of check chk at location range in report r
val exists_report : (diagnostic -> bool) -> report -> boolCheck whether any diagnostic verifies a predicate
val forall_report : (diagnostic -> bool) -> report -> boolCheck whether all diagnostics verify a predicate
val count_alarms : report -> int * intCount the number of alarms and warnings in a report
module RangeDiagnosticWoCsMap =
Mopsa_analyzer.Framework.Core.All.RangeDiagnosticWoCsMapmodule CallstackSet = Mopsa_analyzer.Framework.Core.All.CallstackSetSet of callstacks
val group_diagnostics :
diagnostic CheckMap.t RangeCallStackMap.t ->
CallstackSet.t RangeDiagnosticWoCsMap.tGroup diagnostics by their range and diagnostic kind
val add_assumption : assumption -> report -> reportAdd an assumption to a report
val add_global_assumption : assumption_kind -> report -> reportAdd a global assumption to a report
val add_local_assumption :
assumption_kind ->
Mopsa_utils.Core.Location.range ->
report ->
reportAdd a local assumption to a report
val map2zo_report :
(diagnostic -> diagnostic) ->
(diagnostic -> diagnostic) ->
(diagnostic -> diagnostic -> diagnostic) ->
report ->
report ->
reportval fold2zo_report :
(diagnostic -> 'b -> 'b) ->
(diagnostic -> 'b -> 'b) ->
(diagnostic -> diagnostic -> 'b -> 'b) ->
report ->
report ->
'b ->
'bval exists2zo_report :
(diagnostic -> bool) ->
(diagnostic -> bool) ->
(diagnostic -> diagnostic -> bool) ->
report ->
report ->
boolval fold_report : (diagnostic -> 'b -> 'b) -> report -> 'b -> 'bmodule Alarm = Mopsa_analyzer.Framework.Core.All.Alarminclude module type of struct include Framework.Core.Context end
type ('a, _) ctx_key = ('a, _) Framework.Core.Context.ctx_key = ..Key to access an element in the context
type 'a ctx = 'a Framework.Core.Context.ctxThe context
val empty_ctx : 'a ctxEmpty context
mem_ctx k ctx returns true when an element at key k is in the context ctx.
find_ctx k ctx returns the element at key k in the context ctx. Raises Not_found if no element is found.
find_ctx k ctx returns the element of the key k in the context ctx. Returns None if no element is found.
add_ctx k v ctx add element v at key k in the context ctx. The previous element is overwritten if present.
add_ctx k v ctx removes the element at key k in the context ctx. If key k was not in ctx, ctx is returned unchanged.
val pp_ctx :
(Framework.Core.Print.printer -> 'a -> unit) ->
Format.formatter ->
'a ctx ->
unitPrint a context
type ctx_pool = Framework.Core.Context.ctx_pool = {ctx_pool_equal : 'a 'v 'w. ('a, 'v) ctx_key -> ('a, 'w) ctx_key -> ('v, 'w) Mopsa_utils.Core.Eq.eq option;ctx_pool_print : 'a 'v. (Framework.Core.Print.printer -> 'a -> unit) -> Format.formatter -> ('a, 'v) ctx_key -> 'v -> unit;
}Pool registered keys
type ctx_info = Framework.Core.Context.ctx_info = {ctx_equal : 'a 'v 'w. ctx_pool -> ('a, 'v) ctx_key -> ('a, 'w) ctx_key -> ('v, 'w) Mopsa_utils.Core.Eq.eq option;ctx_print : 'a 'v. ctx_pool -> (Framework.Core.Print.printer -> 'a -> unit) -> Format.formatter -> ('a, 'v) ctx_key -> 'v -> unit;
}Registration information for a new key
val register_ctx : ctx_info -> unitRegister a new key
module GenContextKey = Mopsa_analyzer.Framework.Core.All.GenContextKeyGenerate a new key
val control_ctx_key : ('a, Mopsa_utils.Core.ControlCtx.control_ctx) ctx_keyKey for storing the control context
module Context = Mopsa_analyzer.Framework.Core.All.Contextmodule Cases = Mopsa_analyzer.Framework.Core.All.Casestype 'r case = 'r Cases.casetype ('a, 'r) cases = ('a, 'r) Cases.casesval bind :
('a Cases.case -> 'b Core.Flow.flow -> ('b, 'c) Cases.cases) ->
('b, 'a) Cases.cases ->
('b, 'c) Cases.casesval (>>=) :
('a, 'b) Cases.cases ->
('b Cases.case -> 'a Core.Flow.flow -> ('a, 'c) Cases.cases) ->
('a, 'c) Cases.casesval bind_opt :
('a Cases.case -> 'b Core.Flow.flow -> ('b, 'c) Cases.cases option) ->
('b, 'a) Cases.cases ->
('b, 'c) Cases.cases optionval (>>=?) :
('a, 'b) Cases.cases ->
('b Cases.case -> 'a Core.Flow.flow -> ('a, 'c) Cases.cases option) ->
('a, 'c) Cases.cases optionval bind_result :
('a -> 'b Core.Flow.flow -> ('b, 'c) Cases.cases) ->
('b, 'a) Cases.cases ->
('b, 'c) Cases.casesval (>>$) :
('a, 'b) Cases.cases ->
('b -> 'a Core.Flow.flow -> ('a, 'c) Cases.cases) ->
('a, 'c) Cases.casesval bind_result_opt :
('a -> 'b Core.Flow.flow -> ('b, 'c) Cases.cases option) ->
('b, 'a) Cases.cases ->
('b, 'c) Cases.cases optionval (>>$?) :
('a, 'b) Cases.cases ->
('b -> 'a Core.Flow.flow -> ('a, 'c) Cases.cases option) ->
('a, 'c) Cases.cases optionval bind_list :
'a list ->
('a -> 'b Core.Flow.flow -> ('b, 'c) Cases.cases) ->
'b Core.Flow.flow ->
('b, 'c list) Cases.casesval bind_list_opt :
'a list ->
('a -> 'b Core.Flow.flow -> ('b, 'c) Cases.cases option) ->
'b Core.Flow.flow ->
('b, 'c list) Cases.cases optionmodule Eval = Mopsa_analyzer.Framework.Core.All.Evaltype 'a eval = 'a Eval.evalmodule Flow = Mopsa_analyzer.Framework.Core.All.Flowtype 'a flow = 'a Flow.flowmodule Post = Mopsa_analyzer.Framework.Core.All.Posttype 'a post = 'a Post.postval (>>%) :
'a Post.post ->
('a Core.Flow.flow -> ('a, 'b) Core.Cases.cases) ->
('a, 'b) Core.Cases.casesval (>>%?) :
'a Post.post ->
('a Core.Flow.flow -> ('a, 'b) Core.Cases.cases option) ->
('a, 'b) Core.Cases.cases optionmodule Path = Mopsa_analyzer.Framework.Core.All.Pathinclude module type of struct include Path end
type accessor = Core.Path.accessor = ..type path = accessor listval accessor_compare_chain : accessor Mopsa_utils.Core.TypeExt.compare_chainval accessor_print_chain : accessor Mopsa_utils.Core.TypeExt.print_chainval pp_accessor : Format.formatter -> accessor -> unitval register_accessor : accessor Mopsa_utils.Core.TypeExt.info -> unitval pp_path : Format.formatter -> accessor list -> unitval empty_path : pathmodule PathMap = Mopsa_analyzer.Framework.Core.All.PathMapmodule PathSet = Mopsa_analyzer.Framework.Core.All.PathSetmodule Change = Mopsa_analyzer.Framework.Core.All.Changeinclude module type of struct include Change end
type change = Framework.Core.Change.change = val pp_change : Format.formatter -> change -> unitval empty_change : changeval is_empty_change : change -> boolval add_stmt_to_change : Framework.Core.Ast.Stmt.stmt -> change -> changeJoin two changes
type change_map = change Core.Path.PathMap.tval pp_change_map : Format.formatter -> change Core.Path.PathMap.t -> unitval compare_change_map :
change Core.Path.PathMap.t ->
change Core.Path.PathMap.t ->
intval empty_change_map : 'a Core.Path.PathMap.tval singleton_change_map :
Core.Path.PathMap.key ->
'a ->
'a Core.Path.PathMap.tval is_empty_change_map : change Core.Path.PathMap.t -> boolval concat_change_map :
change Core.Path.PathMap.t ->
change Core.Path.PathMap.t ->
change Core.Path.PathMap.tval join_change_map :
change Core.Path.PathMap.t ->
change Core.Path.PathMap.t ->
change Core.Path.PathMap.tval meet_change_map :
change Core.Path.PathMap.t ->
change Core.Path.PathMap.t ->
change Core.Path.PathMap.tval get_change : Core.Path.PathMap.key -> change Core.Path.PathMap.t -> changeval add_stmt_to_change_map :
Framework.Core.Ast.Stmt.stmt ->
Core.Path.PathMap.key ->
change Core.Path.PathMap.t ->
change Core.Path.PathMap.tGeneric merge
*****************
type change_vars = Framework.Core.Change.change_vars = {modified : Framework.Core.Ast.Var.VarSet.t;removed : Framework.Core.Ast.Var.VarSet.t;
}Change of a statement in terms of modified and removed variables
val compare_change_vars : change_vars -> change_vars -> intval is_empty_change_vars : change_vars -> boolval get_stmt_change_vars :
custom:(Framework.Core.Ast.Stmt.stmt -> change_vars option) ->
Framework.Core.Ast.Stmt.stmt ->
change_varsGet the changes of a statement
val get_change_vars :
custom:(Framework.Core.Ast.Stmt.stmt -> change_vars option) ->
change ->
change_varsval apply_change_vars :
change_vars ->
add:(Framework.Core.Ast.Var.VarSet.elt -> 'b -> 'a -> 'a) ->
remove:(Framework.Core.Ast.Var.VarSet.elt -> 'a -> 'a) ->
find:(Framework.Core.Ast.Var.VarSet.elt -> 'a -> 'b) ->
'a ->
'a ->
'aApply changes on an abstract element
val generic_merge :
add:(Framework.Core.Ast.Var.VarSet.elt -> 'a -> 'b -> 'b) ->
find:(Framework.Core.Ast.Var.VarSet.elt -> 'b -> 'a) ->
remove:(Framework.Core.Ast.Var.VarSet.elt -> 'b -> 'b) ->
?custom:(Framework.Core.Ast.Stmt.stmt -> change_vars option) ->
('b * change) ->
('b * change) ->
'b * 'bGeneric merge operator for non-relational domains
val opt_change_tracker_enabled : bool refinclude module type of struct include Framework.Core.Query end
type ('a, _) query = ('a, _) Framework.Core.Query.query = ..Extensible type of queries
val join_query :
?ctx:'a Framework.Core.Context.ctx option ->
?lattice:'a Framework.Core.Lattice.lattice option ->
('a, 'r) query ->
'r ->
'r ->
'rJoin two queries
val meet_query :
?ctx:'a Framework.Core.Context.ctx option ->
?lattice:'a Framework.Core.Lattice.lattice option ->
('a, 'r) query ->
'r ->
'r ->
'rMeet two queries
Registration
****************
type query_pool = Framework.Core.Query.query_pool = {pool_join : 'a 'r. ('a, 'r) query -> 'r -> 'r -> 'r;pool_meet : 'a 'r. ('a, 'r) query -> 'r -> 'r -> 'r;
}Pool of registered queries
type query_info = Framework.Core.Query.query_info = {join : 'a 'r. query_pool -> ('a, 'r) query -> 'r -> 'r -> 'r;meet : 'a 'r. query_pool -> ('a, 'r) query -> 'r -> 'r -> 'r;
}Registraction info for new queries
val register_query : query_info -> unitRegister a new query
type lattice_query_pool = Framework.Core.Query.lattice_query_pool = {pool_join : 'a 'r. 'a Framework.Core.Context.ctx -> 'a Framework.Core.Lattice.lattice -> ('a, 'r) query -> 'r -> 'r -> 'r;pool_meet : 'a 'r. 'a Framework.Core.Context.ctx -> 'a Framework.Core.Lattice.lattice -> ('a, 'r) query -> 'r -> 'r -> 'r;
}Pool of registered lattice queries. Lattice queries are queries that return elements of the global abstract state lattice. Join/meet operators are enriched with the lattice and the context so that we can compute join/meet over the abstract elements.
type lattice_query_info = Framework.Core.Query.lattice_query_info = {join : 'a 'r. lattice_query_pool -> 'a Framework.Core.Context.ctx -> 'a Framework.Core.Lattice.lattice -> ('a, 'r) query -> 'r -> 'r -> 'r;meet : 'a 'r. lattice_query_pool -> 'a Framework.Core.Context.ctx -> 'a Framework.Core.Lattice.lattice -> ('a, 'r) query -> 'r -> 'r -> 'r;
}Registration info for new lattice queries
val register_lattice_query : lattice_query_info -> unitRegister a new lattice query
Common queries
******************
type query += | Q_defined_variables : string option -> ('a, Framework.Core.Ast.Var.var list) query(*Extract the list of defined variables, in a given function call site, or in all scopes
*)| Q_allocated_addresses : ('a, Framework.Core.Ast.Addr.addr list) query(*Query to extract the list of addresses allocated in the heap
*)| Q_variables_linked_to : Framework.Core.Ast.Expr.expr -> ('a, Framework.Core.Ast.Var.VarSet.t) query(*Query to extract the auxiliary variables related to an expression
*)
include module type of struct include Core.Token end
type token = Core.Token.token = ..Flow tokens are used to distinguish between different control flows
val register_token : token Mopsa_utils.Core.TypeExt.info -> unitRegister a new token with its compare and print functions
val pp_token : Format.formatter -> token -> unitPretty printer of tokens
module TokenMap = Mopsa_analyzer.Framework.Core.All.TokenMapinclude module type of struct include Core.Ast.Semantic end
val pp_semantic : Format.formatter -> semantic -> unitval any_semantic : semanticval is_any_semantic : semantic -> boolmodule SemanticSet = Mopsa_analyzer.Framework.Core.All.SemanticSetmodule SemanticMap = Mopsa_analyzer.Framework.Core.All.SemanticMapinclude module type of struct include Core.Route end
type route = Core.Route.route = | Below of domain(*Sub-tree below a domain
*)| Semantic of Core.Ast.Semantic.semantic(*Sub-tree identified by a semantic
*)
Routes
module DomainSet = Mopsa_analyzer.Framework.Core.All.DomainSetval pp_route : Format.formatter -> route -> unitPrint a route
val toplevel : routeToplevel tree
type routing_table = Core.Route.routing_tableRouting table providing the domains that are part of a route
val empty_routing_table : routing_tableEmpty routing table
val resolve_route : route -> routing_table -> DomainSet.tResolve a route into domains
val add_route : route -> domain -> routing_table -> routing_tableAdd a route between a route and a domain
val add_routes : route -> DomainSet.t -> routing_table -> routing_tableAdd a set of routing_table linking a route and a set of domains
val get_routes : routing_table -> route listGet all routing_table in a routing table
val join_routing_table : routing_table -> routing_table -> routing_tableJoin two routing_table table
val pp_routing_table : Format.formatter -> routing_table -> unitPrint a routing table
include module type of struct include Framework.Core.Lattice end
module type LATTICE = Framework.Core.All.LATTICESignature of a lattice module.
type 'a lattice = 'a Framework.Core.Lattice.lattice = {bottom : 'a;top : 'a;is_bottom : 'a -> bool;subset : 'a Framework.Core.Context.ctx -> 'a -> 'a -> bool;join : 'a Framework.Core.Context.ctx -> 'a -> 'a -> 'a;meet : 'a Framework.Core.Context.ctx -> 'a -> 'a -> 'a;widen : 'a Framework.Core.Context.ctx -> 'a -> 'a -> 'a;merge : 'a -> ('a * Framework.Core.Change.change_map) -> ('a * Framework.Core.Change.change_map) -> 'a;print : Framework.Core.Print.printer -> 'a -> unit;
}Lattice operators
include module type of struct include Core.Id end
type _ id = _ Core.Id.id = ..Identifiers
type witness = Core.Id.witness = {eq : 'a 'b. 'a id -> 'b id -> ('a, 'b) Mopsa_utils.Core.Eq.eq option;
}type witness_chain = Core.Id.witness_chain = {eq : 'a 'b. witness -> 'a id -> 'b id -> ('a, 'b) Mopsa_utils.Core.Eq.eq option;
}Equality witness of an identifier
val register_id : witness_chain -> unitRegister a new descriptor
val equal_id : 'a id -> 'b id -> ('a, 'b) Mopsa_utils.Core.Eq.eq optionEquality witness of identifiers
module GenDomainId = Mopsa_analyzer.Framework.Core.All.GenDomainIdGenerator of a new domain identifier
module GenStatelessDomainId =
Mopsa_analyzer.Framework.Core.All.GenStatelessDomainIdGenerator of a new identifier for stateless domains
module GenValueId = Mopsa_analyzer.Framework.Core.All.GenValueIdGenerator of a new value identifier
include module type of struct include Framework.Core.Manager end
Managers
type ('a, 't) man = ('a, 't) Framework.Core.Manager.man = {lattice : 'a Framework.Core.Lattice.lattice;(*Access to lattice operators on the toplevel abstract element
*)'a.get : Core.Token.token -> 'a Core.Flow.flow -> ('a, 't) Core.Cases.cases;(*Returns the domain's abstract element
*)'t. A disjunction of cases is returned when partitioning is used.set : Core.Token.token -> 't -> 'a Core.Flow.flow -> 'a Core.Post.post;(*Sets the domain's abstract element
*)'t.exec : ?route:Core.Route.route -> Framework.Core.Ast.Stmt.stmt -> 'a Core.Flow.flow -> 'a Core.Post.post;(*
*)man.exec stmt flowexecutesstmtinflowand returns the post state.eval : ?route:Core.Route.route -> ?translate:Core.Ast.Semantic.semantic -> ?translate_when: (Core.Ast.Semantic.semantic * (Framework.Core.Ast.Expr.expr -> bool)) list -> Framework.Core.Ast.Expr.expr -> 'a Core.Flow.flow -> 'a Framework.Core.Eval.eval;(*man.eval expr flowevaluatesexprinflowand returns the result expression.There are two kinds of evaluations: within the same semantic (simplifications), or to another semantic (translations). Calling
*)man.eval expr flowperforms both kinds of evaluations. The resulte'ofman.eval expr flowis a simplification ofewithin the same semantic. To retrieve a translation to another semantic, one can use the?translateparameter:man.eval expr flow ~translate:semanticis a translation of the simplification ofeinsemantic. A common use case is to translate expressions to Universal withman.eval expr flow ~translate:"Universal". It is possible to control when the translation is applied with?translate_when.ask : 'r. ?route:Core.Route.route -> ('a, 'r) Framework.Core.Query.query -> 'a Core.Flow.flow -> ('a, 'r) Core.Cases.cases;(*
*)man.ask query flowperforms a query to other domains. If no domain can answer the query,man.ask query flowresults in a runtime error.print_expr : ?route:Core.Route.route -> 'a Core.Flow.flow -> Framework.Core.Print.printer -> Framework.Core.Ast.Expr.expr -> unit;(*
*)man.print_expr flowis the expression printer for the type'a.add_change : Framework.Core.Ast.Stmt.stmt -> Core.Path.path -> 'a Core.Flow.flow -> Framework.Core.Change.change_map -> Framework.Core.Change.change_map;(*Add a statement to the changes map.
*)
}Managers provide access to full analyzer.
'a is the type of the toplevel abstract element, and 't is the type of local abstract element (that is, the type of the domain that calls the manager).
module Hook = Mopsa_analyzer.Framework.Core.All.Hookinclude module type of struct include Framework.Core.Print end
Print objects
Symbols for printing maps, lists and sets
type ('k, 'v) map = ('k, 'v) Mopsa_utils.Containers.MapExtPoly.tStructured print objects
type 'v set = 'v Mopsa_utils.Containers.SetExtPoly.ttype print_object = Framework.Core.Print.print_object = | Empty| Bool of bool| Int of Z.t| Float of float| String of string| Var of Framework.Core.Ast.Var.var| Map of (print_object, print_object) map * symbols| List of print_object list * symbols| Set of print_object set * symbols
Printers
type printer = Framework.Core.Print.printerPrinters encapsulate the structured objects to print along the history of printed expression
val empty_printer : unit -> printerCreate an empty printer
val get_printed_object : printer -> print_objectGet the structured print object of a printer
val get_printed_exprs : printer -> Framework.Core.Ast.Expr.expr listGet the expressions that were already printed
val add_printed_expr : printer -> Framework.Core.Ast.Expr.expr -> unitMark an expression as printed
val mem_printed_expr : printer -> Framework.Core.Ast.Expr.expr -> boolCheck whether an expression was already printed
Print paths
type print_selector = Framework.Core.Print.print_selector = | Key of string| Index of int| Obj of print_object
Selectors of print objects
type print_path = print_selector listPath of a print object
val find_print_object : print_path -> print_object -> print_objectfind_print_object path obj returns the object placed at path in obj
val match_print_object_keys : Str.regexp -> print_object -> print_objectmatch_print_object_keys re obj slices obj to paths containing keys that match re
Generic print functions
val pprint : ?path:print_path -> printer -> print_object -> unitpprint ~path:p printer o prints object o at path p in printer.
val pbox : (printer -> 'a -> unit) -> 'a -> print_objectpbox f x returns a boxed object created by f when applied to x. It is equivalent to
let printer = empty_printer () in
f printer x;
get_printed_object printerval fbox : ('a, Format.formatter, unit, print_object) format4 -> 'afbox fmt returns a string object of a formatted value
val sprint : (printer -> 'a -> unit) -> 'a -> stringsprint f x returns the string representing the boxed object pbox f x
val fkey : ('a, Format.formatter, unit, print_selector) format4 -> 'afkey fmt returns a key selector with a formatted string
val pkey : (printer -> 'a -> unit) -> 'a -> print_selectorpkey f x returns a key selector with a printed string
Typed print functions
val pp_string : ?path:print_path -> printer -> string -> unitPrint a string object
val pp_bool : ?path:print_path -> printer -> bool -> unitPrint a boolean object
val pp_int : ?path:print_path -> printer -> int -> unitPrint an integer object
val pp_z : ?path:print_path -> printer -> Z.t -> unitPrint an integer object
val pp_float : ?path:print_path -> printer -> float -> unitPrint a float object
val pp_variable :
?path:print_path ->
printer ->
Framework.Core.Ast.Var.var ->
unitPrint a variable
val pp_list :
?path:print_path ->
?lopen:string ->
?lsep:string ->
?lclose:string ->
(printer -> 'a -> unit) ->
printer ->
'a list ->
unitpp_list ~path:p f printer l prints a list l at path p by boxing f on every element of l
val pp_obj_list :
?path:print_path ->
?lopen:string ->
?lsep:string ->
?lclose:string ->
printer ->
print_object list ->
unitpp_obj_list ~path:p printer l prints a list of objects at path p. Useful for printing heterogenous lists.
val pp_map :
?path:print_path ->
?mopen:string ->
?msep:string ->
?mclose:string ->
?mbind:string ->
(printer -> 'k -> unit) ->
(printer -> 'v -> unit) ->
printer ->
('k * 'v) list ->
unitpp_smap ~path:p fk fv printer l prints a map from a list l of pairs of keys and values. Keys are boxed with function fk and values with function fv.
val pp_mapi :
?path:print_path ->
?mopen:string ->
?msep:string ->
?mclose:string ->
?mbind:string ->
(printer -> 'k -> unit) ->
(printer -> ('k * 'v) -> unit) ->
printer ->
('k * 'v) list ->
unitval pp_obj_map :
?path:print_path ->
?mopen:string ->
?msep:string ->
?mclose:string ->
?mbind:string ->
printer ->
(print_object * print_object) list ->
unitpp_obj_smap ~path:p printer l prints a map from a list of pairs of print objects
val pp_obj_set :
?path:print_path ->
?sopen:string ->
?ssep:string ->
?sclose:string ->
printer ->
print_object set ->
unitpp_obj_set ~path:p printer l prints a set of objects at path p. Useful for printing heterogenous sets.
val pp_set :
?path:print_path ->
?sopen:string ->
?ssep:string ->
?sclose:string ->
(printer -> 'a -> unit) ->
printer ->
'a set ->
unitpp_set ~path:p f printer l prints a set from a list l at path p by boxing f on every element of l
Format
val pp_print_object : Format.formatter -> print_object -> unitPretty-print a printer objct
val pflush : Format.formatter -> printer -> unitPretty-print the printer output in a format string
val format : (printer -> 'a -> unit) -> Format.formatter -> 'a -> unitConvert a printer function into a format function
val unformat :
?path:print_path ->
(Format.formatter -> 'a -> unit) ->
printer ->
'a ->
unitConvert a format function into a printer
JSON
val print_object_to_json : print_object -> Yojson.Basic.tConvert a printer object to JSON
val json_to_print_object : Yojson.Basic.t -> print_objectConvert JSON to a printer object
module Print = Mopsa_analyzer.Framework.Core.All.Printinclude module type of struct include Core.Avalue end
type _ avalue_kind = _ Core.Avalue.avalue_kind = ..type avalue_pool = Core.Avalue.avalue_pool = {pool_typ : 'v. 'v avalue_kind -> Framework.Core.Ast.Typ.typ;pool_bottom : 'v. 'v avalue_kind -> 'v;pool_top : 'v. 'v avalue_kind -> 'v;pool_join : 'v. 'v avalue_kind -> 'v -> 'v -> 'v;pool_meet : 'v. 'v avalue_kind -> 'v -> 'v -> 'v;pool_compare : 'v 'w. 'v avalue_kind -> 'v -> 'w avalue_kind -> 'w -> int;pool_print : 'v. 'v avalue_kind -> Format.formatter -> 'v -> unit;
}type avalue_info = Core.Avalue.avalue_info = {typ : 'v. avalue_pool -> 'v avalue_kind -> Framework.Core.Ast.Typ.typ;bottom : 'v. avalue_pool -> 'v avalue_kind -> 'v;top : 'v. avalue_pool -> 'v avalue_kind -> 'v;join : 'v. avalue_pool -> 'v avalue_kind -> 'v -> 'v -> 'v;meet : 'v. avalue_pool -> 'v avalue_kind -> 'v -> 'v -> 'v;compare : 'v 'w. avalue_pool -> 'v avalue_kind -> 'v -> 'w avalue_kind -> 'w -> int;print : 'v. avalue_pool -> 'v avalue_kind -> Format.formatter -> 'v -> unit;
}val register_avalue : avalue_info -> unitval type_of_avalue : 'v avalue_kind -> Framework.Core.Ast.Typ.typval bottom_avalue : 'v avalue_kind -> 'vval top_avalue : 'v avalue_kind -> 'vval join_avalue : 'v avalue_kind -> 'v -> 'v -> 'vval meet_avalue : 'v avalue_kind -> 'v -> 'v -> 'vval compare_avalue : 'v avalue_kind -> 'v -> 'w avalue_kind -> 'w -> intval pp_avalue : 'v avalue_kind -> Format.formatter -> 'v -> unitval mk_avalue_expr :
'v avalue_kind ->
'v ->
Mopsa_utils.Core.Location.range ->
Framework.Core.Ast.Expr.exprval mk_avalue_constant : 'v avalue_kind -> 'v -> Core.Ast.Constant.constanttype Framework.Core.Query.query += | Q_avalue : Framework.Core.Ast.Expr.expr * 'v avalue_kind -> ('a, 'v) Framework.Core.Query.query
val mk_avalue_query :
Framework.Core.Ast.Expr.expr ->
'v avalue_kind ->
('a, 'v) Framework.Core.Query.queryinclude module type of struct include Core.Utils end
val exec_cleaner :
Framework.Core.Ast.Stmt.stmt ->
('a, 'b) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
('a, unit) Core.Cases.casesval exec_cleaners :
('a, 'b) Framework.Core.Manager.man ->
('a, unit) Core.Cases.cases ->
('a, unit) Core.Cases.casesval post_to_flow :
('a, 'b) Framework.Core.Manager.man ->
'a Core.Post.post ->
'a Core.Flow.flowval assume :
Framework.Core.Ast.Expr.expr ->
?route:Core.Route.route ->
?translate:Core.Ast.Semantic.semantic ->
fthen:('a Core.Flow.flow -> ('a, 'b) Core.Cases.cases) ->
felse:('a Core.Flow.flow -> ('a, 'b) Core.Cases.cases) ->
?fboth:('a Core.Flow.flow -> 'a Core.Flow.flow -> ('a, 'b) Core.Cases.cases) ->
?fnone:('a Core.Flow.flow -> 'a Core.Flow.flow -> ('a, 'b) Core.Cases.cases) ->
?eval:bool ->
('a, 'c) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
('a, 'b) Core.Cases.casesval switch :
(Framework.Core.Ast.Expr.expr list
* ('a Core.Flow.flow ->
('a, 'r) Core.Cases.cases))
list ->
?route:Core.Route.route ->
('a, 'b) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
('a, 'r) Core.Cases.casesval set_env :
Core.Token.token ->
't ->
('a, 't) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
'a Core.Post.postval set_singleton_env :
'a ->
'b Framework.Core.Context.ctx ->
('b, 'a) Framework.Core.Manager.man ->
'b ->
'bval set_env_flow :
Core.Token.token ->
'b ->
('a, 'b) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
'a Core.Flow.flowval get_env :
Core.Token.token ->
('a, 't) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
('a, 't) Core.Cases.casesval get_singleton_env :
'a Framework.Core.Context.ctx ->
('a, 'b) Framework.Core.Manager.man ->
'a ->
'bval get_singleton_env_from_flow :
Core.Token.token ->
('a, 't) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
'tval map_env :
Core.Token.token ->
('t -> 't) ->
('a, 't) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
'a Core.Post.postval get_pair_fst :
('a, 'b * 'c) Framework.Core.Manager.man ->
Core.Token.token ->
'a Core.Flow.flow ->
('a, 'b) Core.Cases.casesval set_pair_fst :
('a, 'b * 'c) Framework.Core.Manager.man ->
Core.Token.token ->
'b ->
'a Core.Flow.flow ->
('a, unit) Core.Cases.casesval get_pair_snd :
('a, 'b * 'c) Framework.Core.Manager.man ->
Core.Token.token ->
'a Core.Flow.flow ->
('a, 'c) Core.Cases.casesval set_pair_snd :
('a, 'b * 'c) Framework.Core.Manager.man ->
Core.Token.token ->
'c ->
'a Core.Flow.flow ->
('a, unit) Core.Cases.casesval env_exec :
('a Core.Flow.flow -> 'a Core.Post.post) ->
'a Framework.Core.Context.ctx ->
('a, 't) Framework.Core.Manager.man ->
'a ->
'aval ask_and_reduce_cases :
(('a, 'b) Framework.Core.Query.query -> 'c -> ('d, 'b) Core.Cases.cases) ->
('a, 'b) Framework.Core.Query.query ->
?bottom:(unit -> 'b) ->
'c ->
'bval ask_and_reduce_list :
(('a, 'b) Framework.Core.Query.query -> 'c -> ('d * 'b) list) ->
('a, 'b) Framework.Core.Query.query ->
?bottom:(unit -> 'b) ->
'c ->
'bval ask_and_reduce :
(('a, 'b) Framework.Core.Query.query -> 'c -> ('d, 'b) Core.Cases.cases) ->
('a, 'b) Framework.Core.Query.query ->
?bottom:(unit -> 'b) ->
'c ->
'bval find_var_by_name :
?function_scope:string option ->
string ->
('a, 'b) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
Framework.Core.Ast.Var.varval dummy_range : Mopsa_utils.Core.Location.rangeval pp_vars_info :
('a, 'b) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
Format.formatter ->
Framework.Core.Ast.Var.var list ->
unitval pp_vars_info_by_name :
('a, 'b) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
Format.formatter ->
string list ->
unitval pp_expr_vars_info :
('a, 'b) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
Format.formatter ->
Framework.Core.Ast.Expr.expr ->
unitval pp_stmt_vars_info :
('a, 'b) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
Format.formatter ->
Framework.Core.Ast.Stmt.stmt ->
unitval breakpoint :
string ->
('a, 'b) Framework.Core.Manager.man ->
'a Core.Flow.flow ->
unitval warn_prototype_domain : string -> 'a Core.Flow.flow -> 'a Core.Flow.flowval warn_no_guaranteed_termination_domain :
string ->
'a Core.Flow.flow ->
'a Core.Flow.flowval warn_assumptions :
Framework.Core.Alarm.assumption_kind list ->
'a Core.Flow.flow ->
'a Core.Flow.flowinclude module type of struct include Core.Marker end
type marker = Core.Marker.marker = ..type marker_info = Core.Marker.marker_info = {marker_name : string;marker_print_name : (marker -> string) -> marker -> string;marker_print : (Format.formatter -> marker -> unit) -> Format.formatter -> marker -> unit;marker_compare : (marker -> marker -> int) -> marker -> marker -> int;
}val pp_marker : Format.formatter -> marker -> unitval get_marker_name : marker -> stringval register_marker : marker_info -> unitval mk_add_marker :
marker ->
Mopsa_utils.Core.Location.range ->
Framework.Core.Ast.Stmt.stmtval is_marker_enabled : marker -> boolmodule Var = Framework.Core.All.Varmodule Core = Framework.Coremodule Sig = Framework.Sigmodule Params = Framework.Paramsmodule Paths = Params.Pathsmodule Visitor = Core.Ast.Visitorinclude module type of struct include Mopsa_utils.Core.Location end
Positions
=============
Position in a file.
val get_pos_file : pos -> stringval get_pos_line : pos -> intval get_pos_column : pos -> intval mk_pos : string -> int -> int -> posReturn the relative path of `file` w.r.t. the current working directory
Extended source locations, decorated with a stack of positions. It can be used to distinguish between different use of the same lexical token. E.g., in C, it tracks macro argument expansion.
Ranges
==========
type range = Mopsa_utils.Core.Location.range = Location range of AST nodes.
Range tags can be used to annotate AST nodes added by the abstract domains that are not textually present in the source files.
val mk_string_tag : ('a, Format.formatter, unit, range_tag) format4 -> 'aval tag_range : range -> ('a, Format.formatter, unit, range) format4 -> 'aTag a range with a (formatted) annotation.
val fresh_range_counter : int refval mk_fresh_range : unit -> rangeval mk_program_range : string list -> rangeval get_range_file : range -> stringval get_range_relative_file : range -> stringval get_range_line : range -> intval get_range_column : range -> intval is_orig_range : range -> boolval is_program_range : range -> boolval match_range_file : string -> range -> boolval match_range_line : int -> range -> boolval from_lexing_pos : Lexing.position -> posval from_lexing_range : Lexing.position -> Lexing.position -> rangeRange annotations
=====================
val with_range : 'a -> range -> 'a with_rangeval get_content : 'a with_range -> 'aval get_range : 'a with_range -> rangeval bind_range : 'a with_range -> ?range:range -> ('a -> 'b) -> 'b with_rangeval bind_pair_range : 'a with_range -> ('a -> 'b * 'c) -> 'b with_range * 'cval compare_with_range :
('a -> 'b -> int) ->
'a with_range ->
'b with_range ->
intPretty printers
===================
val pp_position : Format.formatter -> pos -> unitval pp_relative_position : Format.formatter -> pos -> unitval pp_position_stack :
(Format.formatter -> 'a -> unit) ->
Format.formatter ->
'a list ->
unitval pp_eposition : Format.formatter -> epos -> unitval pp_relative_eposition : Format.formatter -> epos -> unitval pp_range : Format.formatter -> range -> unitval pp_relative_range : Format.formatter -> range -> unitinclude module type of struct include Mopsa_utils.Core.Callstack end
Call sites
**************
type callsite = Mopsa_utils.Core.Callstack.callsite = {call_fun_orig_name : string;(*Original name of the called function
*)call_fun_uniq_name : string;(*Unique name of the called function
*)call_range : Mopsa_utils.Core.Location.range;(*Call location
*)
}Call site is the location of a call in the program
val pp_callsite : Format.formatter -> callsite -> unitPrint a call site
type callstack = callsite listval pp_callstack : Format.formatter -> callstack -> unitPrint a call stack
val pp_callstack_short : Format.formatter -> callstack -> unitPrint a call stack in a short style
val empty_callstack : callstackEmpty call stack
val is_empty_callstack : callstack -> boolCheck that a call stack is empty
val callstack_length : callstack -> intReturn the length of a call stack
val push_callstack :
string ->
?uniq:string ->
Mopsa_utils.Core.Location.range ->
callstack ->
callstackpush_callstack orig ~uniq range cs adds the call to function orig at location range at the top of the call stack cs. The default unique function name of the function is its original name.
pop_callstack cc returns the last call site in cc and the remaining callstack Raises Empty_callstack if the call stack is empty.
callstack_top cs returns the last call site in cs. Raises Empty_callstack if the call stack is empty.
include module type of struct include Params.Options end
Registration
****************
val register_builtin_option : Mopsa_utils.Core.ArgExt.arg -> unitRegister a built-in option
val register_language_option : string -> Mopsa_utils.Core.ArgExt.arg -> unitRegister a language option.
val register_domain_option : string -> Mopsa_utils.Core.ArgExt.arg -> unitRegister a domain option.
Register a shared option
Import a shared option into a domain
Filters
***********
val get_options : unit -> Mopsa_utils.Core.ArgExt.arg listReturn the list of options
val get_builtin_options : unit -> Mopsa_utils.Core.ArgExt.arg listReturn the list of built-in options
val get_language_options : string -> Mopsa_utils.Core.ArgExt.arg listReturn the list of options of a language
val get_domain_options : string -> Mopsa_utils.Core.ArgExt.arg listReturn the list of options of a domain
include module type of struct include Mopsa_utils.Core.Exceptions end
Warnings
=-=-=-=-=-=-
val warn : ('a, Format.formatter, unit, unit) format4 -> 'aval warn_at :
Mopsa_utils.Core.Location.range ->
('a, Format.formatter, unit, unit) format4 ->
'aPanic exceptions
=-=-=-=-=-=-=-=-=-=-
val pp : ('a, Format.formatter, unit, unit) format4 -> 'aval pp_at :
Mopsa_utils.Core.Location.range ->
('a, Format.formatter, unit, unit) format4 ->
'aexception PanicAtLocation of Mopsa_utils.Core.Location.range * string * stringOCaml line of code
OCaml line of code
exception PanicAtFrame of Mopsa_utils.Core.Location.range
* Mopsa_utils.Core.ControlCtx.control_ctx
* string
* stringOCaml line of code
OCaml line of code
val panic : ?loc:string -> ('a, Format.formatter, unit, 'b) format4 -> 'aRaise a panic exception using a formatted string
val panic_at :
?loc:string ->
Mopsa_utils.Core.Location.range ->
('a, Format.formatter, unit, 'b) format4 ->
'aval panic_at_frame :
?loc:string ->
Mopsa_utils.Core.Location.range ->
Mopsa_utils.Core.ControlCtx.control_ctx ->
('a, Format.formatter, unit, 'b) format4 ->
'aSyntax-related exceptions
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
exception SyntaxError of Mopsa_utils.Core.Location.range * stringexception SyntaxErrorList of (Mopsa_utils.Core.Location.range * string) listexception UnnamedSyntaxError of Mopsa_utils.Core.Location.rangeexception UnnamedSyntaxErrorList of Mopsa_utils.Core.Location.range listval syntax_error :
Mopsa_utils.Core.Location.range ->
('a, Format.formatter, unit, 'b) format4 ->
'aval syntax_errors : (Mopsa_utils.Core.Location.range * string) list -> 'aval unnamed_syntax_error : Mopsa_utils.Core.Location.range -> 'aval unnamed_syntax_errors : Mopsa_utils.Core.Location.range list -> 'ainclude module type of struct include Framework.Toplevel end
module type TOPLEVEL = Framework.Toplevel.TOPLEVELSignature of the toplevel abstraction
Domain encapsulation into an abstraction
val debug : ('a, Format.formatter, unit, unit) format4 -> 'amodule Make = Framework.Toplevel.MakeEncapsulate a domain into a top-level abstraction