Skip to content

feat: enable println via trace#54

Open
mooori wants to merge 5 commits intonextfrom
mooori/print-via-trace
Open

feat: enable println via trace#54
mooori wants to merge 5 commits intonextfrom
mooori/print-via-trace

Conversation

@mooori
Copy link
Copy Markdown
Contributor

@mooori mooori commented Apr 13, 2026

  • Adds support for println-style output via a new TRACE_PRINT_LN trace event, with decoding of [address, length] from the VM stack and reading the corresponding UTF-8 bytes from memory.
  • Refactors trace handling so callbacks receive full ProcessorState instead of just the cycle, which lets the host capture trace events and read string-bytes from memory.
  • Persists printed output through the executor and ExecutionTrace, exposing it as printed_lines() keyed by cycle.
  • Extracts reusable memory-byte helpers and updates existing memory reads to use them.

Companion PR in the compiler: 1077

Panics vs propagating errors

In the first pass I went with panicking early instead of propagating errors because:

  • It's simpler and the compiler is setting up println
  • Glancing at surrounding code I saw panics instead of errors too

Though this PR might take panicking too far - let me know what you think.

@mooori mooori force-pushed the mooori/print-via-trace branch from 04d416d to 64a4332 Compare April 15, 2026 12:31
Comment thread Cargo.toml
name = "miden-debug"
description = "An interactive debugger for Miden VM programs"
version = "0.5.0"
version = "0.6.1"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary fix to make this branch work in the compiler repo.

This is needed as the version on next is behind the released version (0.6.1). Probably main still needs to be merged into next after the latest release.

@mooori
Copy link
Copy Markdown
Contributor Author

mooori commented Apr 15, 2026

This does not yet handle displaying printed lines. So far it only makes them available programmatically (example).

Marking it as ready for review because I would like to:

  • Get the internals (this PR) done first.
  • Get aligned on how to present printed lines in the UI before working on it. Especially since I'm not yet familiar with the internals of the different UI modes.

@mooori mooori marked this pull request as ready for review April 15, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant