Skip to content

CLI Reference

Hugo edited this page Sep 25, 2026 · 1 revision

CLI Reference

runtime-analyzer [options] -- <compiler args>

Arguments before -- belong to runtime-analyzer. Arguments after -- are forwarded to coretrace-compiler and then to Clang.

Option Effect
-o, --output <path> Instrumented binary path when the compiler args do not set one (default runtime-analyzer.out)
--run-arg <value> Argument passed to the instrumented binary. Repeatable.
--env NAME=VALUE Environment variable passed to the instrumented binary. Repeatable.
--cwd <path> Working directory used when running the binary
--test-dir <path> Run every C/C++ source file under a test directory (batch mode)
--output-dir <path> Artifact directory used by --test-dir (default runtime-analyzer-artifacts)
--strict-test-exit Make batch mode fail when any test binary exits non-zero
--no-run Compile only, without executing the binary
--show-output Print the captured stdout/stderr after the summary
--show-events Print the collected CoreTrace event lines
-h, --help Show the help

--instrument is accepted after -- but ignored: instrumentation is enabled through the library API, not through the flag.

Examples

# Build and run, choosing the modules
runtime-analyzer -o ./app -- --ct-modules=trace,alloc,bounds main.c

# Show the event lines, not just the counters
runtime-analyzer --show-events -- main.c

# Give the program arguments and an environment
runtime-analyzer --run-arg input.txt --env CT_LOG_LEVEL=info -- main.c

# Compile only
runtime-analyzer --no-run -- main.c

Batch mode

runtime-analyzer --test-dir test --output-dir /tmp/runtime-analyzer-tests -- --ct-modules=all

--test-dir <path> runs every .c, .cc, .cpp and .cxx source under the directory. Each source is compiled and executed as a separate instrumented binary, which is what avoids linker collisions between test files that each define main.

Arguments after -- are the shared compiler and CoreTrace flags for every test file.

Batch mode keeps going after runtime failures and reports them at the end; it separates compile failures from runtime failures in its result. Add --strict-test-exit when a non-zero test binary exit should make the analyzer itself return a non-zero exit code — by default it does not, because some runtime tests abort on purpose.

Clone this wiki locally