The purpose of this module is to find which part of the program has been
used by a certain goal. Usage is defined in terms of clauses that have
fired, separated in clauses that succeeded at least once and clauses
that failed on each occasion.
This module relies on the SWI-Prolog tracer hooks. It modifies these
hooks and collects the results, after which it restores the debugging
environment. This has some limitations:
- The performance degrades significantly (about 10 times)
- It is not possible to use the debugger during coverage analysis
- The cover analysis tool is currently not thread-safe.
The result is represented as a list of clause-references. As the
references to clauses of dynamic predicates cannot be guaranteed, these
are omitted from the result.
- - Relies heavily on SWI-Prolog internals. We have considered using
a meta-interpreter for this purpose, but it is nearly impossible
to do 100% complete meta-interpretation of Prolog. Example
problem areas include handling cuts in control-structures
and calls from non-interpreted meta-predicates.
- To be done
- - Provide detailed information organised by predicate. Possibly
annotate the source with coverage information.
- show_coverage(:Goal) is semidet
- show_coverage(:Goal, +Modules:list(atom)) is semidet
- Report on coverage by Goal. Goal is executed as in once/1. Report
the details of the uncovered clauses for each module in the list
The following predicates are exported, but not or incorrectly documented.
- show_coverage(Arg1, Arg2)