Hi Søren

Let me share the idea of "global evaluate" implementation.

Use case 1:
Some web application is open in Chrome browser. Programmer wishes to inspect
a value of some global variable without any JavaScript code actually running
(e.g. his web-page has only one function, and this function will trigger
drawbridge opening over the river Neva).
Debugger should allow checking a global variable.

Use case 2:
Some application occasionally employs some user scripting. Programmer wishes
to call GetEmbedderConfiguration() function and inspect an object it returns
with its properties and subproperties. Making application run actual user
script is a long non-automated routine, that has to be done manually.
Debugger should allow calling any global function.

Use case 3 (optional):
Some application support several V8 contexts. While application is idle,
programmer wishes to check initial data in all contexts.
When application is idle, debugger should give access to all contexts
(because we cannot explicitly choose a particular one).


Here's my approach.
When application is idle (or simply V8 is not called) programmer presses
"suspend" button. "Suspend" debug command arrives to V8 and embedder calls
v8::Debug::ProcessDebugMessages().  V8 suspends and send back "suspended"
event. In this situation V8 is suspended, but there are no frames. Everybody
is cool about this. Debugger application (e.g. Eclipse) sees that we are
suspended and evaluates required expressions. V8 is can correctly evaluate
expressions, because it is suspended and therefore all data is static and
may be inspected.

I have tried to implement this, it seems to require quite a few simple
modifications.

Embedder is responsible for choosing a context to
call v8::Debug::ProcessDebugMessages(). For use case #3 I would suggest that
embedder creates an auxiliary context, that keeps references to all user
contexts. This way programmer will be able to inspect all contexts in this
manner:
expression1 = "this.rybin_context.GetConfiguration()"
expression2 = "this.apavlov_context.window"

I'm going to complete/submit this in a near future.
Do you think this may sound reasonable?

Peter
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to