bcov produces coverage information without recompiling a program by instrumenting it with breakpoints. Effectively it debugs the program automatically, removing each breakpoint after it has been hit. This produces detailed coverage information with minimal runtime overhead.


bcov executable [arguments]

Executes the binary with the given arguments and stores the coverage summary in .bcovdump. The result file is more or less human readable (and easily machine readable), a nicer presentation can be generated with bcov-report:

bcov-report [dumpfile] [output directory]

Converts the coverage dump into an lcov-style html report. If not output directory is given bcov-report uses a temporary directory and tries to open the result in the standard browser.

Example Output produced by bcov

bcov requires libdwarf to read debug info. Note you need a fairly recent one, older libdwarf releases are buggy concerning new gcc output. Using an old libdwarf will crash the profiled program!. If the version in your distro is too old (quite likely), do the following:

  1. download and build libdwarf
  2. copy libdwarf.h and libdwarf.a to a directory somewhere
  3. configure bcov with ./configure --with-libdwarf=path/libdwarf


More information and the current source code is available from the project page.

SourceForge Logo

© 2007-2009 Thomas Neumann