-
Notifications
You must be signed in to change notification settings - Fork 1
File format
Mitchell Hentges edited this page Feb 25, 2017
·
20 revisions
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 # |
Some exceptions, see gcov header
Offset | Size (bytes) | Purpose | Ignored? |
---|---|---|---|
0 | 4 | Block # | x |
4 | ? | Contains multiple line s |
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 | Number of counters | ? |
4 | 4 | Number of program runs | ? |
8 | 8 | Sum of all counters accumulated | ? |
16 | 8 | Maximum value in single run | ? |
24 | 8 | Sum of all runs' maximums | ? |
32 | ? | Histogram of counter values | ? |
Note: if this record isn't 3 bytes, it should be ignored.
Offset | Size (bytes) | Purpose | Ignored? |
---|---|---|---|
0 | 4 | Identifier | |
4 | 4 | Line # Checksum | |
8 | 4 | Config Checksum |
Curiously unused when gcov
reads gcda
files. When in the main parse loop, the closest is a GCOV_TAG_FOR_COUNTER
check, (which is based off of TAG_COUNTER_BASE
)
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 | Get function identifiers from gcda , use it to reference function definition in gcno file. Print the function's source file |
FN | Function | line # of fn start, fn name | Same as above, but print function definition's name |
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 " |