Skip to content

Public API

Hugo edited this page Sep 25, 2026 · 1 revision

Public API

include/runtime_analyzer.hpp, namespace coretrace::runtime_analyzer.

[[nodiscard]] AnalyzerResult Run(const AnalyzerOptions& options);
[[nodiscard]] BatchResult    RunBatch(const AnalyzerOptions& options);
[[nodiscard]] int            Main(int argc, char** argv);

Run is a single compile-and-execute; RunBatch is the --test-dir mode; Main is the CLI entry point, exposed so the tool can be driven from another binary.

AnalyzerOptions

Field Default Meaning
compiler_args — Forwarded to coretrace-compiler, then Clang
program_args — Arguments for the instrumented binary (--run-arg)
environment — NAME=VALUE entries for the run (--env)
test_directories — Batch mode roots (--test-dir)
output_path runtime-analyzer.out Instrumented binary path
output_directory runtime-analyzer-artifacts Batch artifact directory
working_directory — Working directory for the run (--cwd)
explicit_output_path false Whether output_path was set explicitly
run_program true false is --no-run
show_program_output false --show-output
show_events false --show-events
strict_test_exit false --strict-test-exit

AnalyzerResult

Field Meaning
success The whole operation succeeded
compile_success The instrumented binary was built
executed The binary was run
exit_code Exit code of the instrumented binary
output_path Where the binary was written
diagnostics Compiler and analyzer diagnostics
stdout_text, stderr_text Captured output
coretrace_events The collected CoreTrace lines
summary The CollectionSummary counters

compile_success and executed are separate from success, so a caller can tell failed to build from built and the program failed — which matters when the program is expected to abort.

CollectionSummary

coretrace_lines, entry_events, exit_events, allocation_events, bounds_errors, leak_reports, vtable_events, warnings, errors — all std::uint64_t. What each one counts is in Event Collection.

BatchResult

Carries tests (one TestFileResult per source, each with its own AnalyzerResult), an accumulated summary, and compile_failures / runtime_failures counted separately.

Consumer example

extern-project/ in the repository shows a minimal CMake consumer.

Clone this wiki locally