TOPLLab / WARDuino

📟 A dynamic WebAssembly VM for embedded systems
https://topllab.github.io/WARDuino/
Mozilla Public License 2.0
72 stars 7 forks source link

Add async snapshot interrupt #236

Closed MaartenS11 closed 3 months ago

MaartenS11 commented 3 months ago

This PR adds a debugger interrupt that allows the VM to send a snapshot before every instruction it executes. This is useful for time travelling debuggers because it allows taking snapshots without pausing the VM.

The interrupt currently has number 61 associated with it (can be changed of course), I just noticed there was an empty spot right after snapshot. With 6101 you can enable tracing mode basically and with 6100 you can disable it again.

The DUMP! message printed before every snapshot is also removed, I did this to make it easier to add snapshot data to an existing line for example SNAPSHOT {"pc": ... which is the format used for this new interrupt. This format makes it easy to identify async snapshots. I just hope that DUMP! is not used by the plugin. The DUMP! message is also not mentioned in the documentation, it only mentions the json data which is unchanged so I assume that this will be fine.

One thing I noticed while preparing this PR, it appears we have 2 interpret functions now? The one in instructions.cpp can probably be removed?