ワンクリックで
function-call-tracing
Instrument C/C++ with -finstrument-functions for execution tracing and Perfetto visualization
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Instrument C/C++ with -finstrument-functions for execution tracing and Perfetto visualization
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Add gcov code coverage instrumentation to C/C++ projects
Check if specific lines were executed using gcov data
Deterministic debugging with rr record-replay. Use when debugging crashes, ASAN faults, or when reverse execution is needed. Provides reverse-next, reverse-step, reverse-continue commands and crash trace extraction.
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.
Recover deleted commits from GitHub using REST API, web interface, and git fetch. Use when you have commit SHAs and need to retrieve actual commit content, diffs, or patches. Includes techniques for accessing "deleted" commits that remain on GitHub servers.
Generate, export, load, and verify forensic evidence from GitHub sources. Use when creating verifiable evidence objects from GitHub API, GH Archive, Wayback Machine, local git repositories, or security vendor reports. Handles evidence storage, querying, and re-verification against original sources.
| name | Function Call Tracing |
| description | Instrument C/C++ with -finstrument-functions for execution tracing and Perfetto visualization |
| version | 1 |
| author | Claude |
| tags | ["tracing","profiling","instrumentation","perfetto"] |
Trace all function calls in C/C++ programs with per-thread logs and Perfetto visualization.
Captures function entry/exit, writes per-thread logs.
Build:
gcc -c -fPIC trace_instrument.c -o trace_instrument.o
gcc -shared trace_instrument.o -o libtrace.so -ldl -lpthread
Converts logs to Chrome JSON for Perfetto UI.
Build:
g++ -O3 -std=c++17 trace_to_perfetto.cpp -o trace_to_perfetto
CFLAGS += -finstrument-functions -g
LDFLAGS += -L. -ltrace -ldl -lpthread
make
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
./program
# Creates trace_<tid>.log files
./trace_to_perfetto trace_*.log -o trace.json
# Open trace.json in ui.perfetto.dev
[seq] [timestamp] [dots] [ENTRY|EXIT!] function_name
[0] [1.000000000] [ENTRY] main
[1] [1.000050000] . [ENTRY] helper
[2] [1.000100000] . [EXIT!] helper
[3] [1.000150000] [EXIT!] main
trace_instrument.c and trace_to_perfetto.cpp to project-finstrument-functions to CFLAGS-L. -ltrace -ldl -lpthread to LDFLAGSLD_LIBRARY_PATH and run./trace_to_perfetto trace_*.log -o trace.jsonMakefile: Add flags conditionally
ENABLE_TRACE ?= 0
ifeq ($(ENABLE_TRACE),1)
CFLAGS += -finstrument-functions -g
LDFLAGS += -L. -ltrace -ldl -lpthread
endif
CMake: Add option
option(ENABLE_TRACE "Enable tracing" OFF)
if(ENABLE_TRACE)
add_compile_options(-finstrument-functions -g)
link_libraries(trace dl pthread)
endif()
Function ENTRY → "B" (begin) event Function EXIT! → "E" (end) event All threads aligned by timestamp in single file.