xref: /freebsd/contrib/file/magic/Magdir/coverage (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
1
2#------------------------------------------------------------------------------
3# $File: coverage,v 1.3 2021/02/23 00:51:10 christos Exp $
4# xoverage:  file(1) magic for test coverage data
5
6# File formats used to store test coverage data
7# 2016-05-21, Georg Sauthoff <mail@georg.so>
8
9
10# - GCC gcno - written by GCC at compile time when compiling with
11# 	gcc -ftest-coverage
12# - GCC gcda - written by a program that was compiled with
13#	gcc -fprofile-arcs
14# - LLVM raw profiles - generated by a program compiled with
15#	clang -fprofile-instr-generate -fcoverage-mapping ...
16# - LLVM indexed profiles - generated by
17#	llvm-profdata
18# - GCOV reports, i.e. the annotated source code
19# - LCOV trace files, i.e. aggregated GCC profiles
20#
21# GCC coverage tracefiles
22# .gcno file are created during compile time,
23# while data collected during runtime is stored in .gcda files
24# cf. gcov-io.h
25# https://gcc.gnu.org/onlinedocs/gcc-5.3.0/gcc/Gcov-Data-Files.html
26# Examples:
27# Fedora 23/x86-64/gcc-5.3.1: 6f 6e 63 67 52 33 30 35
28# Debian 8 PPC64/gcc-4.9.2  : 67 63 6e 6f 34 30 39 2a
290	lelong	0x67636e6f	GCC gcno coverage (-ftest-coverage),
30>&3	byte	x	version %c.
31>&1	byte	x	\b%c
32
33# big endian
340	belong	0x67636e6f	GCC gcno coverage (-ftest-coverage),
35>&0	byte	x	version %c.
36>&2	byte	x	\b%c (big-endian)
37
38# Examples:
39# Fedora 23/x86-64/gcc-5.3.1: 61 64 63 67 52 33 30 35
40# Debian 8 PPC64/gcc-4.9.2  : 67 63 64 61 34 30 39 2a
410	lelong	0x67636461	GCC gcda coverage (-fprofile-arcs),
42>&3	byte	x	version %c.
43>&1	byte	x	\b%c
44
45# big endian
460	belong	0x67636461	GCC gcda coverage (-fprofile-arcs),
47>&0	byte	x	version %c.
48>&2	byte	x	\b%c (big-endian)
49
50
51# LCOV tracefiles
52# cf. http://ltp.sourceforge.net/coverage/lcov/geninfo.1.php
530	string	TN:
54>&0	search/64	\nSF:/	LCOV coverage tracefile
55
56
57# Coverage reports generated by gcov
58# i.e. source code annotated with coverage information
590	string	\x20\x20\x20\x20\x20\x20\x20\x20-:\x20\x20\x20\ 0:Source:
60>&0	search/128	\x20\x20\x20\x20\x20\x20\x20\x20-:\x20\x20\x20\ 0:Graph:
61>>&0	search/128	\x20\x20\x20\x20\x20\x20\x20\x20-:\x20\x20\x20\ 0:Data:	GCOV coverage report
62
63
64# LLVM coverage files
65
66# raw data after running a program compiled with:
67# `clang -fprofile-instr-generate -fcoverage-mapping ...`
68# default name: default.profraw
69# magic is: \xFF lprofr \x81
70# cf. https://llvm.org/docs/doxygen/html/InstrProfData_8inc_source.html
710	lequad	0xff6c70726f667281	LLVM raw profile data,
72>&0	byte	x	version %d
73
74# big endian
750	bequad	0xff6c70726f667281	LLVM raw profile data,
76>&7	byte	x	version %d (big-endian)
77
78
79# LLVM indexed instruction profile (as generated by llvm-profdata)
80# magic is: reverse(\xFF lprofi \x81)
81# cf. https://llvm.org/docs/CoverageMappingFormat.html
82# https://llvm.org/docs/doxygen/html/namespacellvm_1_1IndexedInstrProf.html
83# https://llvm.org/docs/CommandGuide/llvm-cov.html
84# https://llvm.org/docs/CommandGuide/llvm-profdata.html
850	lequad	0x8169666f72706cff	LLVM indexed profile data,
86>&0	byte	x	version %d
87
88# big endian
890	bequad	0x8169666f72706cff	LLVM indexed profile data,
90>&7	byte	x	version %d (big-endian)
91
92