line-execution-checker

gadievron's avatarfrom gadievron

Check if specific lines were executed using gcov data

⭐916stars🔀109forks📁View on GitHub🕐Updated Dec 26, 2025

When & Why to Use This Skill

The Line Execution Checker is a specialized Claude skill designed to streamline code coverage analysis using gcov data. It enables developers to instantly verify whether specific lines of source code were executed during test runs, providing a lightweight and efficient alternative to generating full coverage reports. This tool is essential for C/C++ developers looking to ensure high-quality testing and precise code path validation.

Use Cases

  • Unit Test Validation: Quickly confirm if specific logic branches, such as complex conditional statements or error-handling blocks, were actually triggered during a test run.
  • Bug Fix Verification: Ensure that a newly implemented fix or a specific code path is exercised by the test suite to prevent regressions.
  • Targeted Coverage Auditing: Check the execution status of critical lines in large codebases without the overhead of processing entire project coverage data.
  • CI/CD Integration: Use as a gatekeeper in automated pipelines to fail builds if mandatory code paths (e.g., security checks) are not reached during testing.
nameLine Execution Checker
descriptionCheck if specific lines were executed using gcov data
version1.0
authorClaude

Line Execution Checker

Purpose

Fast tool to check if specific source lines were executed during test runs.

Tool: line-checker

Build

g++ -O3 -std=c++17 line_checker.cpp -o line-checker

Usage

# Single line
./line-checker file.c:42

# Multiple lines
./line-checker file.c:42 main.c:100 util.c:55

Output

file.c:42 EXECUTED (5 times)
main.c:100 NOT EXECUTED
util.c:55 EXECUTED (12 times)

Exit Codes

  • 0: All lines executed
  • 1: One or more lines NOT executed
  • 2: Error

Prerequisites

Coverage data must exist from prior test run with --coverage flag.

When User Asks

"Was line X of file.c executed?" or "Check if these lines were covered"

Steps

  1. Verify .gcda files exist: find . -name "*.gcda" -print -quit
  2. Build tool if needed: g++ -O3 -std=c++17 line_checker.cpp -o line-checker
  3. Run: ./line-checker file.c:X
  4. Report result to user

Example Interaction

User: "Was line 127 in parser.c executed?"

./line-checker parser.c:127
# Output: parser.c:127 EXECUTED (3 times)

Response: "Yes, line 127 was executed 3 times during testing."