Skip to content

Commit

Permalink
feat(debugger): add an option to display columns
Browse files Browse the repository at this point in the history
  • Loading branch information
delehef committed Sep 22, 2023
1 parent b1fa879 commit 807fd44
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/exporters/debugger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ fn render_constraints(
} => {
let mut tty = Tty::new().with_guides();
pretty_expr(expr, None, &mut tty, show_types);
println!("\n- {}:", handle.pretty());
println!("\n{} :=", handle.pretty());
println!("{}", tty.page_feed());
}
Constraint::Plookup {
Expand Down Expand Up @@ -209,6 +209,17 @@ fn render_modules(cs: &ConstraintSet) {
}
}

fn render_constants(cs: &ConstraintSet) {
println!("\n{}", "=== Constants ===".bold().yellow());
for (name, value) in cs
.constants
.iter()
.sorted_by_key(|s| (&s.0.module, &s.0.name))
{
println!("{} := 0x{}", name.pretty(), value.to_str_radix(16));
}
}

fn render_columns(cs: &ConstraintSet) {
println!("\n{}", "=== Columns ===".bold().yellow());
for (r, col) in cs.columns.iter().sorted_by_key(|c| c.1.register) {
Expand Down Expand Up @@ -296,6 +307,7 @@ fn render_perspectives(cs: &ConstraintSet) {
pub(crate) struct DebugSettings {
pub modules: bool,
pub constraints: bool,
pub constants: bool,
pub columns: bool,
pub computations: bool,
pub perspectives: bool,
Expand All @@ -311,6 +323,9 @@ pub(crate) fn debug(
if settings.modules {
render_modules(cs);
}
if settings.constants {
render_constants(cs);
}
if settings.constraints {
render_constraints(cs, only, skip, settings.types);
}
Expand Down
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ enum Commands {
help = "show modules and their properties"
)]
show_modules: bool,
#[arg(short = 'n', long = "constants", help = "show constants")]
show_constants: bool,
#[arg(
short = 'C',
long = "columns",
Expand Down Expand Up @@ -721,6 +723,7 @@ fn main() -> Result<()> {
expand,
expand_all,
show_modules,
show_constants,
show_columns,
show_constraints,
show_computations,
Expand Down Expand Up @@ -760,6 +763,7 @@ fn main() -> Result<()> {
&constraints,
exporters::debugger::DebugSettings {
modules: show_modules,
constants: show_constants,
constraints: show_constraints,
columns: show_columns,
types: show_types,
Expand Down

0 comments on commit 807fd44

Please sign in to comment.