Module GenericAbstract

module GenericAbstract: sig .. end
Static interpretation methods which are not dependant to the abstraction domain chosen.


Static interpretation methods which are not dependant to the abstraction domain chosen.
val var_id : int Pervasives.ref
The last id used in an environment
val areEnvironmentEqual : Types.abstrEnvironment Pervasives.ref ->
Types.abstrEnvironment Pervasives.ref -> bool
Test equality of two environments
Returns Are e1 and e2 equal
val wideningOnEnvironments : Types.abstrEnvironment Pervasives.ref ->
Types.abstrEnvironment Pervasives.ref ->
Types.abstrEnvironment Pervasives.ref
Apply widening on two environments by applying the widening to all the abstract domains of their ids. Delete the variables which exist only in one environment.
Returns The environment made of the application of the widening on e1 and e2
val environmentJoin : Types.abstrEnvironment Pervasives.ref ->
Types.abstrEnvironment Pervasives.ref ->
Types.abstrEnvironment Pervasives.ref
Joins two environment by joining all the ids. Delete the variables which exist only in one environment.
Returns The environment made of the join of e1 and e2
val contextMerge : Types.abstrContext -> Types.abstrContext -> Types.abstrContext
Merge two contexts by returning the variables which are both represented by the same ids.
Returns The resulting context
val forgetNewVariables : lastContext:Types.abstrContext ->
newContext:Types.abstrContext ->
env:Types.abstrEnvironment Pervasives.ref -> unit
Remove from the environment the variables which have been added in the newContext.
Returns unit
val environmentMeet : Types.abstrEnvironment Pervasives.ref ->
Types.abstrEnvironment Pervasives.ref ->
Types.abstrEnvironment Pervasives.ref
Meet two environment by meeting all the ids. Delete the variables which exist only in one environment.
Returns The environment made of the meet of e1 and e2
val getVar : context:Types.abstrContext ->
vn:Types.name_var ->
env:Types.abstrEnvironment Pervasives.ref -> Types.abstrD
Return a variable at a location in an environment
Raises UNDEFINEDVAR if the variable is not declared at the location specified
Returns The abstract domain of the variable at the location specified
val lfp : env:Types.abstrEnvironment Pervasives.ref ->
e1:(Types.abstrContext * Types.memoryStack ->
Types.abstrContext * Types.memoryStack) ->
Types.abstrContext * Types.memoryStack -> Types.memoryStack
Calculates the least fixpoint of env by the function e1
Returns The memory stack when the least fixpoint (or the over-approximation of it) has been found
val addVarToContext : vn:Types.name_var ->
value:Types.abstrD ->
env:Types.abstrEnvironment Pervasives.ref ->
Types.abstrContext -> Types.abstrContext
Adds an undefined variable to a context and returns the new context
Raises ALREADYDEFINED if the variable already exists in context
Returns The new context in which the value of the variable has been added
val updateVarInContext : vn:Types.name_var ->
value:Types.abstrD ->
context:Types.abstrContext ->
env:Types.abstrEnvironment Pervasives.ref -> unit
Update an existing variable in a context and returns the new context
Raises UNDEFINEDVAR if the variable doesn't exist in context
Returns unit
val getAsmValue : ae:Types.asm_expr ->
context:Types.abstrContext ->
env:Types.abstrEnvironment Pervasives.ref -> Types.abstrD
Get the abstract interpretation of an ASM expression
Returns The abstract interpretation of the ae in the provided context and env
val getLastFunction : l:Types.loc ->
f:Types.functionContext Pervasives.ref ->
Types.global_statement * Types.abstrContext
Get the C function in which a location is
Returns The function as a global statement and the context associated to it
val joinMemoryStack : s1:Types.memoryStack -> s2:Types.memoryStack -> Types.memoryStack
Join the abstract values of two memory stacks
Raises WRONGSTACKOFFSET If the stacks don't have the same length
Returns The memory stack in which each element is the join of the initials memory stacks
val initFunction : cCall:bool -> callStack:Types.callStack Pervasives.ref -> unit
Initialize the call stack in order to prepare it before the call of a function
Returns unit
val postlude_asm : context:Types.abstrContext ->
env:Types.abstrEnvironment Pervasives.ref -> Types.abstrContext
Remove the registers from a context and in the associated environment after an ASM block
Returns The new context without the registers' values
val raiseReturn : cCall:bool ->
addReturnPossibility:bool ->
returnCode:Types.abstrD ->
returnContext:Types.abstrContext ->
returnEnv:Types.abstrEnvironment Pervasives.ref ->
callStack:Types.callStack Pervasives.ref -> stack:Types.memoryStack -> unit
Raise a return (called by return/ret statement), join the return code, the return context, the return environment and the memory stack with the last ones saved
Raises Failure If you try to return a C function in ASM and vice versa
Returns unit
val abexpBoolBin : Types.abstrEnvironment Pervasives.ref * bool ->
Types.boolOpBoolBin ->
Types.abstrEnvironment Pervasives.ref * bool ->
Types.abstrEnvironment Pervasives.ref * bool
Generic abstract interpretation of binary boolean operators
Returns The environment in which the whole boolean operation is satisfied and a boolean which represents if the resulting environment is bottom
val faexp : a:Types.arith_expr ->
context:Types.abstrContext ->
env:Types.abstrEnvironment Pervasives.ref -> Types.abstrD
Forward abstract semantics of arithmetic expressions
Raises Returns The abstract domain of the evaluation of the arithmetic expression
val baexp : a:Types.arith_expr ->
context:Types.abstrContext ->
p:Types.abstrD -> env:Types.abstrEnvironment Pervasives.ref -> bool
Backward abstract semantics of arithmetic expressions
Raises UNDEFINEDVAR If a variable is not defined in the provided context
Returns Does the resulting context have to be bottom
val abexp : b:Types.bool_expr ->
context:Types.abstrContext ->
env:Types.abstrEnvironment Pervasives.ref -> bool
Generic abstract interpretation of boolean expression
Returns Does the resulting context have to be bottom
val matchCArgs : args_def:Types.arguments ->
args:Types.arith_expr list ->
contextToEnhance:Types.abstrContext ->
context:Types.abstrContext ->
env:Types.abstrEnvironment Pervasives.ref -> Types.abstrContext
Add the abstract interpretation of a list of variables by the definition of a C function
Raises Failure If args_def doesn't match args
Returns The new context made from contextToEnhance
val matchAsmArgs : context:Types.abstrContext ->
args_def:Types.arguments ->
stack:Types.memoryStack ->
env:Types.abstrEnvironment Pervasives.ref ->
Types.abstrContext * Types.memoryStack
Adds the arguments from a memory stack to a context by a C function's definition
Raises Failure If the memory stack is too tiny compared to the argument's list
Returns The pair made of the new context and of the new memory stack (without the arguments used)
val prelude_asm : context:Types.abstrContext ->
env:Types.abstrEnvironment Pervasives.ref -> Types.abstrContext
Add registers to the context
Returns The new context with the registers set
val reset_registers : context:Types.abstrContext ->
env:Types.abstrEnvironment Pervasives.ref -> eax_value:Types.abstrD -> unit
Reset the value of all registers except EAX which is replaced by a specified value
Returns unit
val setRegisters : realContext:Types.abstrContext ->
contextWithRegs:Types.abstrContext ->
env:Types.abstrEnvironment Pervasives.ref -> unit
Replace the registers of a context by the registers of another one
Returns The new context made of c1 with registers of c2
val aPostAsm : Types.loc * Types.stat_a * Types.loc ->
shouldGoBackOnJmp:bool ->
f:Types.functionContext Pervasives.ref ->
callStack:Types.callStack Pervasives.ref ->
stack:Types.memoryStack ->
env:Types.abstrEnvironment Pervasives.ref ->
context:Types.abstrContext -> Types.abstrContext * Types.memoryStack
Generic forward non-relational abstract interpretation of ASM statements
Returns A pair made of the new context after the read of stat and of the new memory stack
val aPostAsmBlock : Types.loc * (Types.stat_a * Types.loc) list ->
shouldGoBackOnJmp:bool ->
f:Types.functionContext Pervasives.ref ->
callStack:Types.callStack Pervasives.ref ->
stack:Types.memoryStack ->
env:Types.abstrEnvironment Pervasives.ref ->
Types.abstrContext -> Types.abstrContext * Types.memoryStack
Generic forward non-relational abstract interpretation of ASM blocks
Returns A pair made of the new context and of the new memory stack
val aPostCBlock : Types.loc_stat_c ->
shouldGoBackOnJmp:bool ->
f:Types.functionContext Pervasives.ref ->
callStack:Types.callStack Pervasives.ref ->
lastAsmStack:Types.memoryStack ->
env:Types.abstrEnvironment Pervasives.ref ->
context:Types.abstrContext -> Types.abstrContext * Types.memoryStack
Generic forward non-relational abstract interpretation of C blocks
Returns The pair made of the new context after the execution of the block of C statements and the new memory stack
val aPostC : Types.loc * Types.stat_c * Types.loc ->
shouldGoBackOnJmp:bool ->
f:Types.functionContext Pervasives.ref ->
callStack:Types.callStack Pervasives.ref ->
lastAsmStack:Types.memoryStack ->
env:Types.abstrEnvironment Pervasives.ref ->
context:Types.abstrContext -> Types.abstrContext * Types.memoryStack
Generic forward non-relational abstract interpretation of C statements
Returns The pair made of the new context after the excetion of the C statement and of the new memory stack
val aPostGlobalC : pre_loc:Types.loc ->
stat:Types.global_statement ->
post_loc:Types.loc ->
f:Types.functionContext Pervasives.ref ->
env:Types.abstrEnvironment Pervasives.ref ->
Types.abstrContext -> Types.abstrContext
Generic forward non-relational abstract interpretation of global statement
Returns The new context after the execution of the global statement
val aPostProgram : pre_loc:Types.loc ->
program:(Types.global_statement * Types.loc) list ->
f:Types.functionContext Pervasives.ref ->
env:Types.abstrEnvironment Pervasives.ref ->
Types.abstrContext -> Types.abstrContext
Generic foward non-relational abstract interpretation of a block of global statements
Returns The new context after the execution of the block of global statements