-
Notifications
You must be signed in to change notification settings - Fork 1
File format
These are binary files. Reference
gcda
and gcno
files follow the same "container" format:
Offset | Size (bytes) | Purpose | Ignored? |
---|---|---|---|
0 | 4 | Magic String ("gcda" or "gcno") | |
4 | 4 | Version | |
8 | 4 | Stamp (used for "merging") | x |
12 | * | Contains records
|
Each file is contained with different types of records
.
Offset | Size (bytes) | Purpose | Ignored? |
---|---|---|---|
0 | 4 | Identifier | |
4 | 4 | Line # Checksum | |
8 | 4 | Config Checksum | |
12 | 4 | Fn Name Length | |
16 | ^ | Fn Name | |
? | 4 | Source Path Length | |
? | ^ | Source Path | |
? | 4 | Line # |
Each block
has "flags", which aren't used. However, the number of blocks
is important, and can be inferred
from the record size.
Offset | Size (bytes) | Purpose | Ignored? |
---|---|---|---|
0 | * | One 32bit "flag" value per block | x |
Represents a "jump" (or an "arc", eyyy) from one block
to another.
Offset | Size (bytes) | Purpose | Ignored? |
---|---|---|---|
0 | 4 | Source block # | |
4 | * | Contains multiple arcs
|
Where each arc is:
Offset | Size (bytes) | Purpose | Ignored? |
---|---|---|---|
0 | 4 | Destination block | |
4 | 4 | Flag | x |
Some exceptions, see gcov header
Offset | Size (bytes) | Purpose | Ignored? |
---|---|---|---|
0 | 4 | Block # | |
4 | * | Contains multiple lines
|
Where each line is:
Offset | Size (bytes) | Purpose | Ignored? |
---|---|---|---|
0 | 4 | Line # | |
------ | ------ | If Line # == 0 , then changing file: |
------ |
4 | 4 | Next filename's length | |
8 | ^ | Next filename |
If this record is encountered, then the rest of the file can be ignored.
Offset | Size (bytes) | Purpose | Ignored? |
---|---|---|---|
0 | 4 | Checksum | ? |
4 | 4 | Number of counters | ? |
8 | 4 | Number of program runs | ? |
12 | 8 | Sum of all counters accumulated | ? |
20 | 8 | Maximum value in single run | ? |
28 | 8 | Sum of all runs' maximums | ? |
36 | * | Contains histogram of buckets
|
? |
Where each bucket
is:
Offset | Size (bytes) | Purpose | Ignored? |
---|---|---|---|
0 | 4 | Number of counters whose profile count is within bucket | |
4 | 8 | Minimum profile count included in bucket | |
12 | 8 | Cumulative value of profile counts in bucket |
Note: if this record isn't 12 bytes (3 fields), it should be ignored.
Offset | Size (bytes) | Purpose | Ignored? |
---|---|---|---|
0 | 4 | Identifier | |
4 | 4 | Line # Checksum | |
8 | 4 | Config Checksum |
TAG_COUNTER_BASE
actually has one or more tags, based on how many "runs" have occurred:
- Tag for the "run" #1:
0x01a10000
- Tag for the "run" #2:
0x01a30000
- Tag for the "run" #3:
0x01a50000
- Tag for the "run" #4:
0x01a70000
- And so on
So, each run's COUNTER
data is separately identifiable, and separated by 2^17
Offset | Size (bytes) | Purpose | Ignored? |
---|---|---|---|
0 | * | Multiple 64bit "count" values |
If this record is encountered, then the rest of the file can be ignored.
This is a text file. Reference
Prefix | Purpose | Data Format | Strategy |
---|---|---|---|
TN | Test Name | String name of test | Leave blank, like lcov is doing in local tests (!) |
SF | Source File | Absolute path to source file | Use absolute source file path from gcno file (!). |
FN | Function | line # of fn start, fn name | Function from gcno file where src_path is the current SF and first lines record refers to current SF (!) |
FNDA | Fn Data | Execution count of fn, fn name | ? |
FNF | # Fn Found | integer | Print number of TAG_FUNCTION encountered in gcda
|
FNH | # Fn Executed | integer | ? |
DA | Executions for some Line | line #, execution count | ? |
LF | # Lines Found | integer | Count lines from gcno lines records |
LH | # Lines Executed | integer | ? |
end_of_record |
End of Record | Signifies end of data for source file | Use the constant "end_of_record " (!) |
- It is possible to have an output record where some functions are printed in the
FNDA
section, but not in theFN
section. This occurs when a function'ssrc_path
isSF
, but its first line record refers to a different source file. For example, the TimeStamp.cpp constructor is inFNDA
, but notFN