Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
Fumuran committed Oct 13, 2023
1 parent 6b8176b commit c78ca65
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion processor/src/host/debug.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use super::{Felt, ProcessState};
use crate::{Vec, Word};
use vm_core::DebugOptions;
use vm_core::{
utils::string::{String, ToString},
DebugOptions,
};

// DEBUG HANDLER
// ================================================================================================
Expand Down Expand Up @@ -87,6 +90,7 @@ fn print_vm_stack(clk: u32, stack: Vec<Felt>, n: usize) {
}

/// Prints the whole memory state at the cycle `clk` in context `ctx`.
#[cfg(feature = "std")]
fn print_mem_all(clk: u32, ctx: u32, mem: Vec<(u64, Word)>) {
println!("Memory state before step {clk} for the context {ctx}:");

Expand Down Expand Up @@ -121,6 +125,7 @@ fn print_mem_all(clk: u32, ctx: u32, mem: Vec<(u64, Word)>) {
}

/// Prints the memory value stored at the requested address `addr`.
#[cfg(feature = "std")]
fn print_mem(clk: u32, ctx: u32, addr: u32, value: Option<Word>, local: bool) {
if local {
println!("Local state before step {} for the context {} at index {}:", clk, ctx, addr);
Expand All @@ -139,6 +144,7 @@ fn print_mem(clk: u32, ctx: u32, addr: u32, value: Option<Word>, local: bool) {
///
/// If `print_all` is true, the interval should contain all indexes of locals available for the
/// current procedure.
#[cfg(feature = "std")]
fn print_local_interval<S: ProcessState>(
process: &S,
clk: u32,
Expand Down Expand Up @@ -171,6 +177,7 @@ fn print_local_interval<S: ProcessState>(
///
/// `header` contains a title message corresponding to the DebugOption it is used in
/// ([DebugOptions::MemInterval] or [DebugOptions::LocalInterval]).
#[cfg(feature = "std")]
fn print_mem_interval(mem: Vec<(u32, Option<Word>)>, header: String) {
println!("{header}");

Expand Down

0 comments on commit c78ca65

Please sign in to comment.