Pure-reference catalog of code-coverage strategy for embedded C/C++: the criteria hierarchy (statement / branch / decision / condition / MC/DC), the gcov toolchain (.gcno/.gcda, --coverage), the LLVM source-based toolchain (llvm-profdata / llvm-cov), host-build vs QEMU-build instrumentation, MISRA-C:2012 and DO-178C structural-coverage expectations by safety level (DAL A maps to MC/DC), and report-format choices. Use when choosing what structural-coverage level to require and wiring gcov / llvm-cov into the build; physical .gcda retrieval from hardware is in hardware-in-loop-reference, QEMU machine flags in qemu-system-test-runner, and to author the embedded tests themselves use googletest-embedded-arm or unity-test-framework-c.
74
93%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Deep reference for the embedded-coverage-strategy-reference SKILL.md.
Consult when reading a .gcov report or reaching past the --coverage /
gcov -b -c basics shown in the SKILL.
Key flags from the GCC gcov invocation page (gcc.gnu.org/onlinedocs/gcc/Invoking-Gcov.html):
| Flag | Long form | Effect |
|---|---|---|
-a | --all-blocks | Write per-basic-block counts |
-b | --branch-probabilities | Write branch frequencies + summary to stdout |
-c | --branch-counts | Branch frequencies as counts not percentages |
-f | --function-summaries | Per-function coverage on top of file-level |
-n | --no-output | Suppress the .gcov file |
-p | --preserve-paths | Preserve full path in generated filenames |
-u | --unconditional-branches | Include unconditional branches in -b output |
--json-format | - | Emit .gcov.json.gz (gzip-compressed JSON, "does not require source code for generation") |
.gcov text reportThe text .gcov file annotates each source line with an execution count. Two
sentinels matter:
- marks a non-executable line (declaration, blank, comment).##### marks an executable line that was never run - the reads worth
chasing.-b -c together give branch coverage as raw counts, which is what an embedded
branch-coverage gate reads. For per-operand visibility on short-circuit
&& / ||, gcov is not enough - use clang -fcoverage-mcdc (see the SKILL's
LLVM section).