Cairo Tracer
March 8, 2024 ยท View on GitHub
Cairo-vm offers a tracer which gives you a visualization of how your memory and registers change line after line as the VM executes the code.
Setting up the tracer
To use the tracer, you need to build your the VM using the with_tracer feature flag.
cargo build --release --features with_tracer
Running the tracer
Once the build in the above step is complete, you can use the cairo-vm-cli as you do normally with an additional argument --tracer true. This tells the VM to start a server where you can visualize the exection of your cairo program.
target/release/cairo-vm-cli <path_to_compiled_cairo_json> --layout <layout> --memory_file <path_to_store_memory_binary> --trace_file <path_to_store_tracer_binary> --tracer true
NOTE
The
--memory_fileand--trace_filearguments are compulsory at the moment as the current code relocates the memory and trace only when these arguments are supplied. However, edits can be made in future versions to relocate if only the--traceroption is specified.
Using the tracer

You can go to http://127.0.0.1:8100/static/index.html to see the tracer.
Use the following commands to visualize the code execution
sto go to the next stepShift + sto go to the previous stepnto step overNto previous step overoto step outbto run until you reach the next breakpointBto run until you reach the previous breakpoint