Skip to main content

miden_debug/repl/
mod.rs

1mod commands;
2pub(crate) mod engine;
3#[cfg(feature = "python")]
4mod python;
5mod script;
6mod session;
7
8use log::LevelFilter;
9use miden_assembly_syntax::diagnostics::{IntoDiagnostic, Report};
10
11pub use self::script::run_commands;
12use self::session::ReplSession;
13use crate::config::DebuggerConfig;
14
15/// Run the REPL debugger with the given configuration.
16pub fn run(config: Box<DebuggerConfig>, logger: Box<dyn log::Log>) -> Result<(), Report> {
17    run_with_log_level(config, logger, LevelFilter::Trace)
18}
19
20/// Run the REPL debugger with the given configuration and log level filter.
21pub fn run_with_log_level(
22    config: Box<DebuggerConfig>,
23    logger: Box<dyn log::Log>,
24    max_level: LevelFilter,
25) -> Result<(), Report> {
26    // Install the logger; propagate any failure as a diagnostic so the
27    // session doesn't silently start with a half-installed logger.
28    crate::logger::DebugLogger::install_with_max_level(logger, max_level).into_diagnostic()?;
29
30    let mut session = ReplSession::new(config)?;
31    session.run()
32}