--- title: "Code Coverage" layout: default permalink: /page_coverage.html ---

Dr. Memory

Code Coverage

Dr. Memory provides optional code coverage information to aid in fuzz testing (Fuzz Testing Mode) or in general testing.

# Enabling Coverage Information

Simply specify the `-coverage` runtime option to request code coverage information. The raw coverage data will be stored in a file with a "drcov" prefix in the regular Dr. Memory log directory. The file will be pointed at by a line at the end of the summary, if the application has a console for text output. This line looks like this:

    ~~Dr.M~~ Code coverage raw data: /home/joe/drmemory/logs/DrMemory-myapp.13112.000/drcov.myapp.13112.0000.proc.log

# Post Processing

The "drcov" file is raw data in `drcov` format that must be post-processed to make it human readable. DynamoRIO's `drcov2lcov` utility converts it into `lcov` format. The Dr. Memory release package includes a copy of this utility. Simply use its `-input` parameter to point at the `drcov` log file:

    dynamorio/tools/bin32/drcov2lcov -input logs/DrMemory-myapp.13112.000/drcov.myapp.13112.0000.proc.log

The resulting `coverage.info` file (in the current directory by default) is in the standard `lcov` format and can be processed by the lcov tool to produce nice html result pages.

For a full description of the drcov2lcov usage see the `drcov` documemtation at https://dynamorio.org/page_drcov.html.