You feed in JSON debug commands[0] with v8::Debug::SendCommand().
It's safe to call from another thread; the main thread will interrupt
currently executing JS code in order to process the debug command.
If the main thread spends most of its time in native code, then call
v8::Debug::ProcessDebugMessages() periodically to flush queued
commands.
Everything else, like creating a listen socket and managing
connections from debugger clients, is up to the embedder. The wire
representation of the debug protocol looks a lot like HTTP, but with
the notable differences that:
1. There is no status or request line, and
2. The server (the process being debugged) sends headers first. They
look like this:
Type: connect
V8-Version: 3.26.33
Protocol-Version: 1
Embedding-Host: node v0.13.0-pre
Content-Length: 0
It should be noted that V8's native debugger protocol is being phased
out in favor of Chromium's remote debugger protocol; for a longer-term
solution, that's probably what you want to be looking at.
Hope that helps!
[0]
https://code.google.com/p/v8/wiki/DebuggerProtocol
[1]
https://developer.chrome.com/devtools/docs/debugger-protocol