diff --git a/cairo-vm-cli/src/main.rs b/cairo-vm-cli/src/main.rs index 0c06c7af44..67ab541c55 100644 --- a/cairo-vm-cli/src/main.rs +++ b/cairo-vm-cli/src/main.rs @@ -3,18 +3,18 @@ use bincode::enc::write::Writer; use cairo_vm::cairo_run::{self, EncodeTraceError}; use cairo_vm::hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor; -#[cfg(feature = "tracer")] +#[cfg(feature = "with_tracer")] use cairo_vm::serde::deserialize_program::DebugInfo; use cairo_vm::vm::errors::cairo_run_errors::CairoRunError; use cairo_vm::vm::errors::trace_errors::TraceError; use cairo_vm::vm::errors::vm_errors::VirtualMachineError; -#[cfg(feature = "tracer")] +#[cfg(feature = "with_tracer")] use cairo_vm::vm::runners::cairo_runner::CairoRunner; -#[cfg(feature = "tracer")] +#[cfg(feature = "with_tracer")] use cairo_vm::vm::vm_core::VirtualMachine; -#[cfg(feature = "tracer")] +#[cfg(feature = "with_tracer")] use cairo_vm_tracer::error::trace_data_errors::TraceDataError; -#[cfg(feature = "tracer")] +#[cfg(feature = "with_tracer")] use cairo_vm_tracer::tracer::run_tracer; use clap::{Parser, ValueHint}; use std::io::{self, Write}; @@ -47,8 +47,8 @@ struct Args { proof_mode: bool, #[structopt(long = "--secure_run")] secure_run: Option, - #[cfg(feature = "tracer")] #[structopt(long = "--tracer")] + #[cfg(feature = "with_tracer")] tracer: Option, } @@ -82,7 +82,7 @@ enum Error { #[error(transparent)] Trace(#[from] TraceError), #[error(transparent)] - #[cfg(feature = "tracer")] + #[cfg(feature = "with_tracer")] TraceDataErroe(#[from] TraceDataError), } @@ -119,7 +119,7 @@ impl FileWriter { } } -#[cfg(feature = "tracer")] +#[cfg(feature = "with_tracer")] fn start_tracer(cairo_runner: &CairoRunner, vm: &VirtualMachine) -> Result<(), TraceDataError> { let instruction_locations = cairo_runner .get_program() @@ -173,11 +173,6 @@ fn run(args: impl Iterator) -> Result<(), Error> { } }; - #[cfg(feature = "tracer")] - if args.tracer.is_some() && args.tracer.unwrap() { - start_tracer(&cairo_runner, &vm)?; - } - if args.print_output { let mut output_buffer = "Program Output:\n".to_string(); vm.write_output(&mut output_buffer)?; @@ -204,6 +199,11 @@ fn run(args: impl Iterator) -> Result<(), Error> { memory_writer.flush()?; } + #[cfg(feature = "with_tracer")] + if args.tracer.is_some() && args.tracer.unwrap() { + start_tracer(&cairo_runner, &vm)?; + } + Ok(()) } diff --git a/mem_sum b/mem_sum new file mode 100644 index 0000000000..9807db300f Binary files /dev/null and b/mem_sum differ diff --git a/trace_sum b/trace_sum new file mode 100644 index 0000000000..4ecb70ea46 Binary files /dev/null and b/trace_sum differ diff --git a/vm/src/vm/vm_core.rs b/vm/src/vm/vm_core.rs index fe83279437..121d36b927 100644 --- a/vm/src/vm/vm_core.rs +++ b/vm/src/vm/vm_core.rs @@ -911,7 +911,6 @@ impl VirtualMachine { } // TODO: add test cases - #[cfg(feature = "tracer")] pub fn get_relocation_table(&self) -> Result, MemoryError> { self.segments.relocate_segments() }