Samsung / escargot

Escargot is a lightweight JavaScript engine designed specifically for resource-constrained environments.
GNU Lesser General Public License v2.1
269 stars 43 forks source link

Advanced debugger features #606

Open zherczeg opened 4 years ago

zherczeg commented 4 years ago

I think the core debugger features are completed. The list of these features follows:

Breakpoint management:

Execution control:

Other features:

Could you tell us what other features do you need? I can share some ideas. These ideas requires shell support (environment outside of Escargot engine), so porting them to other environments require some effort.

Source sending feature: instead of executing a js file, the shell enters to a "wait for source code" mode. After the debugger sends the source code, the shell executes it. This is useful for trying JS code without flashing it onto a device, and also useful for demonstration purposes.

Restarting feature: allow the debugger to restart the JavaScript code. This is a difficult feature (for the environment, not for the debugger), since the current execution must be aborted, all resources must be freed, and a new Escargot instance must be created.

Debug log support: most environments have a "print" or "console.log" native function, which displays some text. However, if the device has no screen, this output can be lost. Sending this output to the debugger is useful in this case, since it can also display this output.

clover2123 commented 4 years ago

Thank you very much for your wonderful contribution:)

Yes, we definitely have to support environment outside of Escargot engine. All your ideas looks great!

BTW I have some questions/requests as follows.

zherczeg commented 4 years ago

Hi,

clover2123 commented 4 years ago
zherczeg commented 4 years ago

Regarding on/off the debugger: the debugger can work silently. If no breakpoints are set, and no stop command is issued, the program just runs. So the IDE can simulate attach / detach / attach again events by temporariliy enabling and disabling breakpoints.

Regarding errors: am I understand correctly, that we just need to notify users, but does not need to do any actions? Sending this data is not difficult.

clover2123 commented 4 years ago

I missed that "quit" option was already added Regarding errors: yes, just notify the users.

"finish" option looks similar to "until" option in gdb. Is this also one of essential features in JS debugger?

zherczeg commented 4 years ago

"finish" is a command in gdb, and VSCode debugger has a "step-out" command which is the same: https://sourceware.org/gdb/onlinedocs/gdb/Continuing-and-Stepping.html https://code.visualstudio.com/docs/editor/debugging#_debug-actions

I don't think this is essential, so if you want it I can close #618 .

zherczeg commented 4 years ago

Btw the VSCode command mapping will look like this (left VSCode, right Escargot debugger):

Continue / Pause - ESCARGOT_MESSAGE_CONTINUE / ESCARGOT_MESSAGE_STEP Step Over - ESCARGOT_MESSAGE_NEXT Step Into - ESCARGOT_MESSAGE_STEP Step Out - ESCARGOT_MESSAGE_FINISH Restart - not implemented yet Stop - closing socket

clover2123 commented 4 years ago

Thanks for your detailed explanation. It seems that we should add "finish" command to support "Step out" in VSCode.