본문으로 건너뛰기
cccskills
무료GitHub에 공개

Code Coverage with gcov

Add gcov code coverage instrumentation to C/C++ projects

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md3.4 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Code Coverage with gcov

Purpose

Instrument C/C++ programs with gcov to measure test coverage.

Containment

The instrumented project is untrusted — its build scripts and the produced binary execute arbitrary code, and the .gcda/.gcno files that binary emits are untrusted bytes parsed by gcov/gcovr. Run every build, target-binary/test-suite execution, and gcov/gcovr invocation via libexec/raptor-run-sandboxed --output-dir <dir> <cmd> [args...] (--output-dir = the directory the command writes into). If a sandboxed step fails, fix the sandboxed invocation — never run the target's build system, binary, or the coverage extraction bare.

How It Works

Build with Coverage (sandboxed)

libexec/raptor-run-sandboxed --output-dir <project-dir> gcc --coverage -o program source.c

Run Program (sandboxed)

libexec/raptor-run-sandboxed --output-dir <project-dir> <project-dir>/program
# Creates .gcda files with execution data

Generate Reports

Text report (sandboxed — gcov parses the untrusted .gcda/.gcno bytes):

libexec/raptor-run-sandboxed --output-dir <project-dir> gcov source.c
# Creates source.c.gcov with line-by-line coverage

HTML report (sandboxed):

libexec/raptor-run-sandboxed --output-dir <project-dir> gcovr --html-details -o coverage.html

Coverage Flags

  • --coverage (shorthand for -fprofile-arcs -ftest-coverage -lgcov)
  • Add to both CFLAGS and LDFLAGS

Build System Integration

Makefile

ENABLE_COVERAGE ?= 0
ifeq ($(ENABLE_COVERAGE),1)
    CFLAGS += --coverage
    LDFLAGS += --coverage
endif

CMake

option(ENABLE_COVERAGE "Enable coverage" OFF)
if(ENABLE_COVERAGE)
    add_compile_options(--coverage)
    add_link_options(--coverage)
endif()

When User Requests Coverage

Steps

All build/run/report commands below go through libexec/raptor-run-sandboxed --output-dir <project-dir> ... (every make target — clean included — executes the untrusted Makefile's commands; rm -f *.gcda *.gcno is your own command and needs no wrapper):

  1. Detect build system (Makefile/CMake/other)
  2. Add --coverage to CFLAGS and LDFLAGS
  3. Clean previous build: libexec/raptor-run-sandboxed --output-dir <project-dir> make clean (or bare rm -f *.gcda *.gcno)
  4. Build with coverage: libexec/raptor-run-sandboxed --output-dir <project-dir> make ENABLE_COVERAGE=1 (or the cmake -DENABLE_COVERAGE=ON + build equivalent, same wrapper)
  5. Run tests: libexec/raptor-run-sandboxed --output-dir <project-dir> make test (or the project's test binary, same wrapper)
  6. Generate report: libexec/raptor-run-sandboxed --output-dir <project-dir> gcovr --html-details coverage.html --print-summary
  7. Present summary and path to HTML report

Output

Text (.gcov files):

        -:    0:Source:main.c
        5:   42:    int x = 10;
    #####:   43:    unused_code();
  • 5: = executed 5 times
  • #####: = not executed
  • -: = non-executable

HTML: Interactive report with color-coded coverage

Metrics

  • Line coverage: Executed lines / total lines
  • Branch coverage: Taken branches / total branches
  • Function coverage: Called functions / total functions

Target: 80%+ line coverage, 70%+ branch coverage

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

audit

무료

Hypothesis-driven, tool-grounded security review of coverage gaps

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

gadievron/raptor3.9천2026년 10월 19일 업데이트

Provides adversarial code comprehension for security research, mapping architecture, tracing data flows, and hunting vulnerability variants to build ground-truth understanding before or alongside static analysis.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

gadievron/raptor3.9천2026년 10월 19일 업데이트

Multi-stage pipeline for validating that vulnerability findings are real, reachable, and exploitable, preventing wasted effort on hallucinated findings, dead code paths, or findings with unrealistic preconditions.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

gadievron/raptor3.9천2026년 10월 19일 업데이트

frida

무료

Dynamic instrumentation via Frida - attach to or spawn a process, load a JS hook script, capture send() events into a lifecycle-managed run directory. Supports local, USB-attached, and remote frida-server targets.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

gadievron/raptor3.9천2026년 10월 19일 업데이트

Instrument C/C++ with -finstrument-functions for execution tracing and Perfetto visualisation

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

gadievron/raptor3.9천2026년 10월 19일 업데이트

Investigate GitHub security incidents using tamper-proof GitHub Archive data via BigQuery. Use when verifying repository activity claims, recovering deleted PRs/branches/tags/repos, attributing actions to actors, or reconstructing attack timelines. Provides immutable forensic evidence of all public GitHub events since 2011.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

gadievron/raptor3.9천2026년 10월 19일 업데이트

gadievron의 스킬 모두 보기

이 스킬의 문제 신고