Next: , Up: Trace counts   [Contents][Index]

7.12.1 Generating trace counts

To generate a slice for a program run, first compile the program with deep tracing enabled (either by using the ‘--trace deep’ option or by compiling the program in a debugging grade). Then invoke the program with the ‘mtc’ script, passing any required arguments after the program name.

For example:

mtc ./myprog arg1 arg2

The program will run as usual, except that when it terminates it will write the number of times each debugger event was executed to a trace count file.

mtc’ accepts an ‘-o’ or ‘--output-file’ option. The argument to this option is the filename to use for the generated trace count file. If this option is not given, then the trace count will be written to a file with the prefix ‘.mercury_trace_counts’ and a unique suffix.

Ordinarily, the generated trace count file will list only the debugger events that were actually executed during this run. However, it will list all debugger events, even unexecuted ones, if ‘mtc’ is given the ‘-c’ or ‘--coverage-test’ option.

mtc’ also supports two more options intended for coverage testing: ‘-s’ or ‘--summary-file’, and ‘--summary-count’. These each set an option in the MERCURY_OPTIONS environment variable, ‘--trace-count-summary-file’ and ‘--trace-count-summary-max’ respectively. For the documentation of these ‘mtc’ options, see the documentation of MERCURY_OPTIONS environment variable.

Trace count files can be manipulated with the ‘mtc_union’ and ‘mtc_diff’ tools, and they can be analysed by the ‘mslice’ and ‘mdice’ tools. They can also be used to help direct a declarative debugging search (see Search modes).

Next: , Up: Trace counts   [Contents][Index]