I agree that adding evaluation with breaks enabled is something that should work well. Instead of introducing another command how about any evaluate with breaks enabled does an implicit continue. This continue will run the evaluation expression, and the compiled code to the evaluation expression will have an implicit breakpoint added at the end. This means that we will return with a break event either when a breakpoint is hit due to the evaluation or due to the breakpoint at the end of the evaluation.
Regards, Søren On Thu, Jan 21, 2010 at 19:36, Peter Rybin <[email protected]> wrote: > Hi Søren > > I'm looking at evaluate with enabled breaks. I thinks this feature should > be ready in V8. I believe I also found how it can be implemented in Eclipse > UI (Eclipse does not expect breaks inside evaluate, but there are simple > workaround). > > I think there is one missing part in protocol here. > The protocol is based on V8 always reporting when its state changes: > running <-> suspended. On [running -> suspended] change it sends "break" > event. On [suspended -> running] it sends positive response to "continue" > command. > > I think we should expand this principle to evaluating with breakpoints. > When evaluation starts we need a formal notification about V8 changing its > state suspended -> running. As I understand, currently don't have this > formal notification. I can imitate it on my client side, but it is bad > because it is tricky (e.g. we have to change thread model in Eclipse plugin > for this mock event) and because all responses from V8 are asynchronous and > this imitation has chances to break the natural ordering of events. > > I think the best thing we should do is to introduce a new command > "start_complex_evaluate" (or whatever). The new command is good because its > scenario is quite different from common "evaluate" (difference: the scenario > is complex). > The command responses immediately, which should mean that V8 is now > running. When result is obtained (after number of break/continue events), > result is sent back in "complex_evaluate_result" event. This event also > reports that V8 is now again suspended. > > I think this should be solid way of supporting evaluate with breaks > feature. Alternatively we can just add a missing notification to existing > "evaluate" command, but this should be tricky because nobody knows what is > the default value of "disable_breaks" parameter. > > What do you think? > > Peter > > -- > v8-dev mailing list > [email protected] > http://groups.google.com/group/v8-dev > -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
