When the VM runs with the DRUINKSCRIPT_DEBUGGER flag defined, then when it runs a script, it'll wait for a debugger to connect to it. I'll change this later, so it's optional (somehow).
The debugger, when attached gets notified when a function runs (Which will be immediately after connecting, and any subsequent times), and the debugger can then request symbols (The compiled script file, essentially) from the VM. The debugger will cache these, so the whole script, list of strings and functions and so on don't need to be sent each time a function from that script is run.
This part isn't implemented yet, but it's just a braindump for what will happen:
From then on, the debugger will run its own local version of the script alongside the script. When a breakpoint is set, the script notifies the debugger, and it also notes the position of it locally. When a breakpoint is hit (Single stepping just sets an implicit breakpoint on the next instruction), the script notifies the debugger, and then blocks, waiting for permission to continue execution. The debugger at this stage can send the script information about changed registers, stack variables, etc.
I'm not sure if I'll do edit and continue, or "skipping" of instructions yet, but it should be pretty easy to do the latter.
That's about it for now I suppose. I'm hungry. Lunch time...