I've been thrown into a codebase that has embedded V8 and appears to be functioning (in terms of JavaScript execution) fine; however, I'm trying to enable debugging support and am seeing differing behaviors in D8 as compared to Eclipse and Palm Ares. I'm guessing it's related to how I've enabled the debugging, as D8 doesn't exhibit the same behavior when run against the LineProcessor sample.
In this codebase, we have multiple modules (DSO on Linux, .DLL in Win32, all linking dynamically to V8) running in our main process, each with their own thread which creates/manages/uses its own V8 Context and GlobalTemplate. All of them appropriately (from what I can tell) use v8::Lockers to synchronize V8 access. I am attempting to use v8::Debug::SetDebugMessageDispatchHandler(...) and v8::Debug::EnableAgent(...) in accordance with the "--main-cycle- in-cpp" and "--callback" implementation in the LineProcessor sample. Question 1: Should debugging JS in this scenario pose no problems? The behavior I'm seeing with D8 is that I cannot hit a breakpoint set on an expression outside of a function (e.g. global/file-scope stuff), and it can only resolve symbols against one context. Neither the Eclipse JS plugin nor Ares have these issues. Question 2: The LineProcessor sample only uses a single context, so its implementation of the handler for the debug message dispatch callback simply enters that context. The comments in the method mention that other action is required if more contexts are used (presumably to pick one so that "evaluate" works - is this correct?). How would one go about choosing the "correct" context? Question 3: Empirically, it seems that a Context must be entered prior to enabling the agent or setting the debug message dispatch handler. If that isn't done (i.e. you try to set up the debug support before any contexts are created), the "wait for connect" behavior of the agent doesn't seem to work. Is this correct? Browsing through the V8 code, is looks like debug stuff happens in its own Context, so I don't understand why you'd need to create/enter one prior to enabling debugging. If you do indeed need to create/enter a context, does it matter which one? Thanks, -David -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
