> I'm creating JavaScript debugger that uses Chrome/V8 as a runtime. > > The question I have - is it possible to have V8 wait for debugger > connection on start? So it is paused on start and does not execute any > JS until the debugger connects, sets the breakpoints, gives resume > command?
Yes. There is at least one way. Use the recently added DebugMessageDispatchHandler: http://code.google.com/p/v8/source/browse/trunk/include/v8-debug.h?spec=svn3342&r=3333#219 You'll have to do the idling yourself - have the main loop sit in select() listening on a pipe, for example. The DebugMessageDispatchHandler will be called from the debugger thread - so if using select() you could write something to the pipe and the select() will wake up the main thread. At that point you can execute an arbitrary bit of javascript and handle the message. An example of this can be seen in here: http://github.com/ry/node/blob/0433d828cffaaf1a6a69a8ba175a172ae1af0f11/src/node.cc#L846-873 http://github.com/ry/node/blob/0433d828cffaaf1a6a69a8ba175a172ae1af0f11/src/node.cc#L608-625 --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
