[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75CKM52J7J229FP27236ETT":3,"skill-same:01M75CKM52J7J229FP27236ETT":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M75CKM52J7J229FP27236ETT","coverage-analysis",null,"Coverage analysis measures code exercised during fuzzing. Use when assessing harness effectiveness or identifying fuzzing blockers.","agisota\u002Fold-one","agisota","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F121413592?v=4","01M75B4BRNT67EC1NDRT8QZEP2","01M75B4BS7QR9VP580MSCPTS3X",3,"MIT","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fcoverage-analysis\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: coverage-analysis\ntype: technique\ndescription: >\n  Coverage analysis measures code exercised during fuzzing.\n  Use when assessing harness effectiveness or identifying fuzzing blockers.\n---\n\n# Coverage Analysis\n\nCoverage analysis is essential for understanding which parts of your code are exercised during fuzzing. It helps identify fuzzing blockers like magic value checks and tracks the effectiveness of harness improvements over time.\n\n## Overview\n\nCode coverage during fuzzing serves two critical purposes:\n\n1. **Assessing harness effectiveness**: Understand which parts of your application are actually executed by your fuzzing harnesses\n2. **Tracking fuzzing progress**: Monitor how coverage changes when updating harnesses, fuzzers, or the system under test (SUT)\n\nCoverage is a proxy for fuzzer capability and performance. While coverage [is not ideal for measuring fuzzer performance](https:\u002F\u002Farxiv.org\u002Fabs\u002F1808.09700) in absolute terms, it reliably indicates whether your harness works effectively in a given setup.\n\n### Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| **Coverage instrumentation** | Compiler flags that track which code paths are executed |\n| **Corpus coverage** | Coverage achieved by running all test cases in a fuzzing corpus |\n| **Magic value checks** | Hard-to-discover conditional checks that block fuzzer progress |\n| **Coverage-guided fuzzing** | Fuzzing strategy that prioritizes inputs that discover new code paths |\n| **Coverage report** | Visual or textual representation of executed vs. unexecuted code |\n\n## When to Apply\n\n**Apply this technique when:**\n- Starting a new fuzzing campaign to establish a baseline\n- Fuzzer appears to plateau without finding new paths\n- After harness modifications to verify improvements\n- When migrating between different fuzzers\n- Identifying areas requiring dictionary entries or seed inputs\n- Debugging why certain code paths aren't reached\n\n**Skip this technique when:**\n- Fuzzing campaign is actively finding crashes\n- Coverage infrastructure isn't set up yet\n- Working with extremely large codebases where full coverage reports are impractical\n- Fuzzer's internal coverage metrics are sufficient for your needs\n\n## Quick Reference\n\n| Task | Command\u002FPattern |\n|------|-----------------|\n| LLVM coverage instrumentation (C\u002FC++) | `-fprofile-instr-generate -fcoverage-mapping` |\n| GCC coverage instrumentation | `-ftest-coverage -fprofile-arcs` |\n| cargo-fuzz coverage (Rust) | `cargo +nightly fuzz coverage \u003Ctarget>` |\n| Generate LLVM profile data | `llvm-profdata merge -sparse file.profraw -o file.profdata` |\n| LLVM coverage report | `llvm-cov report .\u002Fbinary -instr-profile=file.profdata` |\n| LLVM HTML report | `llvm-cov show .\u002Fbinary -instr-profile=file.profdata -format=html -output-dir html\u002F` |\n| gcovr HTML report | `gcovr --html-details -o coverage.html` |\n\n## Ideal Coverage Workflow\n\nThe following workflow represents best practices for integrating coverage analysis into your fuzzing campaigns:\n\n```\n[Fuzzing Campaign]\n       |\n       v\n[Generate Corpus]\n       |\n       v\n[Coverage Analysis]\n       |\n       +---> Coverage Increased? --> Continue fuzzing with larger corpus\n       |\n       +---> Coverage Decreased? --> Fix harness or investigate SUT changes\n       |\n       +---> Coverage Plateaued? --> Add dictionary entries or seed inputs\n```\n\n**Key principle**: Use the corpus generated *after* each fuzzing campaign to calculate coverage, rather than real-time fuzzer statistics. This approach provides reproducible, comparable measurements across different fuzzing tools.\n\n## Step-by-Step\n\n### Step 1: Build with Coverage Instrumentation\n\nChoose your instrumentation method based on toolchain:\n\n**LLVM\u002FClang (C\u002FC++):**\n```bash\nclang++ -fprofile-instr-generate -fcoverage-mapping \\\n  -O2 -DNO_MAIN \\\n  main.cc harness.cc execute-rt.cc -o fuzz_exec\n```\n\n**GCC (C\u002FC++):**\n```bash\ng++ -ftest-coverage -fprofile-arcs \\\n  -O2 -DNO_MAIN \\\n  main.cc harness.cc execute-rt.cc -o fuzz_exec_gcov\n```\n\n**Rust:**\n```bash\nrustup toolchain install nightly --component llvm-tools-preview\ncargo +nightly fuzz coverage fuzz_target_1\n```\n\n### Step 2: Create Execution Runtime (C\u002FC++ only)\n\nFor C\u002FC++ projects, create a runtime that executes your corpus:\n\n```cpp\n\u002F\u002F execute-rt.cc\n#include \u003Cstdio.h>\n#include \u003Cstdlib.h>\n#include \u003Cdirent.h>\n#include \u003Cstdint.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);\n\nvoid load_file_and_test(const char *filename) {\n    FILE *file = fopen(filename, \"rb\");\n    if (file == NULL) {\n        printf(\"Failed to open file: %s\\n\", filename);\n        return;\n    }\n\n    fseek(file, 0, SEEK_END);\n    long filesize = ftell(file);\n    rewind(file);\n\n    uint8_t *buffer = (uint8_t*) malloc(filesize);\n    if (buffer == NULL) {\n        printf(\"Failed to allocate memory for file: %s\\n\", filename);\n        fclose(file);\n        return;\n    }\n\n    long read_size = (long) fread(buffer, 1, filesize, file);\n    if (read_size != filesize) {\n        printf(\"Failed to read file: %s\\n\", filename);\n        free(buffer);\n        fclose(file);\n        return;\n    }\n\n    LLVMFuzzerTestOneInput(buffer, filesize);\n\n    free(buffer);\n    fclose(file);\n}\n\nint main(int argc, char **argv) {\n    if (argc != 2) {\n        printf(\"Usage: %s \u003Cdirectory>\\n\", argv[0]);\n        return 1;\n    }\n\n    DIR *dir = opendir(argv[1]);\n    if (dir == NULL) {\n        printf(\"Failed to open directory: %s\\n\", argv[1]);\n        return 1;\n    }\n\n    struct dirent *entry;\n    while ((entry = readdir(dir)) != NULL) {\n        if (entry->d_type == DT_REG) {\n            char filepath[1024];\n            snprintf(filepath, sizeof(filepath), \"%s\u002F%s\", argv[1], entry->d_name);\n            load_file_and_test(filepath);\n        }\n    }\n\n    closedir(dir);\n    return 0;\n}\n```\n\n### Step 3: Execute on Corpus\n\n**LLVM (C\u002FC++):**\n```bash\nLLVM_PROFILE_FILE=fuzz.profraw .\u002Ffuzz_exec corpus\u002F\n```\n\n**GCC (C\u002FC++):**\n```bash\n.\u002Ffuzz_exec_gcov corpus\u002F\n```\n\n**Rust:**\nCoverage data is automatically generated when running `cargo fuzz coverage`.\n\n### Step 4: Process Coverage Data\n\n**LLVM:**\n```bash\n# Merge raw profile data\nllvm-profdata merge -sparse fuzz.profraw -o fuzz.profdata\n\n# Generate text report\nllvm-cov report .\u002Ffuzz_exec \\\n  -instr-profile=fuzz.profdata \\\n  -ignore-filename-regex='harness.cc|execute-rt.cc'\n\n# Generate HTML report\nllvm-cov show .\u002Ffuzz_exec \\\n  -instr-profile=fuzz.profdata \\\n  -ignore-filename-regex='harness.cc|execute-rt.cc' \\\n  -format=html -output-dir fuzz_html\u002F\n```\n\n**GCC with gcovr:**\n```bash\n# Install gcovr (via pip for latest version)\npython3 -m venv venv\nsource venv\u002Fbin\u002Factivate\npip3 install gcovr\n\n# Generate report\ngcovr --gcov-executable \"llvm-cov gcov\" \\\n  --exclude harness.cc --exclude execute-rt.cc \\\n  --root . --html-details -o coverage.html\n```\n\n**Rust:**\n```bash\n# Install required tools\ncargo install cargo-binutils rustfilt\n\n# Create HTML generation script\ncat \u003C\u003C'EOF' > .\u002Fgenerate_html\n#!\u002Fbin\u002Fsh\nif [ $# -lt 1 ]; then\n    echo \"Error: Name of fuzz target is required.\"\n    echo \"Usage: $0 fuzz_target [sources...]\"\n    exit 1\nfi\nFUZZ_TARGET=\"$1\"\nshift\nSRC_FILTER=\"$@\"\nTARGET=$(rustc -vV | sed -n 's|host: ||p')\ncargo +nightly cov -- show -Xdemangler=rustfilt \\\n  \"target\u002F$TARGET\u002Fcoverage\u002F$TARGET\u002Frelease\u002F$FUZZ_TARGET\" \\\n  -instr-profile=\"fuzz\u002Fcoverage\u002F$FUZZ_TARGET\u002Fcoverage.profdata\" \\\n  -show-line-counts-or-regions -show-instantiations \\\n  -format=html -o fuzz_html\u002F $SRC_FILTER\nEOF\nchmod +x .\u002Fgenerate_html\n\n# Generate HTML report\n.\u002Fgenerate_html fuzz_target_1 src\u002Flib.rs\n```\n\n### Step 5: Analyze Results\n\nReview the coverage report to identify:\n\n- **Uncovered code blocks**: Areas that may need better seed inputs or dictionary entries\n- **Magic value checks**: Conditional statements with hardcoded values that block progress\n- **Dead code**: Functions that may not be reachable through your harness\n- **Coverage changes**: Compare against baseline to track improvements or regressions\n\n## Common Patterns\n\n### Pattern: Identifying Magic Values\n\n**Problem**: Fuzzer cannot discover paths guarded by magic value checks.\n\n**Coverage reveals:**\n```cpp\n\u002F\u002F Coverage shows this block is never executed\nif (buf == 0x7F454C46) {  \u002F\u002F ELF magic number\n    \u002F\u002F start parsing buf\n}\n```\n\n**Solution**: Add magic values to dictionary file:\n```\n# magic.dict\n\"\\x7F\\x45\\x4C\\x46\"\n```\n\n### Pattern: Handling Crashing Inputs\n\n**Problem**: Coverage generation fails when corpus contains crashing inputs.\n\n**Before:**\n```bash\n.\u002Ffuzz_exec corpus\u002F  # Crashes on bad input, no coverage generated\n```\n\n**After:**\n```cpp\n\u002F\u002F Fork before executing to isolate crashes\nint main(int argc, char **argv) {\n    \u002F\u002F ... directory opening code ...\n\n    while ((entry = readdir(dir)) != NULL) {\n        if (entry->d_type == DT_REG) {\n            pid_t pid = fork();\n            if (pid == 0) {\n                \u002F\u002F Child process - crash won't affect parent\n                char filepath[1024];\n                snprintf(filepath, sizeof(filepath), \"%s\u002F%s\", argv[1], entry->d_name);\n                load_file_and_test(filepath);\n                exit(0);\n            } else {\n                \u002F\u002F Parent waits for child\n                waitpid(pid, NULL, 0);\n            }\n        }\n    }\n}\n```\n\n### Pattern: CMake Integration\n\n**Use Case**: Adding coverage builds to CMake projects.\n\n```cmake\nproject(FuzzingProject)\ncmake_minimum_required(VERSION 3.0)\n\n# Main binary\nadd_executable(program main.cc)\n\n# Fuzzing binary\nadd_executable(fuzz main.cc harness.cc)\ntarget_compile_definitions(fuzz PRIVATE NO_MAIN=1)\ntarget_compile_options(fuzz PRIVATE -g -O2 -fsanitize=fuzzer)\ntarget_link_libraries(fuzz -fsanitize=fuzzer)\n\n# Coverage execution binary\nadd_executable(fuzz_exec main.cc harness.cc execute-rt.cc)\ntarget_compile_definitions(fuzz_exec PRIVATE NO_MAIN)\ntarget_compile_options(fuzz_exec PRIVATE -O2 -fprofile-instr-generate -fcoverage-mapping)\ntarget_link_libraries(fuzz_exec -fprofile-instr-generate)\n```\n\nBuild:\n```bash\ncmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .\ncmake --build . --target fuzz_exec\n```\n\n## Advanced Usage\n\n### Tips and Tricks\n\n| Tip | Why It Helps |\n|-----|--------------|\n| Use LLVM 18+ with `-show-directory-coverage` | Organizes large reports by directory structure instead of flat file list |\n| Export to lcov format for better HTML | `llvm-cov export -format=lcov` + `genhtml` provides cleaner per-file reports |\n| Compare coverage across campaigns | Store `.profdata` files with timestamps to track progress over time |\n| Filter harness code from reports | Use `-ignore-filename-regex` to focus on SUT coverage only |\n| Automate coverage in CI\u002FCD | Generate coverage reports automatically after scheduled fuzzing runs |\n| Use gcovr 5.1+ for Clang 14+ | Older gcovr versions have compatibility issues with recent LLVM |\n\n### Incremental Coverage Updates\n\nGCC's gcov instrumentation incrementally updates `.gcda` files across multiple runs. This is useful for tracking coverage as you add test cases:\n\n```bash\n# First run\n.\u002Ffuzz_exec_gcov corpus_batch_1\u002F\ngcovr --html coverage_v1.html\n\n# Second run (adds to existing coverage)\n.\u002Ffuzz_exec_gcov corpus_batch_2\u002F\ngcovr --html coverage_v2.html\n\n# Start fresh\ngcovr --delete  # Remove .gcda files\n.\u002Ffuzz_exec_gcov corpus\u002F\n```\n\n### Handling Large Codebases\n\nFor projects with hundreds of source files:\n\n1. **Filter by prefix**: Only generate reports for relevant directories\n   ```bash\n   llvm-cov show .\u002Ffuzz_exec -instr-profile=fuzz.profdata \u002Fpath\u002Fto\u002Fsrc\u002F\n   ```\n\n2. **Use directory coverage**: Group by directory to reduce clutter (LLVM 18+)\n   ```bash\n   llvm-cov show -show-directory-coverage -format=html -output-dir html\u002F\n   ```\n\n3. **Generate JSON for programmatic analysis**:\n   ```bash\n   llvm-cov export -format=lcov > coverage.json\n   ```\n\n### Differential Coverage\n\nCompare coverage between two fuzzing campaigns:\n\n```bash\n# Campaign 1\nLLVM_PROFILE_FILE=campaign1.profraw .\u002Ffuzz_exec corpus1\u002F\nllvm-profdata merge -sparse campaign1.profraw -o campaign1.profdata\n\n# Campaign 2\nLLVM_PROFILE_FILE=campaign2.profraw .\u002Ffuzz_exec corpus2\u002F\nllvm-profdata merge -sparse campaign2.profraw -o campaign2.profdata\n\n# Compare\nllvm-cov show .\u002Ffuzz_exec \\\n  -instr-profile=campaign2.profdata \\\n  -instr-profile=campaign1.profdata \\\n  -show-line-counts-or-regions\n```\n\n## Anti-Patterns\n\n| Anti-Pattern | Problem | Correct Approach |\n|--------------|---------|------------------|\n| Using fuzzer-reported coverage for comparisons | Different fuzzers calculate coverage differently, making cross-tool comparison meaningless | Use dedicated coverage tools (llvm-cov, gcovr) for reproducible measurements |\n| Generating coverage with optimizations | `-O3` optimizations can eliminate code, making coverage misleading | Use `-O2` or `-O0` for coverage builds |\n| Not filtering harness code | Harness coverage inflates numbers and obscures SUT coverage | Use `-ignore-filename-regex` or `--exclude` to filter harness files |\n| Mixing LLVM and GCC instrumentation | Incompatible formats cause parsing failures | Stick to one toolchain for coverage builds |\n| Ignoring crashing inputs | Crashes prevent coverage generation, hiding real coverage data | Fix crashes first, or use process forking to isolate them |\n| Not tracking coverage over time | One-time coverage checks miss regressions and improvements | Store coverage data with timestamps and track trends |\n\n## Tool-Specific Guidance\n\n### libFuzzer\n\nlibFuzzer uses LLVM's SanitizerCoverage by default for guiding fuzzing, but you need separate instrumentation for generating reports.\n\n**Build for coverage:**\n```bash\nclang++ -fprofile-instr-generate -fcoverage-mapping \\\n  -O2 -DNO_MAIN \\\n  main.cc harness.cc execute-rt.cc -o fuzz_exec\n```\n\n**Execute corpus and generate report:**\n```bash\nLLVM_PROFILE_FILE=fuzz.profraw .\u002Ffuzz_exec corpus\u002F\nllvm-profdata merge -sparse fuzz.profraw -o fuzz.profdata\nllvm-cov show .\u002Ffuzz_exec -instr-profile=fuzz.profdata -format=html -output-dir html\u002F\n```\n\n**Integration tips:**\n- Don't use `-fsanitize=fuzzer` for coverage builds (it conflicts with profile instrumentation)\n- Reuse the same harness function (`LLVMFuzzerTestOneInput`) with a different main function\n- Use the `-ignore-filename-regex` flag to exclude harness code from coverage reports\n- Consider using llvm-cov's `-show-instantiation` flag for template-heavy C++ code\n\n### AFL++\n\nAFL++ provides its own coverage feedback mechanism, but for detailed reports use standard LLVM\u002FGCC tools.\n\n**Build for coverage with LLVM:**\n```bash\nclang++ -fprofile-instr-generate -fcoverage-mapping \\\n  -O2 main.cc harness.cc execute-rt.cc -o fuzz_exec\n```\n\n**Build for coverage with GCC:**\n```bash\nAFL_USE_ASAN=0 afl-gcc -ftest-coverage -fprofile-arcs \\\n  main.cc harness.cc execute-rt.cc -o fuzz_exec_gcov\n```\n\n**Execute and generate report:**\n```bash\n# LLVM approach\nLLVM_PROFILE_FILE=fuzz.profraw .\u002Ffuzz_exec afl_output\u002Fqueue\u002F\nllvm-profdata merge -sparse fuzz.profraw -o fuzz.profdata\nllvm-cov report .\u002Ffuzz_exec -instr-profile=fuzz.profdata\n\n# GCC approach\n.\u002Ffuzz_exec_gcov afl_output\u002Fqueue\u002F\ngcovr --html-details -o coverage.html\n```\n\n**Integration tips:**\n- Don't use AFL++'s instrumentation (`afl-clang-fast`) for coverage builds\n- Use standard compilers with coverage flags instead\n- AFL++'s `queue\u002F` directory contains your corpus\n- AFL++'s built-in coverage statistics are useful for real-time monitoring but not for detailed analysis\n\n### cargo-fuzz (Rust)\n\ncargo-fuzz provides built-in coverage generation using LLVM tools.\n\n**Install prerequisites:**\n```bash\nrustup toolchain install nightly --component llvm-tools-preview\ncargo install cargo-binutils rustfilt\n```\n\n**Generate coverage data:**\n```bash\ncargo +nightly fuzz coverage fuzz_target_1\n```\n\n**Create HTML report script:**\n```bash\ncat \u003C\u003C'EOF' > .\u002Fgenerate_html\n#!\u002Fbin\u002Fsh\nFUZZ_TARGET=\"$1\"\nshift\nSRC_FILTER=\"$@\"\nTARGET=$(rustc -vV | sed -n 's|host: ||p')\ncargo +nightly cov -- show -Xdemangler=rustfilt \\\n  \"target\u002F$TARGET\u002Fcoverage\u002F$TARGET\u002Frelease\u002F$FUZZ_TARGET\" \\\n  -instr-profile=\"fuzz\u002Fcoverage\u002F$FUZZ_TARGET\u002Fcoverage.profdata\" \\\n  -show-line-counts-or-regions -show-instantiations \\\n  -format=html -o fuzz_html\u002F $SRC_FILTER\nEOF\nchmod +x .\u002Fgenerate_html\n```\n\n**Generate report:**\n```bash\n.\u002Fgenerate_html fuzz_target_1 src\u002Flib.rs\n```\n\n**Integration tips:**\n- Always use the nightly toolchain for coverage\n- The `-Xdemangler=rustfilt` flag makes function names readable\n- Filter by source files (e.g., `src\u002Flib.rs`) to focus on crate code\n- Use `-show-line-counts-or-regions` and `-show-instantiations` for better Rust-specific output\n- Corpus is located in `fuzz\u002Fcorpus\u002F\u003Ctarget>\u002F`\n\n### honggfuzz\n\nhonggfuzz works with standard LLVM\u002FGCC coverage instrumentation.\n\n**Build for coverage:**\n```bash\n# Use standard compiler, not honggfuzz compiler\nclang -fprofile-instr-generate -fcoverage-mapping \\\n  -O2 harness.c execute-rt.c -o fuzz_exec\n```\n\n**Execute corpus:**\n```bash\nLLVM_PROFILE_FILE=fuzz.profraw .\u002Ffuzz_exec honggfuzz_workspace\u002F\n```\n\n**Integration tips:**\n- Don't use `hfuzz-clang` for coverage builds\n- honggfuzz corpus is typically in a workspace directory\n- Use the same LLVM workflow as libFuzzer\n\n## Troubleshooting\n\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| `error: no profile data available` | Profile wasn't generated or wrong path | Verify `LLVM_PROFILE_FILE` was set and `.profraw` file exists |\n| `Failed to load coverage` | Mismatch between binary and profile data | Rebuild binary with same flags used during execution |\n| Coverage reports show 0% | Wrong binary used for report generation | Use the instrumented binary, not the fuzzing binary |\n| `no_working_dir_found` error (gcovr) | `.gcda` files in unexpected location | Add `--gcov-ignore-errors=no_working_dir_found` flag |\n| Crashes prevent coverage generation | Corpus contains crashing inputs | Filter crashes or use forking approach to isolate failures |\n| Coverage decreases after harness change | Harness now skips certain code paths | Review harness logic; may need to support more input formats |\n| HTML report is flat file list | Using older LLVM version | Upgrade to LLVM 18+ and use `-show-directory-coverage` |\n| `incompatible instrumentation` | Mixing LLVM and GCC coverage | Rebuild everything with same toolchain |\n\n## Related Skills\n\n### Tools That Use This Technique\n\n| Skill | How It Applies |\n|-------|----------------|\n| **libfuzzer** | Uses SanitizerCoverage for feedback; coverage analysis evaluates harness effectiveness |\n| **aflpp** | Uses edge coverage for feedback; detailed analysis requires separate instrumentation |\n| **cargo-fuzz** | Built-in `cargo fuzz coverage` command for Rust projects |\n| **honggfuzz** | Uses edge coverage; analyze with standard LLVM\u002FGCC tools |\n\n### Related Techniques\n\n| Skill | Relationship |\n|-------|--------------|\n| **fuzz-harness-writing** | Coverage reveals which code paths harness reaches; guides harness improvements |\n| **fuzzing-dictionaries** | Coverage identifies magic value checks that need dictionary entries |\n| **corpus-management** | Coverage analysis helps curate corpora by identifying redundant test cases |\n| **sanitizers** | Coverage helps verify sanitizer-instrumented code is actually executed |\n\n## Resources\n\n### Key External Resources\n\n**[LLVM Source-Based Code Coverage](https:\u002F\u002Fclang.llvm.org\u002Fdocs\u002FSourceBasedCodeCoverage.html)**\nComprehensive guide to LLVM's profile instrumentation, including advanced features like branch coverage, region coverage, and integration with existing build systems. Covers compiler flags, runtime behavior, and profile data formats.\n\n**[llvm-cov Command Guide](https:\u002F\u002Fllvm.org\u002Fdocs\u002FCommandGuide\u002Fllvm-cov.html)**\nDetailed CLI reference for llvm-cov commands including `show`, `report`, and `export`. Documents all filtering options, output formats, and integration with llvm-profdata.\n\n**[gcovr Documentation](https:\u002F\u002Fgcovr.com\u002F)**\nComplete guide to gcovr tool for generating coverage reports from gcov data. Covers HTML themes, filtering options, multi-directory projects, and CI\u002FCD integration patterns.\n\n**[SanitizerCoverage Documentation](https:\u002F\u002Fclang.llvm.org\u002Fdocs\u002FSanitizerCoverage.html)**\nLow-level documentation for LLVM's SanitizerCoverage instrumentation. Explains inline 8-bit counters, PC tables, and how fuzzers use coverage feedback for guidance.\n\n**[On the Evaluation of Fuzzer Performance](https:\u002F\u002Farxiv.org\u002Fabs\u002F1808.09700)**\nResearch paper examining limitations of coverage as a fuzzing performance metric. Argues for more nuanced evaluation methods beyond simple code coverage percentages.\n\n### Video Resources\n\nNot applicable - coverage analysis is primarily a tooling and workflow topic best learned through documentation and hands-on practice.\n","# Coverage Analysis\n\nCoverage analysis is essential for understanding which parts of your code are exercised during fuzzing. It helps identify fuzzing blockers like magic value checks and tracks the effectiveness of harness improvements over time.\n\n## Overview\n\nCode coverage during fuzzing serves two critical purposes:\n\n1. **Assessing harness effectiveness**: Understand which parts of your application are actually executed by your fuzzing harnesses\n2. **Tracking fuzzing progress**: Monitor how coverage changes when updating harnesses, fuzzers, or the system under test (SUT)\n\nCoverage is a proxy for fuzzer capability and performance. While coverage [is not ideal for measuring fuzzer performance](https:\u002F\u002Farxiv.org\u002Fabs\u002F1808.09700) in absolute terms, it reliably indicates whether your harness works effectively in a given setup.\n\n### Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| **Coverage instrumentation** | Compiler flags that track which code paths are executed |\n| **Corpus coverage** | Coverage achieved by running all test cases in a fuzzing corpus |\n| **Magic value checks** | Hard-to-discover conditional checks that block fuzzer progress |\n| **Coverage-guided fuzzing** | Fuzzing strategy that prioritizes inputs that discover new code paths |\n| **Coverage report** | Visual or textual representation of executed vs. unexecuted code |\n\n## When to Apply\n\n**Apply this technique when:**\n- Starting a new fuzzing campaign to establish a baseline\n- Fuzzer appears to plateau without finding new paths\n- After harness modifications to verify improvements\n- When migrating between different fuzzers\n- Identifying areas requiring dictionary entries or seed inputs\n- Debugging why certain code paths aren't reached\n\n**Skip this technique when:**\n- Fuzzing campaign is actively finding crashes\n- Coverage infrastructure isn't set up yet\n- Working with extremely large codebases where full coverage reports are impractical\n- Fuzzer's internal coverage metrics are sufficient for your needs\n\n## Quick Reference\n\n| Task | Command\u002FPattern |\n|------|-----------------|\n| LLVM coverage instrumentation (C\u002FC++) | `-fprofile-instr-generate -fcoverage-mapping` |\n| GCC coverage instrumentation | `-ftest-coverage -fprofile-arcs` |\n| cargo-fuzz coverage (Rust) | `cargo +nightly fuzz coverage \u003Ctarget>` |\n| Generate LLVM profile data | `llvm-profdata merge -sparse file.profraw -o file.profdata` |\n| LLVM coverage report | `llvm-cov report .\u002Fbinary -instr-profile=file.profdata` |\n| LLVM HTML report | `llvm-cov show .\u002Fbinary -instr-profile=file.profdata -format=html -output-dir html\u002F` |\n| gcovr HTML report | `gcovr --html-details -o coverage.html` |\n\n## Ideal Coverage Workflow\n\nThe following workflow represents best practices for integrating coverage analysis into your fuzzing campaigns:\n\n```\n[Fuzzing Campaign]\n       |\n       v\n[Generate Corpus]\n       |\n       v\n[Coverage Analysis]\n       |\n       +---> Coverage Increased? --> Continue fuzzing with larger corpus\n       |\n       +---> Coverage Decreased? --> Fix harness or investigate SUT changes\n       |\n       +---> Coverage Plateaued? --> Add dictionary entries or seed inputs\n```\n\n**Key principle**: Use the corpus generated *after* each fuzzing campaign to calculate coverage, rather than real-time fuzzer statistics. This approach provides reproducible, comparable measurements across different fuzzing tools.\n\n## Step-by-Step\n\n### Step 1: Build with Coverage Instrumentation\n\nChoose your instrumentation method based on toolchain:\n\n**LLVM\u002FClang (C\u002FC++):**\n```bash\nclang++ -fprofile-instr-generate -fcoverage-mapping \\\n  -O2 -DNO_MAIN \\\n  main.cc harness.cc execute-rt.cc -o fuzz_exec\n```\n\n**GCC (C\u002FC++):**\n```bash\ng++ -ftest-coverage -fprofile-arcs \\\n  -O2 -DNO_MAIN \\\n  main.cc harness.cc execute-rt.cc -o fuzz_exec_gcov\n```\n\n**Rust:**\n```bash\nrustup toolchain install nightly --component llvm-tools-preview\ncargo +nightly fuzz coverage fuzz_target_1\n```\n\n### Step 2: Create Execution Runtime (C\u002FC++ only)\n\nFor C\u002FC++ projects, create a runtime that executes your corpus:\n\n```cpp\n\u002F\u002F execute-rt.cc\n#include \u003Cstdio.h>\n#include \u003Cstdlib.h>\n#include \u003Cdirent.h>\n#include \u003Cstdint.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);\n\nvoid load_file_and_test(const char *filename) {\n    FILE *file = fopen(filename, \"rb\");\n    if (file == NULL) {\n        printf(\"Failed to open file: %s\\n\", filename);\n        return;\n    }\n\n    fseek(file, 0, SEEK_END);\n    long filesize = ftell(file);\n    rewind(file);\n\n    uint8_t *buffer = (uint8_t*) malloc(filesize);\n    if (buffer == NULL) {\n        printf(\"Failed to allocate memory for file: %s\\n\", filename);\n        fclose(file);\n        return;\n    }\n\n    long read_size = (long) fread(buffer, 1, filesize, file);\n    if (read_size != filesize) {\n        printf(\"Failed to read file: %s\\n\", filename);\n        free(buffer);\n        fclose(file);\n        return;\n    }\n\n    LLVMFuzzerTestOneInput(buffer, filesize);\n\n    free(buffer);\n    fclose(file);\n}\n\nint main(int argc, char **argv) {\n    if (argc != 2) {\n        printf(\"Usage: %s \u003Cdirectory>\\n\", argv[0]);\n        return 1;\n    }\n\n    DIR *dir = opendir(argv[1]);\n    if (dir == NULL) {\n        printf(\"Failed to open directory: %s\\n\", argv[1]);\n        return 1;\n    }\n\n    struct dirent *entry;\n    while ((entry = readdir(dir)) != NULL) {\n        if (entry->d_type == DT_REG) {\n            char filepath[1024];\n            snprintf(filepath, sizeof(filepath), \"%s\u002F%s\", argv[1], entry->d_name);\n            load_file_and_test(filepath);\n        }\n    }\n\n    closedir(dir);\n    return 0;\n}\n```\n\n### Step 3: Execute on Corpus\n\n**LLVM (C\u002FC++):**\n```bash\nLLVM_PROFILE_FILE=fuzz.profraw .\u002Ffuzz_exec corpus\u002F\n```\n\n**GCC (C\u002FC++):**\n```bash\n.\u002Ffuzz_exec_gcov corpus\u002F\n```\n\n**Rust:**\nCoverage data is automatically generated when running `cargo fuzz coverage`.\n\n### Step 4: Process Coverage Data\n\n**LLVM:**\n```bash\n# Merge raw profile data\nllvm-profdata merge -sparse fuzz.profraw -o fuzz.profdata\n\n# Generate text report\nllvm-cov report .\u002Ffuzz_exec \\\n  -instr-profile=fuzz.profdata \\\n  -ignore-filename-regex='harness.cc|execute-rt.cc'\n\n# Generate HTML report\nllvm-cov show .\u002Ffuzz_exec \\\n  -instr-profile=fuzz.profdata \\\n  -ignore-filename-regex='harness.cc|execute-rt.cc' \\\n  -format=html -output-dir fuzz_html\u002F\n```\n\n**GCC with gcovr:**\n```bash\n# Install gcovr (via pip for latest version)\npython3 -m venv venv\nsource venv\u002Fbin\u002Factivate\npip3 install gcovr\n\n# Generate report\ngcovr --gcov-executable \"llvm-cov gcov\" \\\n  --exclude harness.cc --exclude execute-rt.cc \\\n  --root . --html-details -o coverage.html\n```\n\n**Rust:**\n```bash\n# Install required tools\ncargo install cargo-binutils rustfilt\n\n# Create HTML generation script\ncat \u003C\u003C'EOF' > .\u002Fgenerate_html\n#!\u002Fbin\u002Fsh\nif [ $# -lt 1 ]; then\n    echo \"Error: Name of fuzz target is required.\"\n    echo \"Usage: $0 fuzz_target [sources...]\"\n    exit 1\nfi\nFUZZ_TARGET=\"$1\"\nshift\nSRC_FILTER=\"$@\"\nTARGET=$(rustc -vV | sed -n 's|host: ||p')\ncargo +nightly cov -- show -Xdemangler=rustfilt \\\n  \"target\u002F$TARGET\u002Fcoverage\u002F$TARGET\u002Frelease\u002F$FUZZ_TARGET\" \\\n  -instr-profile=\"fuzz\u002Fcoverage\u002F$FUZZ_TARGET\u002Fcoverage.profdata\" \\\n  -show-line-counts-or-regions -show-instantiations \\\n  -format=html -o fuzz_html\u002F $SRC_FILTER\nEOF\nchmod +x .\u002Fgenerate_html\n\n# Generate HTML report\n.\u002Fgenerate_html fuzz_target_1 src\u002Flib.rs\n```\n\n### Step 5: Analyze Results\n\nReview the coverage report to identify:\n\n- **Uncovered code blocks**: Areas that may need better seed inputs or dictionary entries\n- **Magic value checks**: Conditional statements with hardcoded values that block progress\n- **Dead code**: Functions that may not be reachable through your harness\n- **Coverage changes**: Compare against baseline to track improvements or regressions\n\n## Common Patterns\n\n### Pattern: Identifying Magic Values\n\n**Problem**: Fuzzer cannot discover paths guarded by magic value checks.\n\n**Coverage reveals:**\n```cpp\n\u002F\u002F Coverage shows this block is never executed\nif (buf == 0x7F454C46) {  \u002F\u002F ELF magic number\n    \u002F\u002F start parsing buf\n}\n```\n\n**Solution**: Add magic values to dictionary file:\n```\n# magic.dict\n\"\\x7F\\x45\\x4C\\x46\"\n```\n\n### Pattern: Handling Crashing Inputs\n\n**Problem**: Coverage generation fails when corpus contains crashing inputs.\n\n**Before:**\n```bash\n.\u002Ffuzz_exec corpus\u002F  # Crashes on bad input, no coverage generated\n```\n\n**After:**\n```cpp\n\u002F\u002F Fork before executing to isolate crashes\nint main(int argc, char **argv) {\n    \u002F\u002F ... directory opening code ...\n\n    while ((entry = readdir(dir)) != NULL) {\n        if (entry->d_type == DT_REG) {\n            pid_t pid = fork();\n            if (pid == 0) {\n                \u002F\u002F Child process - crash won't affect parent\n                char filepath[1024];\n                snprintf(filepath, sizeof(filepath), \"%s\u002F%s\", argv[1], entry->d_name);\n                load_file_and_test(filepath);\n                exit(0);\n            } else {\n                \u002F\u002F Parent waits for child\n                waitpid(pid, NULL, 0);\n            }\n        }\n    }\n}\n```\n\n### Pattern: CMake Integration\n\n**Use Case**: Adding coverage builds to CMake projects.\n\n```cmake\nproject(FuzzingProject)\ncmake_minimum_required(VERSION 3.0)\n\n# Main binary\nadd_executable(program main.cc)\n\n# Fuzzing binary\nadd_executable(fuzz main.cc harness.cc)\ntarget_compile_definitions(fuzz PRIVATE NO_MAIN=1)\ntarget_compile_options(fuzz PRIVATE -g -O2 -fsanitize=fuzzer)\ntarget_link_libraries(fuzz -fsanitize=fuzzer)\n\n# Coverage execution binary\nadd_executable(fuzz_exec main.cc harness.cc execute-rt.cc)\ntarget_compile_definitions(fuzz_exec PRIVATE NO_MAIN)\ntarget_compile_options(fuzz_exec PRIVATE -O2 -fprofile-instr-generate -fcoverage-mapping)\ntarget_link_libraries(fuzz_exec -fprofile-instr-generate)\n```\n\nBuild:\n```bash\ncmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .\ncmake --build . --target fuzz_exec\n```\n\n## Advanced Usage\n\n### Tips and Tricks\n\n| Tip | Why It Helps |\n|-----|--------------|\n| Use LLVM 18+ with `-show-directory-coverage` | Organizes large reports by directory structure instead of flat file list |\n| Export to lcov format for better HTML | `llvm-cov export -format=lcov` + `genhtml` provides cleaner per-file reports |\n| Compare coverage across campaigns | Store `.profdata` files with timestamps to track progress over time |\n| Filter harness code from reports | Use `-ignore-filename-regex` to focus on SUT coverage only |\n| Automate coverage in CI\u002FCD | Generate coverage reports automatically after scheduled fuzzing runs |\n| Use gcovr 5.1+ for Clang 14+ | Older gcovr versions have compatibility issues with recent LLVM |\n\n### Incremental Coverage Updates\n\nGCC's gcov instrumentation incrementally updates `.gcda` files across multiple runs. This is useful for tracking coverage as you add test cases:\n\n```bash\n# First run\n.\u002Ffuzz_exec_gcov corpus_batch_1\u002F\ngcovr --html coverage_v1.html\n\n# Second run (adds to existing coverage)\n.\u002Ffuzz_exec_gcov corpus_batch_2\u002F\ngcovr --html coverage_v2.html\n\n# Start fresh\ngcovr --delete  # Remove .gcda files\n.\u002Ffuzz_exec_gcov corpus\u002F\n```\n\n### Handling Large Codebases\n\nFor projects with hundreds of source files:\n\n1. **Filter by prefix**: Only generate reports for relevant directories\n   ```bash\n   llvm-cov show .\u002Ffuzz_exec -instr-profile=fuzz.profdata \u002Fpath\u002Fto\u002Fsrc\u002F\n   ```\n\n2. **Use directory coverage**: Group by directory to reduce clutter (LLVM 18+)\n   ```bash\n   llvm-cov show -show-directory-coverage -format=html -output-dir html\u002F\n   ```\n\n3. **Generate JSON for programmatic analysis**:\n   ```bash\n   llvm-cov export -format=lcov > coverage.json\n   ```\n\n### Differential Coverage\n\nCompare coverage between two fuzzing campaigns:\n\n```bash\n# Campaign 1\nLLVM_PROFILE_FILE=campaign1.profraw .\u002Ffuzz_exec corpus1\u002F\nllvm-profdata merge -sparse campaign1.profraw -o campaign1.profdata\n\n# Campaign 2\nLLVM_PROFILE_FILE=campaign2.profraw .\u002Ffuzz_exec corpus2\u002F\nllvm-profdata merge -sparse campaign2.profraw -o campaign2.profdata\n\n# Compare\nllvm-cov show .\u002Ffuzz_exec \\\n  -instr-profile=campaign2.profdata \\\n  -instr-profile=campaign1.profdata \\\n  -show-line-counts-or-regions\n```\n\n## Anti-Patterns\n\n| Anti-Pattern | Problem | Correct Approach |\n|--------------|---------|------------------|\n| Using fuzzer-reported coverage for comparisons | Different fuzzers calculate coverage differently, making cross-tool comparison meaningless | Use dedicated coverage tools (llvm-cov, gcovr) for reproducible measurements |\n| Generating coverage with optimizations | `-O3` optimizations can eliminate code, making coverage misleading | Use `-O2` or `-O0` for coverage builds |\n| Not filtering harness code | Harness coverage inflates numbers and obscures SUT coverage | Use `-ignore-filename-regex` or `--exclude` to filter harness files |\n| Mixing LLVM and GCC instrumentation | Incompatible formats cause parsing failures | Stick to one toolchain for coverage builds |\n| Ignoring crashing inputs | Crashes prevent coverage generation, hiding real coverage data | Fix crashes first, or use process forking to isolate them |\n| Not tracking coverage over time | One-time coverage checks miss regressions and improvements | Store coverage data with timestamps and track trends |\n\n## Tool-Specific Guidance\n\n### libFuzzer\n\nlibFuzzer uses LLVM's SanitizerCoverage by default for guiding fuzzing, but you need separate instrumentation for generating reports.\n\n**Build for coverage:**\n```bash\nclang++ -fprofile-instr-generate -fcoverage-mapping \\\n  -O2 -DNO_MAIN \\\n  main.cc harness.cc execute-rt.cc -o fuzz_exec\n```\n\n**Execute corpus and generate report:**\n```bash\nLLVM_PROFILE_FILE=fuzz.profraw .\u002Ffuzz_exec corpus\u002F\nllvm-profdata merge -sparse fuzz.profraw -o fuzz.profdata\nllvm-cov show .\u002Ffuzz_exec -instr-profile=fuzz.profdata -format=html -output-dir html\u002F\n```\n\n**Integration tips:**\n- Don't use `-fsanitize=fuzzer` for coverage builds (it conflicts with profile instrumentation)\n- Reuse the same harness function (`LLVMFuzzerTestOneInput`) with a different main function\n- Use the `-ignore-filename-regex` flag to exclude harness code from coverage reports\n- Consider using llvm-cov's `-show-instantiation` flag for template-heavy C++ code\n\n### AFL++\n\nAFL++ provides its own coverage feedback mechanism, but for detailed reports use standard LLVM\u002FGCC tools.\n\n**Build for coverage with LLVM:**\n```bash\nclang++ -fprofile-instr-generate -fcoverage-mapping \\\n  -O2 main.cc harness.cc execute-rt.cc -o fuzz_exec\n```\n\n**Build for coverage with GCC:**\n```bash\nAFL_USE_ASAN=0 afl-gcc -ftest-coverage -fprofile-arcs \\\n  main.cc harness.cc execute-rt.cc -o fuzz_exec_gcov\n```\n\n**Execute and generate report:**\n```bash\n# LLVM approach\nLLVM_PROFILE_FILE=fuzz.profraw .\u002Ffuzz_exec afl_output\u002Fqueue\u002F\nllvm-profdata merge -sparse fuzz.profraw -o fuzz.profdata\nllvm-cov report .\u002Ffuzz_exec -instr-profile=fuzz.profdata\n\n# GCC approach\n.\u002Ffuzz_exec_gcov afl_output\u002Fqueue\u002F\ngcovr --html-details -o coverage.html\n```\n\n**Integration tips:**\n- Don't use AFL++'s instrumentation (`afl-clang-fast`) for coverage builds\n- Use standard compilers with coverage flags instead\n- AFL++'s `queue\u002F` directory contains your corpus\n- AFL++'s built-in coverage statistics are useful for real-time monitoring but not for detailed analysis\n\n### cargo-fuzz (Rust)\n\ncargo-fuzz provides built-in coverage generation using LLVM tools.\n\n**Install prerequisites:**\n```bash\nrustup toolchain install nightly --component llvm-tools-preview\ncargo install cargo-binutils rustfilt\n```\n\n**Generate coverage data:**\n```bash\ncargo +nightly fuzz coverage fuzz_target_1\n```\n\n**Create HTML report script:**\n```bash\ncat \u003C\u003C'EOF' > .\u002Fgenerate_html\n#!\u002Fbin\u002Fsh\nFUZZ_TARGET=\"$1\"\nshift\nSRC_FILTER=\"$@\"\nTARGET=$(rustc -vV | sed -n 's|host: ||p')\ncargo +nightly cov -- show -Xdemangler=rustfilt \\\n  \"target\u002F$TARGET\u002Fcoverage\u002F$TARGET\u002Frelease\u002F$FUZZ_TARGET\" \\\n  -instr-profile=\"fuzz\u002Fcoverage\u002F$FUZZ_TARGET\u002Fcoverage.profdata\" \\\n  -show-line-counts-or-regions -show-instantiations \\\n  -format=html -o fuzz_html\u002F $SRC_FILTER\nEOF\nchmod +x .\u002Fgenerate_html\n```\n\n**Generate report:**\n```bash\n.\u002Fgenerate_html fuzz_target_1 src\u002Flib.rs\n```\n\n**Integration tips:**\n- Always use the nightly toolchain for coverage\n- The `-Xdemangler=rustfilt` flag makes function names readable\n- Filter by source files (e.g., `src\u002Flib.rs`) to focus on crate code\n- Use `-show-line-counts-or-regions` and `-show-instantiations` for better Rust-specific output\n- Corpus is located in `fuzz\u002Fcorpus\u002F\u003Ctarget>\u002F`\n\n### honggfuzz\n\nhonggfuzz works with standard LLVM\u002FGCC coverage instrumentation.\n\n**Build for coverage:**\n```bash\n# Use standard compiler, not honggfuzz compiler\nclang -fprofile-instr-generate -fcoverage-mapping \\\n  -O2 harness.c execute-rt.c -o fuzz_exec\n```\n\n**Execute corpus:**\n```bash\nLLVM_PROFILE_FILE=fuzz.profraw .\u002Ffuzz_exec honggfuzz_workspace\u002F\n```\n\n**Integration tips:**\n- Don't use `hfuzz-clang` for coverage builds\n- honggfuzz corpus is typically in a workspace directory\n- Use the same LLVM workflow as libFuzzer\n\n## Troubleshooting\n\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| `error: no profile data available` | Profile wasn't generated or wrong path | Verify `LLVM_PROFILE_FILE` was set and `.profraw` file exists |\n| `Failed to load coverage` | Mismatch between binary and profile data | Rebuild binary with same flags used during execution |\n| Coverage reports show 0% | Wrong binary used for report generation | Use the instrumented binary, not the fuzzing binary |\n| `no_working_dir_found` error (gcovr) | `.gcda` files in unexpected location | Add `--gcov-ignore-errors=no_working_dir_found` flag |\n| Crashes prevent coverage generation | Corpus contains crashing inputs | Filter crashes or use forking approach to isolate failures |\n| Coverage decreases after harness change | Harness now skips certain code paths | Review harness logic; may need to support more input formats |\n| HTML report is flat file list | Using older LLVM version | Upgrade to LLVM 18+ and use `-show-directory-coverage` |\n| `incompatible instrumentation` | Mixing LLVM and GCC coverage | Rebuild everything with same toolchain |\n\n## Related Skills\n\n### Tools That Use This Technique\n\n| Skill | How It Applies |\n|-------|----------------|\n| **libfuzzer** | Uses SanitizerCoverage for feedback; coverage analysis evaluates harness effectiveness |\n| **aflpp** | Uses edge coverage for feedback; detailed analysis requires separate instrumentation |\n| **cargo-fuzz** | Built-in `cargo fuzz coverage` command for Rust projects |\n| **honggfuzz** | Uses edge coverage; analyze with standard LLVM\u002FGCC tools |\n\n### Related Techniques\n\n| Skill | Relationship |\n|-------|--------------|\n| **fuzz-harness-writing** | Coverage reveals which code paths harness reaches; guides harness improvements |\n| **fuzzing-dictionaries** | Coverage identifies magic value checks that need dictionary entries |\n| **corpus-management** | Coverage analysis helps curate corpora by identifying redundant test cases |\n| **sanitizers** | Coverage helps verify sanitizer-instrumented code is actually executed |\n\n## Resources\n\n### Key External Resources\n\n**[LLVM Source-Based Code Coverage](https:\u002F\u002Fclang.llvm.org\u002Fdocs\u002FSourceBasedCodeCoverage.html)**\nComprehensive guide to LLVM's profile instrumentation, including advanced features like branch coverage, region coverage, and integration with existing build systems. Covers compiler flags, runtime behavior, and profile data formats.\n\n**[llvm-cov Command Guide](https:\u002F\u002Fllvm.org\u002Fdocs\u002FCommandGuide\u002Fllvm-cov.html)**\nDetailed CLI reference for llvm-cov commands including `show`, `report`, and `export`. Documents all filtering options, output formats, and integration with llvm-profdata.\n\n**[gcovr Documentation](https:\u002F\u002Fgcovr.com\u002F)**\nComplete guide to gcovr tool for generating coverage reports from gcov data. Covers HTML themes, filtering options, multi-directory projects, and CI\u002FCD integration patterns.\n\n**[SanitizerCoverage Documentation](https:\u002F\u002Fclang.llvm.org\u002Fdocs\u002FSanitizerCoverage.html)**\nLow-level documentation for LLVM's SanitizerCoverage instrumentation. Explains inline 8-bit counters, PC tables, and how fuzzers use coverage feedback for guidance.\n\n**[On the Evaluation of Fuzzer Performance](https:\u002F\u002Farxiv.org\u002Fabs\u002F1808.09700)**\nResearch paper examining limitations of coverage as a fuzzing performance metric. Argues for more nuanced evaluation methods beyond simple code coverage percentages.\n\n### Video Resources\n\nNot applicable - coverage analysis is primarily a tooling and workflow topic best learned through documentation and hands-on practice.\n",{"name":5,"type":23,"description":7},"technique","main","f37de8f681f0c0ca0e0ebab6e5fddf764ca7553d","skills\u002Fcoverage-analysis",1,"https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one","https:\u002F\u002Fagisota.github.io\u002Fold-one\u002F","https:\u002F\u002Fgithub.com\u002Fagisota","pzd.world","2026-07-04 22:32:06",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add agisota\u002Fold-one --skill coverage-analysis",{"tool":39,"command":40},"bunx","bunx skills add agisota\u002Fold-one --skill coverage-analysis",{"tool":42,"command":43},"pnpm","pnpm dlx skills add agisota\u002Fold-one --skill coverage-analysis","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fcoverage-analysis\u002FSKILL.md",true,[],[48,55,62,71,78,85],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":18},"01M75KRGZWQWE9JDBS6RX42NWV","zoom-out","Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-out\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":18},"01M75KRCZHKE0ZYAQFFYHS0YNP","zeroize-audit","Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C\u002FC++\u002FRust code handling secrets, keys, passwords, or other sensitive data.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzeroize-audit\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":66,"licenseFileUrl":67,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":18},"01M75KR94KYQ30DTE1P9WNDAE0","yeet","Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":18},"01M75KR3H13YJ9QHMD49818FA1","yara-rule-authoring","Guides authoring of high-quality YARA-X detection rules for malware identification. Use when writing, reviewing, or optimizing YARA rules. Covers naming conventions, string selection, performance optimization, migration from legacy YARA, and false positive reduction. Triggers on: YARA, YARA-X, malware detection, threat hunting, IOC, signature, crx module, dex module.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyara-rule-authoring\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M75KQMPY8A4Y8XTDD2DT0M9T","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-twitter-growth\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":18},"01M75KQHNZ0ANZNJGZY6M8MDAK","x-api","X\u002FTwitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-api\u002FSKILL.md",[],[]]