module Common: sig
.. end
This module provides type definitions, and functions used by the various
parts of Bisect.
Point kinds
type
point_kind =
| |
Binding |
| |
Sequence |
| |
For |
| |
If_then |
| |
Try |
| |
While |
| |
Match |
| |
Class_expr |
| |
Class_init |
| |
Class_meth |
| |
Class_val |
| |
Toplevel_expr |
| |
Lazy_operator |
The type of point kinds, characterizing the various places where
Bisect will check for code execution.
val all_point_kinds : point_kind list
The list of all point kinds, in ascending order.
val string_of_point_kind : point_kind -> string
Conversion from point kind into string.
Utility functions
val try_finally : 'a -> ('a -> 'b) -> ('a -> unit) -> 'b
try_finally x f h
implements the try/finally logic.
f
is the body of the try clause, while h
is the finally handler.
Errors raised by handler are silently ignored.
val try_in_channel : bool -> string -> (Pervasives.in_channel -> 'a) -> 'a
try_in_channel bin filename f
is equivalent to
try_finally x f h
where:
x
is an input channel for file filename
,
(opened in binary mode iff bin
is true
);
h
just closes the input channel.
Raises an exception if any error occurs.
val try_out_channel : bool -> string -> (Pervasives.out_channel -> 'a) -> 'a
try_out_channel bin filename f
is equivalent to
try_finally x f h
where:
x
is an output channel for file filename
,
(opened in binary mode iff bin
is true
);
h
just closes the output channel.
Raises an exception if any error occurs.
I/O functions
exception Invalid_file of string
Exception to be raised when a read file does not conform to the Bisect
format. The parameter is the name of the incriminated file.
exception Unsupported_version of string
Exception to be raised when a read file has a format whose version is
unsupported. The parameter is the name of the incriminated file.
exception Modified_file of string
Exception to be raised when the source file has been modified since
instrumentation. The parameter is the name of the incriminated file.
val cmp_file_of_ml_file : string -> string
cmp_file_of_ml_file f
returns the name of the cmp file associated with
the ml file named f
.
val write_runtime_data : Pervasives.out_channel -> (string * int array) list -> unit
write_runtime_data oc d
writes the runtime data d
to the output channel
oc
using the Bisect file format. The runtime data list d
encodes a map
(through an association list) from files to arrays of integers (the value
at index i being the number of times point i has been visited).
Raises Sys_error
if an i/o error occurs.
val write_points : Pervasives.out_channel ->
(int * int * point_kind) list -> string -> unit
write_points oc pts f
writes the point definitions pts
to the output
channel oc
using the Bisect file format. A point definition is a
(offset, identifier, kind) triple. f
is the name of the source file
related to point definitions, whose digest is written to the output channel.
Raises Sys_error
if an i/o error occurs.
val read_runtime_data : string -> (string * int array) list
read_runtime_data f
reads the runtime data from file f
.
Raises Sys_error
if an i/o error occurs, may also raise
Invalid_file
, Unsupported_version
, or Modified_file
.
val read_points : string -> (int * int * point_kind) list
read_points f
reads the point definitions associated with the source file
named f
.
Raises Sys_error
if an i/o error occurs, may also raise
Invalid_file
, Unsupported_version
, or Modified_file
.