All posts


Posted On The PoC

I quickly came up with a small PoC that run inside a terminal, the way it work is: Take a code snippet, write it to a temporary folder, spawn a new node process with --inspect-brk parameter to put it in debugging mode, then connect to it via a library called chrome-remote-interface, it can do some debugging command like step in, step out,…

This PoC helped me understand the protocol better and able to figure out what I could build from it.

At the very beginning, I had to deal with a poorly documented protocol with lots of hidden behavior, takes a lot of time to figure out what’s going on and how to get over them.

For example, calling Debugger.pause doesn’t immediatelly pause the debugger, but the method has a callback so it seems confusing, I thought we can handle the pause event in that callback. Turned out, we need to handle Debugger.paused event in order to do so.

Stuff like Debugger.stepIn also need to be executed when the debugger is paused.

So I scoped out what’s the next version look like:

  • A small debugger that can execute any code snipped input from the user
  • The call stack is limited to the scope of current code, that mean, all call frames that belongs to Node.js internal will be step over.
  • There will be a watch list where you can see the values on current call frame.