While integrating debugger support into our v8 embedding application it was 
discovered that debugger state is not saved/restored when threads are 
switched - thus once we step over any such C++ call that temporary unlocks 
v8 engine, debugger is not able to stop on next statement and script just 
runs without stops.

v8 version 5.8.283.32

* Are there any workarounds to save debug context without modifying v8 
souces?
* Why Debug::ArchiveDebug does "Simply reset state. Don't archive anything." 
in this case?


Details:
Corresponding source fragment

>
> char* Debug::ArchiveDebug(char* storage) {
>   // Simply reset state. Don't archive anything.
>   ThreadInit();
>   return storage + ArchiveSpacePerThread();
> }
>  char* Debug::RestoreDebug(char* storage) {
>   // Simply reset state. Don't restore anything.
>   ThreadInit();
>   return storage + ArchiveSpacePerThread();
> }
> int Debug::ArchiveSpacePerThread() { return 0; }
>
>
Call stack:

<https://lh3.googleusercontent.com/-L_dbS0DO1k8/WRrFuqm3o2I/AAAAAAAAAMw/V8n33pl9l3Qxq37nMAwuTfHGuykepf7kACLcB/s1600/call_stack.bmp>

Actual sequence:
1. While step by step debugging stop on API exported from C++ that does 
following
2.a. Unlock v8 via v8::Unlocker
2.b. Set native event
2.c. Meanwhile other C++ thread will wake, lock v8 via v8::Locker, issue JS 
callback, unlock v8

2.d. Wait for confirmation from that other C++ thread 
2.e. Lock v8 again in destuctor of v8::Unlocker
3. After return from that API debugger does not stop any more because 
inside of Debug::Break(JavaScriptFrame* frame)
 call to last_step_action(); now returns StepNone instead of 

StepNext and JS continues to run instead of stopping on next JS statement.

-- 
-- 
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/d/optout.

Reply via email to