Tuesday, October 27, 2026 4,350 lists 78,105 records on file
List your app or device

  1. Home
  2. Test Coverage Tools
  3. gcov

gcov

What it is

gcov is a free test coverage tool used with GCC to show how a program's source code runs. It reports whether each line executes and how often, producing a `.gcov` file with per-line counts. Its coverage options include branch, condition, and prime-path reporting, and its listed coverage types also include function and basic-block coverage. Developers can restrict reports to functions matching regular expressions with `--include` and `--exclude`.

Reports can be provided as `.gcov` text or gzip-compressed JSON; the JSON option does not require source code to generate. gcov can be paired with gprof to examine computing time, although optimization may combine source lines and reduce detail for locating performance hotspots. Programs must be compiled with GCC's `--coverage` option before gcov can analyze their data. It works only with GCC-compiled code and is not compatible with other profiling or test coverage mechanisms. The tool is self-hosted and listed for Linux, macOS, and Windows. The GCC project points users to its manuals and the gcc-help mailing list for usage questions.

For and against

For

  • Reports per-line execution counts.
  • Offers branch, condition, and prime-path reporting.
  • Produces text or gzip-compressed JSON reports.
  • Can be used with gprof to assess computing time.

Against

  • Requires compilation with GCC's `--coverage` option.
  • Works only with code compiled by GCC.
  • Optimization can reduce detail for locating performance hotspots.

The verdict

gcov provides several coverage views for GCC-compiled programs, with text and compressed JSON output. Its GCC instrumentation requirement and optimization caveat are important when planning coverage analysis.

Who it suits

gcov suits developers using GCC and test suites to find untested code and guide optimization. It requires coverage-instrumented builds compiled with GCC.

Plans and prices

gcov

Free

Requires code compiled with GCC; requires coverage instrumentation to generate coverage data

Every plan, in full

On the record

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

The review

gcov is a GCC-integrated coverage analyzer for developers who need evidence that their C-family or other GCC-built programs are being exercised by tests. It is most compelling for teams already committed to GCC and self-hosted tooling. The trade-off is that its useful depth comes with a strict compiler and instrumentation dependency.

Overview

gcov measures how a test suite traverses compiled code, turning execution data into reports that expose untouched lines and weakly exercised paths. That makes it a practical aid for deciding where new tests belong and for reviewing whether a change has meaningful test reach. It also has a performance-analysis role when paired with gprof, although compiler optimization can merge source lines and make hotspot evidence less precise.

The tool is part of the GCC ecosystem, founded in 1987, and is distributed as self-hosted software across Linux, macOS, and Windows. Its scope covers C, C++, Objective-C, Objective-C++, Fortran, Ada, D, Go, and other programs built with GCC. That breadth is useful inside a GCC-based build estate, but it does not make gcov a general coverage layer for arbitrary compilers or unrelated profiling systems.

Key features

Line and function coverage form the core report. gcov writes a .gcov text file with per-line execution counts, so developers can distinguish code that never ran from code that ran only occasionally. Branch coverage adds branch frequencies in the output and a summary on standard output. Condition coverage goes further by indicating whether individual conditions independently changed the result of a Boolean expression.

Prime-path and basic-block coverage provide additional structural views when line and branch totals do not explain behavior well. These modes are valuable for suites that need to reason about paths through complex control flow, though they add reporting detail rather than removing the need for well-designed tests.

For pipelines and other machine consumers, --json-format emits gzip-compressed JSON, and it can generate that output without source code. The --include and --exclude options filter reports to functions matching regular expressions, helping large projects focus on selected areas. Coverage data must exist first: the program has to be compiled with GCC’s --coverage option. gcov cannot process code built with another compiler or combine with other profiling and test-coverage mechanisms.

The companion gcov-tool supports offline merging of weighted or streamed profile sets and can scale or normalize profile counts. gcov-dump exposes the contents of gcda and gcno files for offline inspection. Together, these utilities make profile handling more workable in distributed or post-build workflows, while gprof supplies a complementary view of computing time.

Pricing

The gcov plan costs free. It is a free plan with no free trial because there is no paid tier to trial, and no seat, usage quota, renewal charge, or subscription term is stated. The practical cost is setup: coverage data requires GCC compilation with instrumentation, so projects using another toolchain would need a build change before this plan is useful.

Platforms

gcov supports Linux, macOS, and Windows. It is self-hosted rather than a hosted reporting service, which suits teams that keep builds and profile data in their own environments.

Who it's for

Choose gcov when your developers already compile with GCC and want detailed line, branch, condition, path, and block evidence alongside their test suites. It is particularly fitting for teams that value command-line reports, compressed JSON for automation, and offline profile utilities without adding a paid service.

Look elsewhere when coverage must span non-GCC compilers or be combined with other profiling mechanisms. The required --coverage instrumentation also means it is not a drop-in analyzer for an existing build that was produced without GCC coverage flags.

Pros and cons

Pros

  • Broad coverage views: line, function, branch, condition, prime-path, and basic-block modes reveal more than a single percentage.
  • Automation-friendly output: gzip-compressed JSON can be produced without source code, while include and exclude filters keep reports targeted.
  • Free and self-hosted: there is no software charge, and teams retain local control of profile processing.
  • Offline profile utilities: gcov-tool and gcov-dump support merging, normalization, scaling, and inspection outside the immediate test run.

Cons

  • GCC-only workflow: code must be compiled with GCC and --coverage, excluding other compiler and coverage ecosystems.
  • Optimization can reduce diagnostic clarity: combined source lines make performance hotspots harder to attribute precisely.
  • Text-first reporting: the standard artifact is a .gcov logfile, so teams wanting a hosted dashboard must supply their own presentation layer.

Alternatives

Coveralls is the better choice for hosted or API-oriented reporting, with a freemium model, a free trial, and a free open-source/public-repository offering.

BullseyeCoverage suits readers who want a paid coverage product with Linux, macOS, Windows, and self-hosted support; its evaluation license is temporary.

Codecov is preferable when web, API, or extension workflows matter and a freemium plan with repository-upload limits fits the project.

ReportGenerator is a stronger fit for teams seeking generated presentation features, with free and paid individual plans plus a 10-day full-access trial.

c8 is the focused alternative for Linux-based Node.js command-line coverage.

cargo-llvm-cov is the natural pick for Rust projects needing an open-source LLVM coverage tool across Linux, macOS, and Windows.

Coverage.py is designed for Python coverage and offers an open-source core with enterprise subscription support through Tidelift.

MozJPEG is unrelated to general coverage analysis and is instead a free, open-source JPEG encoder library.

Verdict

gcov is a strong recommendation for GCC-based development teams that want detailed, no-cost coverage data and offline profile control. Its main reason to choose it is the combination of deep coverage modes and machine-readable output inside a self-hosted workflow. Its main reason to look elsewhere is equally clear: projects built with non-GCC toolchains, or teams expecting hosted cross-toolchain reporting, will outgrow its boundaries quickly.

Alternatives to gcov

Every alternative, ranked