Skip to content
SPECIFICTION
Get listed

gcov

gcc.gnu.org

Free plan WindowsmacOSLinux
Visit gcc.gnu.org
Spec score 8.5 #5 of 27 in Test Coverage Tools

What it is

gcov is a free test coverage tool used with GCC to show how program code runs during testing. It reports which source lines execute and how often, producing per-line counts in `.gcov` files. Reports can include line, function, branch, condition, prime-path, and basic-block coverage. Options can report branch frequencies, show whether conditions independently affect a Boolean expression’s result, or filter reports to functions matching regular expressions. Output is available as `.gcov` text or gzip-compressed JSON; JSON generation does not require source code. The GCC documentation also describes using gcov with gprof to assess computing time, while warning that optimization can combine source lines and reduce hotspot detail. Before coverage reporting, programs must be compiled with GCC’s `--coverage` option. gcov works only with GCC-compiled code and is not compatible with other profiling or test coverage mechanisms. It runs on Linux, macOS, and Windows, supports the listed languages from C and C++ to Ada, D, and Go, and is self-hosted.

Spec sheet

Purpose
gcov is a test coverage program used with GCC to find untested parts of programs and guide code optimization.Read 7 Oct 2026 · gcc.gnu.org
Intended users
The documentation describes software developers using coverage results with test suites to find where additional tests are needed.Read 7 Oct 2026 · gcc.gnu.org
Support
The GCC project directs users to its manuals and the gcc-help mailing list for usage questions.Read 7 Oct 2026 · gcc.gnu.org
Founded
1987Read 28 Sep 2026 · gcc.gnu.org
Branch coverage
The --branch-probabilities option reports branch frequencies in the output file and branch summary information on standard output.Read 7 Oct 2026 · gcc.gnu.org
Compatibility limit
gcov works only on code compiled with GCC and is not compatible with other profiling or test coverage mechanisms.Read 7 Oct 2026 · gcc.gnu.org
Compiler compatibility
gcov works only on code compiled with GCC and is not compatible with other profiling or test coverage mechanisms.Read 7 Oct 2026 · gcc.gnu.org
Condition coverage
The --conditions option reports whether conditions independently affected the outcome of a Boolean expression.Read 7 Oct 2026 · gcc.gnu.org
Coverage modes
Its options include branch, condition, and prime-path coverage reporting.Read 7 Oct 2026 · gcc.gnu.org
Distribution
GCC source releases are distributed through mirror sites and source can also be retrieved using Git.Read 7 Oct 2026 · gcc.gnu.org
Instrumentation requirement
Programs must be compiled with GCC's --coverage option before gcov can process the generated profiling data.Read 7 Oct 2026 · gcc.gnu.org
Line coverage
gcov reports how often each source line executes and creates a .gcov logfile with per-line execution counts.Read 7 Oct 2026 · gcc.gnu.org
Line statistics
gcov reports how often each line executes and which lines are executed.Read 7 Oct 2026 · gcc.gnu.org
Machine-readable output
The --json-format option produces gzip-compressed JSON output that does not require source code to generate.Read 7 Oct 2026 · gcc.gnu.org
Optimization caveat
The documentation says optimization can combine source lines and reduce the information available for finding performance hotspots.Read 7 Oct 2026 · gcc.gnu.org
Output files
gcov produces coverage output files for source files containing code compiled to produce the data files.Read 7 Oct 2026 · gcc.gnu.org
Profile inspection
The companion gcov-dump can dump the contents of gcda and gcno profile files offline.Read 7 Oct 2026 · gcc.gnu.org
Profile processing
The companion gcov-tool can merge weighted profile sets, merge streamed profiles, and scale or normalize profile counts offline.Read 7 Oct 2026 · gcc.gnu.org
Profiling
The documentation describes using gcov with gprof to assess computing time and fine-tune performance.Read 7 Oct 2026 · gcc.gnu.org
Project status
The GCC homepage listed GCC 16.2 as released on August 7, 2026 and GCC 17.0 as in development.Read 7 Oct 2026 · gcc.gnu.org
Reporting filters
The --include and --exclude options let users limit reports to functions matching specified regular expressions.Read 7 Oct 2026 · gcc.gnu.org
Setup requirement
Programs must be compiled with GCC's --coverage option before gcov can report coverage.Read 7 Oct 2026 · gcc.gnu.org
Use cases
It can help identify untested parts of a program and guide code optimization.Read 7 Oct 2026 · gcc.gnu.org
Use with gprof
gcov can be used alongside gprof to assess which parts of a program use the most computing time.Read 7 Oct 2026 · gcc.gnu.org

Plans and prices

gcov Free Requires code compiled with GCC; requires coverage instrumentation to generate coverage data Read 7 Oct 2026 · gcc.gnu.org

Every gcov plan and price →

Strong points and limits

Strong points

  • Reports line, function, branch, and other coverage
  • Provides text and compressed JSON output
  • Can filter reports by function-name patterns
  • Free and self-hosted

Limits

  • Requires compilation with GCC’s `--coverage` option
  • Works only with GCC-compiled code
  • Optimization can reduce hotspot detail

Who it suits

gcov suits developers using GCC and test suites to find code that tests do not exercise. It may also help developers examining branch, condition, or performance coverage.

Verdict

gcov provides detailed coverage reporting for GCC-compiled programs, with multiple coverage types and output formats. Its compiler and instrumentation requirements make compatibility the first consideration.

Where Specifiction places it

Alternatives to gcovAll alternatives →