Contents Menu Expand Light mode Dark mode Auto light/dark mode
Using the GNU Compiler Collection 13.0.1 (experimental 20220101) documentation
Logo
Using the GNU Compiler Collection 13.0.1 (experimental 20220101) documentation
  • Copyright
  • Introduction
  • Programming Languages Supported by GCC
  • Language Standards Supported by GCC
    • C Language
    • C++ Language
    • Objective-C and Objective-C++ Languages
    • Go Language
    • D language
    • References for Other Languages
  • GCC Command Options
    • Description
    • Option Summary
    • Options Controlling the Kind of Output
    • Compiling C++ Programs
    • Options Controlling C Dialect
    • Options Controlling C++ Dialect
    • Options Controlling Objective-C and Objective-C++ Dialects
    • Options to Control Diagnostic Messages Formatting
    • Options to Request or Suppress Warnings
    • Options That Control Static Analysis
    • Options for Debugging Your Program
    • Options That Control Optimization
    • Program Instrumentation Options
    • Options Controlling the Preprocessor
    • Passing Options to the Assembler
    • Options for Linking
    • Options for Directory Search
    • Options for Code Generation Conventions
    • GCC Developer Options
    • Machine-Dependent Options
      • AArch64 Options
      • Adapteva Epiphany Options
      • AMD GCN Options
      • ARC Options
      • ARM Options
      • AVR Options
      • Blackfin Options
      • C6X Options
      • CRIS Options
      • C-SKY Options
      • Darwin Options
      • DEC Alpha Options
      • eBPF Options
      • FR30 Options
      • FT32 Options
      • FRV Options
      • GNU/Linux Options
      • H8/300 Options
      • HPPA Options
      • IA-64 Options
      • LM32 Options
      • LoongArch Options
      • M32C Options
      • M32R/D Options
      • M680x0 Options
      • MCore Options
      • MeP Options
      • MicroBlaze Options
      • MIPS Options
      • MMIX Options
      • MN10300 Options
      • Moxie Options
      • MSP430 Options
      • NDS32 Options
      • Nios II Options
      • Nvidia PTX Options
      • OpenRISC Options
      • PDP-11 Options
      • picoChip Options
      • PowerPC Options
      • PRU Options
      • RISC-V Options
      • RL78 Options
      • IBM RS/6000 and PowerPC Options
      • RX Options
      • S/390 and zSeries Options
      • Score Options
      • SH Options
      • Solaris 2 Options
      • SPARC Options
      • Options for System V
      • V850 Options
      • VAX Options
      • Visium Options
      • VMS Options
      • VxWorks Options
      • x86 Options
      • x86 Windows Options
      • Xstormy16 Options
      • Xtensa Options
      • zSeries Options
    • Specifying Subprocesses and the Switches to Pass to Them
    • Environment Variables Affecting GCC
    • Using Precompiled Headers
    • C++ Modules
  • C Implementation-Defined Behavior
    • Translation
    • Environment
    • Identifiers
    • Characters
    • Integers
    • Floating Point
    • Arrays and Pointers
    • Hints
    • Structures, Unions, Enumerations, and Bit-Fields
    • Qualifiers
    • Declarators
    • Statements
    • Preprocessing Directives
    • Library Functions
    • Architecture
    • Locale-Specific Behavior
  • C++ Implementation-Defined Behavior
    • Conditionally-Supported Behavior
    • Exception Handling
  • Extensions to the C Language Family
    • Statements and Declarations in Expressions
    • Locally Declared Labels
    • Labels as Values
    • Nested Functions
    • Nonlocal Gotos
    • Constructing Function Calls
    • Referring to a Type with typeof
    • Conditionals with Omitted Operands
    • 128-bit Integers
    • Double-Word Integers
    • Complex Numbers
    • Additional Floating Types
    • Half-Precision Floating Point
    • Decimal Floating Types
    • Hex Floats
    • Fixed-Point Types
    • Named Address Spaces
    • Arrays of Length Zero
    • Structures with No Members
    • Arrays of Variable Length
    • Macros with a Variable Number of Arguments.
    • Slightly Looser Rules for Escaped Newlines
    • Non-Lvalue Arrays May Have Subscripts
    • Arithmetic on void- and Function-Pointers
    • Pointer Arguments in Variadic Functions
    • Pointers to Arrays with Qualifiers Work as Expected
    • Non-Constant Initializers
    • Compound Literals
    • Designated Initializers
    • Case Ranges
    • Cast to a Union Type
    • Mixed Declarations, Labels and Code
    • Declaring Attributes of Functions
      • Common Function Attributes
      • AArch64 Function Attributes
      • AMD GCN Function Attributes
      • ARC Function Attributes
      • ARM Function Attributes
      • AVR Function Attributes
      • Blackfin Function Attributes
      • BPF Function Attributes
      • C-SKY Function Attributes
      • Epiphany Function Attributes
      • H8/300 Function Attributes
      • IA-64 Function Attributes
      • M32C Function Attributes
      • M32R/D Function Attributes
      • m68k Function Attributes
      • MCORE Function Attributes
      • MeP Function Attributes
      • MicroBlaze Function Attributes
      • Microsoft Windows Function Attributes
      • MIPS Function Attributes
      • MSP430 Function Attributes
      • NDS32 Function Attributes
      • Nios II Function Attributes
      • Nvidia PTX Function Attributes
      • PowerPC Function Attributes
      • RISC-V Function Attributes
      • RL78 Function Attributes
      • RX Function Attributes
      • S/390 Function Attributes
      • SH Function Attributes
      • Symbian OS Function Attributes
      • V850 Function Attributes
      • Visium Function Attributes
      • x86 Function Attributes
      • Xstormy16 Function Attributes
    • Specifying Attributes of Variables
    • Specifying Attributes of Types
    • Label Attributes
    • Enumerator Attributes
    • Statement Attributes
    • Attribute Syntax
    • Prototypes and Old-Style Function Definitions
    • C++ Style Comments
    • Dollar Signs in Identifier Names
    • The Character ESC in Constants
    • Determining the Alignment of Functions, Types or Variables
    • An Inline Function is As Fast As a Macro
    • When is a Volatile Object Accessed?
    • How to Use Inline Assembly Language in C Code
    • Alternate Keywords
    • Incomplete enum Types
    • Function Names as Strings
    • Getting the Return or Frame Address of a Function
    • Using Vector Instructions through Built-in Functions
    • Support for offsetof
    • Legacy __sync Built-in Functions for Atomic Memory Access
    • Built-in Functions for Memory Model Aware Atomic Operations
    • Built-in Functions to Perform Arithmetic with Overflow Checking
    • x86-Specific Memory Model Extensions for Transactional Memory
    • Object Size Checking Built-in Functions
    • Other Built-in Functions Provided by GCC
    • Built-in Functions Specific to Particular Target Machines
      • AArch64 Built-in Functions
      • Alpha Built-in Functions
      • Altera Nios II Built-in Functions
      • ARC Built-in Functions
      • ARC SIMD Built-in Functions
      • ARM iWMMXt Built-in Functions
      • ARM C Language Extensions (ACLE)
      • ARM Floating Point Status and Control Intrinsics
      • ARM ARMv8-M Security Extensions
      • AVR Built-in Functions
      • Blackfin Built-in Functions
      • BPF Built-in Functions
      • FR-V Built-in Functions
      • MIPS DSP Built-in Functions
      • MIPS Paired-Single Support
      • MIPS Loongson Built-in Functions
      • MIPS SIMD Architecture (MSA) Support
      • Other MIPS Built-in Functions
      • MSP430 Built-in Functions
      • NDS32 Built-in Functions
      • picoChip Built-in Functions
      • Basic PowerPC Built-in Functions
      • PowerPC AltiVec/VSX Built-in Functions
      • PowerPC Hardware Transactional Memory Built-in Functions
      • PowerPC Atomic Memory Operation Functions
      • PowerPC Matrix-Multiply Assist Built-in Functions
      • PRU Built-in Functions
      • RISC-V Built-in Functions
      • RX Built-in Functions
      • S/390 System z Built-in Functions
      • SH Built-in Functions
      • SPARC VIS Built-in Functions
      • TI C6X Built-in Functions
      • x86 Built-in Functions
      • x86 Transactional Memory Intrinsics
      • x86 Control-Flow Protection Intrinsics
    • Format Checks Specific to Particular Target Machines
    • Pragmas Accepted by GCC
    • Unnamed Structure and Union Fields
    • Thread-Local Storage
    • Binary Constants using the 0b Prefix
  • Extensions to the C++ Language
    • Vague Linkage
    • Function Multiversioning
    • Type Traits
    • C++ Concepts
    • Deprecated Features
    • Backwards Compatibility
    • When is a Volatile C++ Object Accessed?
    • Restricting Pointer Aliasing
    • C++ Interface and Implementation Pragmas
    • Where’s the Template?
    • Extracting the Function Pointer from a Bound Pointer to Member Function
    • C++-Specific Variable, Function, and Type Attributes
  • GNU Objective-C Features
    • GNU Objective-C Runtime API
    • +load: Executing Code before main
    • Type Encoding
    • Garbage Collection
    • Constant String Objects
    • compatibility_alias
    • Exceptions
    • Synchronization
    • Fast Enumeration
    • Messaging with the GNU Objective-C Runtime
  • Binary Compatibility
  • gcov—a Test Coverage Program
    • Introduction to gcov
    • Invoking gcov
    • Using gcov with GCC Optimization
    • Brief Description of gcov Data Files
    • Data File Relocation to Support Cross-Profiling
    • Profiling and Test Coverage in Freestanding Environments
  • gcov-tool—an Offline Gcda Profile Processing Tool
  • gcov-dump—an Offline Gcda and Gcno Profile Dump Tool
  • lto-dump—Tool for dumping LTO object files.
  • Known Causes of Trouble with GCC
    • Actual Bugs We Haven’t Fixed Yet
    • Interoperation
    • Incompatibilities of GCC
    • Fixed Header Files
    • Standard Libraries
    • Disappointments and Misunderstandings
    • Common Misunderstandings with GNU C++
    • Certain Changes We Don’t Want to Make
    • Warning Messages and Error Messages
  • Reporting Bugs
    • Have You Found a Bug?
    • How and Where to Report Bugs
  • How To Get Help with GCC
  • Contributing to GCC Development
  • Funding Free Software
  • The GNU Project and GNU/Linux
  • GNU GENERAL PUBLIC LICENSE
  • GNU Free Documentation License
  • Contributors to GCC
  • Indexes and tables
Back to top
Edit this page

gcov—a Test Coverage Program#

gcov is a tool you can use in conjunction with GCC to test code coverage in your programs.

  • Introduction to gcov
  • Invoking gcov
    • Options
  • Using gcov with GCC Optimization
  • Brief Description of gcov Data Files
  • Data File Relocation to Support Cross-Profiling
  • Profiling and Test Coverage in Freestanding Environments
    • Overview
    • Tutorial
    • System Initialization Caveats
Next
Introduction to gcov
Previous
Binary Compatibility
Copyright © 1988-2022 Free Software Foundation, Inc.
Made with Sphinx and @pradyunsg's Furo
Last updated on Nov 08, 2022
On this page
  • gcov—a Test Coverage Program