nand2tetris / web-ide

A web-based IDE for https://nand2tetris.org
https://nand2tetris.github.io/web-ide
Other
85 stars 22 forks source link

[feature]: Add breakpoints for VM and CPU emulators #441

Open happytomatoe opened 2 months ago

happytomatoe commented 2 months ago

Tool

General

Interface

None

Contact Details

No response

What feature are you proposing?

Hi! First of all thanks for this product. Is there a table that compares the features between desktop and web version? Why I am asking - I've just finished writing vm translator and some portion of the time I've spent on debugging. I totally forgot that desktop version has breakpoints. That would make the process a little bit easier. I didn't see any mentions about breakpoints for web ide. Is this feature available in web version?

Additional Comments

No response

Do you want to try to add this feature?

Code of Conduct

DavidSouther commented 2 months ago

The current goal is "feature parity", so this would be a thing we've missed in the current IDE and should consider implementing or explicitly marking as unsupported. I'm going to update this issue to track breakpoints; if you notice other discrepancies, please let us know.

@netalondon @Shimon-Schocken please comment on where we should prioritize adding debugger breakpoints for VM and CPU Emulators?

happytomatoe commented 2 months ago

@DavidSouther @netalondon How to pause a runner from inside vm.ts? I.E. in the case if the current running operation has a breakpoint

happytomatoe commented 2 months ago

The same applies to CPU emulator

netalondon commented 2 months ago

@happytomatoe If I understand you correctly, you can emulate this behavior by immediately returning from the step function here https://github.com/nand2tetris/web-ide/blob/main/simulator/src/vm/vm.ts#L634. You can see this is what we do if the OS is blocked, for example when waiting for user input.

Should be pretty similar for the CPU.

Let me know if that answers your question.