gcov
gcc.gnu.org
- Free plan
- Windows
- macOS
- Linux
What gcov is
gcov is a free test-coverage tool used with GCC to show how much of a program runs during tests. It reports execution counts for source lines and can produce coverage information for functions, branches, conditions, prime paths, and basic blocks. Developers can use the results to spot areas their test suites have not exercised. The `--branch-probabilities` option reports branch frequencies, while `--conditions` checks whether individual conditions affected a Boolean expression's outcome. Reports can be narrowed to functions matched by regular expressions with `--include` and `--exclude`. Output is available as `.gcov` text or compressed JSON; the JSON format is gzip-compressed and does not require source code to generate. gcov can also be used with gprof to examine computing time, though optimization may combine source lines and reduce detail for finding performance hotspots. Programs must be compiled with GCC's `--coverage` option before gcov can process their profiling data. It works only with GCC-compiled code and is not compatible with other profiling or test-coverage mechanisms.
Who it suits
gcov suits software developers using GCC who want coverage results to guide test work or code optimization. It is relevant across Linux, macOS, and Windows, for languages including C, C++, Fortran, Ada, and Go.
Good to know, and what to watch
- Reports line and function coverage.
- Includes branch, condition, and prime-path modes.
- Supports compressed JSON output.
- Works with gprof for computing-time analysis.
- Available for Linux, macOS, and Windows.
- Requires GCC's --coverage instrumentation.
- Works only with GCC-compiled code.
- Optimization can reduce hotspot detail.
Plans
Every plan and pricegcov
Free plan
The verdict
gcov provides detailed coverage reports for developers whose programs are built with GCC and its coverage option. Its compiler restriction and the possible loss of detail under optimization are important limits to weigh.
What the maker publishes
- Branch coverage
- The --branch-probabilities option reports branch frequencies in the output file and branch summary information on standard output. source
- Compatibility limit
- gcov works only on code compiled with GCC and is not compatible with other profiling or test coverage mechanisms. source
- Compiler compatibility
- gcov works only on code compiled with GCC and is not compatible with other profiling or test coverage mechanisms. source
- Condition coverage
- The --conditions option reports whether conditions independently affected the outcome of a Boolean expression. source
- Coverage modes
- Its options include branch, condition, and prime-path coverage reporting. source
- Distribution
- GCC source releases are distributed through mirror sites and source can also be retrieved using Git. source
- Founded
- 1987 source
- Instrumentation requirement
- Programs must be compiled with GCC's --coverage option before gcov can process the generated profiling data. source
- Intended users
- The documentation describes software developers using coverage results with test suites to find where additional tests are needed. source
- Line coverage
- gcov reports how often each source line executes and creates a .gcov logfile with per-line execution counts. source
- Line statistics
- gcov reports how often each line executes and which lines are executed. source
- Machine-readable output
- The --json-format option produces gzip-compressed JSON output that does not require source code to generate. source
- Optimization caveat
- The documentation says optimization can combine source lines and reduce the information available for finding performance hotspots. source
- Output files
- gcov produces coverage output files for source files containing code compiled to produce the data files. source
- Profile inspection
- The companion gcov-dump can dump the contents of gcda and gcno profile files offline. source
- Profile processing
- The companion gcov-tool can merge weighted profile sets, merge streamed profiles, and scale or normalize profile counts offline. source
- Profiling
- The documentation describes using gcov with gprof to assess computing time and fine-tune performance. source
- Project status
- The GCC homepage listed GCC 16.2 as released on August 7, 2026 and GCC 17.0 as in development. source
- Purpose
- gcov is a test coverage tool used with GCC to analyze code coverage in programs. source
- Purpose
- gcov is a test coverage program used with GCC to find untested parts of programs and guide code optimization. source
- Reporting filters
- The --include and --exclude options let users limit reports to functions matching specified regular expressions. source
- Setup requirement
- Programs must be compiled with GCC's --coverage option before gcov can report coverage. source
- Support
- The GCC project directs users to its manuals and the gcc-help mailing list for usage questions. source
- Use cases
- It can help identify untested parts of a program and guide code optimization. source
Checked against the maker's pages on 7 Oct 2026.