Thanks for your answer Ben. I have just filed my bug. 

On Saturday, January 9, 2016 at 1:55:29 PM UTC+1, Ben Noordhuis wrote:
>
> On Fri, Jan 8, 2016 at 2:43 PM, juu <[email protected] <javascript:>> 
> wrote: 
> > Hi everyone, 
> > 
> > I am having some issues while trying to implement a "wait for debugger" 
> > feature on my debugger client connection. I want to allow my user to 
> have 
> > its script execution paused until he connect his debugger client to v8. 
> > 
> > I am trying to do this by calling v8::Debug::DebugBreak before my Script 
> > runs (that's how the former v8::Debug::EnableAgent use to do this). My 
> > application is multi-threaded, so each v8 API call use a v8::Locker to 
> be 
> > thread safe. 
> > 
> > So my use case could be summarized as : 
> > 
> > //... 
> > 
> > v8::Debug::DebugBreak(); 
> > 
> > StartMyDebuggerListenerThread(); 
> > 
> > { 
> >    v8::Locker lock(my_isolate); 
> >    myScript->Run() 
> > } 
> > 
> > //... 
> > 
> > 
> > My problem is that the DebugBreak function sets some interruption flags 
> on 
> > the local thread (to trigger the break when possible I guess). 
> >       See execution.cc StackGuard::RequestInterrupt(int flagbit) 
> > 
> > But the locker clears this flag, while it's being initialized. 
> >       See v8threads.cc Locker::Initialize(V8::Isolate* isolate), during 
> the 
> > RestoreThread() call 
> > 
> > 
> > So whenever I try to trigger a break, it's cancelled by the next Locker 
> I 
> > hit. Am I doing something wrong ? I am using v8 3.27.34.20 could this be 
> > related to my version, and be fixed in the next ones ? (From what I see, 
> I 
> > does not seem to change in the last version) 
>
> Tip of tree indeed seems to have the same behavior.  I'd file a bug: 
> https://bugs.chromium.org/p/v8/issues/list 
>
> > Another quick question, how does v8 trigger this break (performed by 
> > v8::Debug::DebugBreak() ) ? Is this done automatically ? or do I have to 
> > call v8::Debug::ProcessDebugMessage to process it like a DebugCommand ? 
>
> V8 inserts checks in the generated code, in the function 
> prologue/epilogue and around loop edges (IIRC).  You don't have to do 
> anything except wait for a few microseconds; eventually your debug 
> listener gets called. 
>

-- 
-- 
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