Ok, I'm a bit ashamed of my self ...
I've finally found all my answers here :
https://code.google.com/p/v8/wiki/AddDebuggerSupport
and of course in the lineprocessor sample.

So here so correct code :

Isolate* isolate = null;
Persistent<Context> debug_message_context;

void DispatchDebugMessages() {
Context::Scope scope(debug_message_context);

Debug::ProcessDebugMessages();
}

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR 
lpCmdLine, int nCmdShow) {
Isolate* isolate = Isolate::GetCurrent();
HandleScope handle_scope(isolate);

Handle<String> script_source = String::New("'Hello, ' + 'world!'");
Handle<String> script_name = String::New("");

Handle<Context> context = Context::New();
/* The Locker bellow seems to exit the context when its destructor is 
called. 
So I don't use a Context::Scope that basically enter the context and exit 
the context during its destructor.
Instead I just enter the context. 
*/
// Context::Scope context_scope(context);
context->Enter();

debug_message_context = Persistent<Context>::New(isolate, context);
Locker locker(isolate);
Debug::SetDebugMessageDispatchHandler(DispatchDebugMessages, true);
Debug::EnableAgent("testDebuggee", 5858, true);

Handle<Script> script = Script::Compile(script_source, script_name);
script->Run();

return 0;
}

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to