0xPolygonMiden / examples

Examples of using Polygon Miden
MIT License
18 stars 18 forks source link

Add Debug for the Miden Assembly Playground #68

Closed Dominik1999 closed 1 year ago

Dominik1999 commented 1 year ago

We need to add a function to Debug to the playground. The Button is already there.

We can use the simple assembler debugger here https://github.com/0xPolygonMiden/miden-vm/pull/693.

However, we need to wrap it into a function to call something like

     pub fn debug_program(masm_code: &str, inputs_frontend: &str, command: &str) -> Vec<u64> {
     ...
    }

Where command is !next, !play, !prev, !print.

We will not be able to support all commands at the beginning.


We can simply call execute_iter() in here https://github.com/0xPolygonMiden/miden-vm/blob/360b5b080b79b9d66e912e2eb286a5237a261eb2/processor/src/lib.rs#L118-L138

Then we have a VmStateIterator object on which we can call various debugging commands, see https://github.com/0xPolygonMiden/miden-vm/blob/360b5b080b79b9d66e912e2eb286a5237a261eb2/processor/src/debug.rs#L128

The challenging question will be how the VmStateIterator can be stored in the state of the browser.

Dominik1999 commented 1 year ago

closed by #79