On Tue, Nov 16, 2010 at 22:03, mcot <[email protected]> wrote:

> Thanks for your response... that clears a lot of things up.  I just
> have a few more questions about what you said.
>
> >There are following ways of getting into a break: setting a
> >breakpoint, adding "debugger" statement to your script, scheduling an
> >ASAP break with DebugBreak call. The main thing here is to make sure
> >that you get called on V8 breaking. You should experiment with various
> >event callbacks and message handlers from v8-debug.h.
>
> Do you happen to know what state the Virtual Machine (is this the
> right word for it) is in when you call into C++ code from JavaScript
> code?  If you call a DebugBreak from C++ (while inside a call from JS)
> it seems like it should wait for the C++ code to finish, return
> control to V8 and then execute the break. I am wondering if that is
> the issue I was having here and if this actually works like that.
>
> That is correct, JavaScript debugging will only "work" inside JavaScript
code. When the debug break flag is set (by calling v8::Debug::DebugBreak())
the debugger callback will happen while executing JavaScript code. If the
debug break flag is raised while inside C++ code nothing will happen until
"real" JavaScript code start executing again.

When inside C++ you have the option of using the API v8::Debug::Call to call
a JavaScript function in the context of the debugger thereby running
JavaScript code with all the abilities of the debugger. The function called
is passed an ExecutionState object. You will have to look inside the file
src/debug-debugger.js to see which methods are available on an
ExecutionState.

There is no C++ debugger API, the internals of the debugger is written
mostly in JavaScript and most ways to interact with it works best from
JavaScript, but using the API you can do the same from C++ - it is just more
tedious. The message based API allows interaction through JSON messages.

Regarding the mirror objects they do not survive across debug breaks, so for
each break the id's assigned to the mirrors will restart from 1.

Regards,
Søren


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

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

Reply via email to