Hi, I am calling dispatchMessageFromFrontend at https://github.com/hsharsha/v8inspector/blob/a8219beb1b69ae6cbec1c79274291a14910cc248/inspector_agent.cc#L680 in DispatchMessages function. Frontend is the message I receive from websocket.
I am having an incoming_meesage_queue which queues the messages received from websocket and calls dispatchProtocolmessage by dequeueing these messages one after he other. I collect the result from the backend/v8_inspector and put them in outgoing_message_queue and this is transmitted on websocket whenever sendProtocolNotificaiton or sendProtocolMessage function is called. I am using libuv for asyncIO and I think you are using boost for the same. I truly appreciate your help. On Thursday, June 8, 2017 at 3:23:32 AM UTC+5:30, Zac Hansen wrote: > > Sorry if I'm bothering you or not helping, but... > > Where are you calling your dispatchMessageFromFrontend from? Maybe I'm > searching poorly again, but I dont' see a call. Sending the message > received from your websocket to that call is what, by my limited > understanding, is what takes care of processing the messages from the > debugger (is that what you're calling the frontend?). > > > https://github.com/hsharsha/v8inspector/blob/a8219beb1b69ae6cbec1c79274291a14910cc248/inspector_agent.cc#L338 > > > In my code, when I receive a message from the websocket, I call that > function with the raw contents from the websocket frame: > > https://github.com/xaxxon/v8toolkit/blob/master/src/debugger.cpp#L146 > > And then I don't to any PumpMessage functions during my pause loop. When > I'm in the pause function, I just poll my websocket, which calls that code > above when a frame is received, and all my debugging calls just magically > work. > > Let me know if you want me to stop trying to help. > > On Wednesday, June 7, 2017 at 1:06:45 AM UTC-7, Harsha HS wrote: >> >> It does not work if I do not call PumpMessageLoop in the pause loop. This >> is needed to push message from frontend to the backend. >> If I comment this out, inspector will pause when hit on halt but does not >> respond to any other front end messages. >> >> >> >> On Wednesday, June 7, 2017 at 1:21:11 PM UTC+5:30, Zac Hansen wrote: >>> >>> I'm not sure what the PumpMessageLoop call does, but have you tried it >>> without? >>> >>> That sounds like it might start execution of code even though it is >>> supposed to be paused. >>> >>> On Tuesday, June 6, 2017 at 11:11:20 PM UTC-7, Zac Hansen wrote: >>>> >>>> Hrmm, not sure what happened, I search now and I see this: >>>> >>>> >>>> https://github.com/hsharsha/v8inspector/blob/a8219beb1b69ae6cbec1c79274291a14910cc248/inspector_agent.cc#L308 >>>> >>>> On Tuesday, June 6, 2017 at 11:08:52 PM UTC-7, Zac Hansen wrote: >>>>> >>>>> I searched your code for runMessageLoopOnPause and didn't find an >>>>> override in your subclass. I'm no expert, but the code that I have that >>>>> works is: >>>>> >>>>> https://github.com/xaxxon/v8toolkit/blob/ >>>>> 9770d167bc6c39ee731fa10ff082267f250c53ab/include/debugger.h#L286 >>>>> >>>>> >>>>> >>>>> virtual void runMessageLoopOnPause(int contextGroupId) override { >>>>> this->paused = true; >>>>> while (this->paused) { >>>>> this->channel->run_one(); >>>>> } >>>>> std::cerr << fmt::format("exiting runMessageLoopOnPause") << >>>>> std::endl; >>>>> } Where run_one is what gives my websocket server a chance to deal >>>>> with incoming chrome debug protocol messages. >>>>> >>>>> On Tuesday, June 6, 2017 at 10:46:29 PM UTC-7, Harsha HS wrote: >>>>>> >>>>>> Having trouble when those are hit. I am able to set breakpoints >>>>>> I am processing messages in the pause loop. I can watch and respond >>>>>> to getProperty methods when paused. >>>>>> But only way to pause in my code is by hitting halt on the dev-tools. >>>>>> Any other action like step, will just continue the JS execution and >>>>>> it wont hit breakpoints. Only way to pause again is to hit halt. >>>>>> >>>>>> Code is at https://github.com/hsharsha/v8inspector >>>>>> It depends on libuv to interact with browser. >>>>>> >>>>>> Thanks, >>>>>> -Harsha >>>>>> >>>>>> On Wednesday, June 7, 2017 at 11:09:57 AM UTC+5:30, Zac Hansen wrote: >>>>>>> >>>>>>> Are you having trouble setting those or when those are hit? >>>>>>> >>>>>>> When they are hit, your code will go into the same callback as when >>>>>>> you manually pause, from what I've seen. Are you processing messages >>>>>>> while >>>>>>> in the pause callback? >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Tuesday, June 6, 2017 at 10:27:24 AM UTC-7, Harsha HS wrote: >>>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> runMessageLoopOnPause and quitMessageLoopOnPause seems to be >>>>>>>> working correctly. When the debugger is paused using the halt icon on >>>>>>>> chrome-dev tools, runMessageLoopOnPause is called and it is just >>>>>>>> pumping >>>>>>>> messages to platform and when continued quitMessageLoopOnPause is >>>>>>>> called >>>>>>>> and the java script execution continues. >>>>>>>> >>>>>>>> I am facing issue with single step, break, step into or step over >>>>>>>> functionality. Debugger is not paused when these methods are hit. >>>>>>>> It looks like a synchronization issue between inspector thread and >>>>>>>> java script execution thread. >>>>>>>> How to synchronize between JS execution and inspector protocol? >>>>>>>> >>>>>>>> Thanks, >>>>>>>> -Harsha >>>>>>>> >>>>>>>> On Monday, May 29, 2017 at 10:42:33 AM UTC+5:30, Anoop R. S. wrote: >>>>>>>>> >>>>>>>>> Hi Harsha, >>>>>>>>> Is it setting the breakpoints by passing "method":"Debugger. >>>>>>>>> setBreakpointByUrl" ? >>>>>>>>> Seems like it is having problems on pausing: pausing at a >>>>>>>>> breakpoint, pausing after singlestep operation. >>>>>>>>> runMessageLoopOnPause function is called when debugger pauses (at >>>>>>>>> a breakpoint, after step over etc) >>>>>>>>> >>>>>>>>> https://groups.google.com/forum/#!topic/v8-users/qmr92Cgagg4 >>>>>>>>> >>>>>>>>> Here is my call stack when pause happens after a step over. You >>>>>>>>> can use it for debugging. >>>>>>>>> >>>>>>>>> >ChromeDbgServer.exe!V8SFWInspector::runMessageLoopOnPause(int >>>>>>>>> contextGroupId) Line 18C++ >>>>>>>>> >>>>>>>>> v8.dll!v8_inspector::V8Debugger::handleProgramBreak(v8::Local<v8::Context> >>>>>>>>> >>>>>>>>> pausedContext, v8::Local<v8::Object> executionState, >>>>>>>>> v8::Local<v8::Value> >>>>>>>>> exception, v8::Local<v8::Array> hitBreakpointNumbers, bool >>>>>>>>> isPromiseRejection, bool isUncaught) Line 519C++ >>>>>>>>> v8.dll!v8_inspector::V8Debugger::handleV8DebugEvent(const >>>>>>>>> v8::DebugInterface::EventDetails & eventDetails) Line 620C++ >>>>>>>>> v8.dll!v8_inspector::V8Debugger::v8DebugEventCallback(const >>>>>>>>> v8::DebugInterface::EventDetails & eventDetails) Line 540C++ >>>>>>>>> v8.dll!v8::internal::Debug::CallEventCallback(v8::DebugEvent >>>>>>>>> event, v8::internal::Handle<v8::internal::Object> exec_state, >>>>>>>>> v8::internal::Handle<v8::internal::Object> event_data, >>>>>>>>> v8::Debug::ClientData * client_data) Line 1903C++ >>>>>>>>> v8.dll!v8::internal::Debug::ProcessDebugEvent(v8::DebugEvent >>>>>>>>> event, v8::internal::Handle<v8::internal::JSObject> event_data, >>>>>>>>> bool auto_continue) Line 1880C++ >>>>>>>>> >>>>>>>>> v8.dll!v8::internal::Debug::OnDebugBreak(v8::internal::Handle<v8::internal::Object> >>>>>>>>> >>>>>>>>> break_points_hit, bool auto_continue) Line 1818C++ >>>>>>>>> v8.dll!v8::internal::Debug::Break(v8::internal::JavaScriptFrame >>>>>>>>> * frame) Line 573C++ >>>>>>>>> >>>>>>>>> v8.dll!v8::internal::__RT_impl_Runtime_DebugBreak(v8::internal::Arguments >>>>>>>>> >>>>>>>>> args, v8::internal::Isolate * isolate) Line 35C++ >>>>>>>>> v8.dll!v8::internal::Runtime_DebugBreak(int args_length, >>>>>>>>> v8::internal::Object * * args_object, v8::internal::Isolate * >>>>>>>>> isolate) >>>>>>>>> Line 25 + 0xde bytesC++ >>>>>>>>> >>>>>>>>> Hope I am not too late for the reply. >>>>>>>>> >>>>>>>>> regards, >>>>>>>>> Anoop R. S. >>>>>>>>> >>>>>>>>> --From Mail >>>>>>>>> >>>>>>>>>> Hi Anoop, >>>>>>>>>> >>>>>>>>>> Thanks for your reply and very sorry for the delay in my reply >>>>>>>>>> as I was on vacation and did not get a chance to work on the >>>>>>>>>> inspector code. >>>>>>>>>> >>>>>>>>>> I fixed issue which was a silly mistake from my end as I was >>>>>>>>>> allocating the agent variable on stack which go cleaned up once the >>>>>>>>>> function returned. >>>>>>>>>> >>>>>>>>>> Now I could establish connection with the chrome-dev tools client >>>>>>>>>> and communicate with the debug server. >>>>>>>>>> I am facing an issue here. >>>>>>>>>> i) It is not breaking on the first statement, even though I have >>>>>>>>>> wait implemented >>>>>>>>>> ii) I can now stop the execution using halt from the chrome-dev >>>>>>>>>> tools. But If I do single-step or step out, the execution just >>>>>>>>>> continues >>>>>>>>>> (work as continue instead of single step) and again I have to press >>>>>>>>>> halt on >>>>>>>>>> chrome-dev tools to break the execution. >>>>>>>>>> >>>>>>>>>> If you can take a look at github.com/hsharsha/v8inspector, would >>>>>>>>>> appreciate greatly. >>>>>>>>>> >>>>>>>>>> Thanks, >>>>>>>>>> -Harsha >>>>>>>>>> >>>>>>>>>> On Thu, May 18, 2017 at 1:35 PM, Anoop R. S. wrote: >>>>>>>>>> >>>>>>>>>>> Hi Harsha, >>>>>>>>>>> We also developed a debugging framework for JS using V8 >>>>>>>>>>> inspector. While doing that, in between we were also getting this >>>>>>>>>>> error, >>>>>>>>>>> but resolved it by debugging our code. >>>>>>>>>>> I can send you the websocket messages that we are getting. Maybe >>>>>>>>>>> that would help in some way. >>>>>>>>>>> I haven't run your code provided at [ >>>>>>>>>>> https://github.com/hsharsha/v8inspector]. Maybe if you need >>>>>>>>>>> further help, I can check it. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> {"id":1,"method":"Log.enable"} >>>>>>>>>>> >>>>>>>>>>> {"id":2,"method":"Log.startViolationsReport","params":{" >>>>>>>>>>> config":[{"name":"longTask","threshold":200},{"name":" >>>>>>>>>>> longLayout","threshold":30},{"name":"blockedEvent","threshol >>>>>>>>>>> d":100},{"name":"blockedParser","threshold":-1},{"name":" >>>>>>>>>>> handler","threshold":150},{"name":"recurringHandler"," >>>>>>>>>>> threshold":50}]}} >>>>>>>>>>> >>>>>>>>>>> {"id":3,"method":"Network.enable","params":{"maxTotalBufferS >>>>>>>>>>> ize":10000000,"maxResourceBufferSize":5000000}} >>>>>>>>>>> >>>>>>>>>>> {"id":4,"method":"Page.enable"} >>>>>>>>>>> >>>>>>>>>>> {"id":5,"method":"Page.getResourceTree"} >>>>>>>>>>> >>>>>>>>>>> {"id":6,"method":"Runtime.enable"} >>>>>>>>>>> >>>>>>>>>>> {"id":7,"method":"Debugger.enable"} >>>>>>>>>>> >>>>>>>>>>> {"id":8,"method":"Debugger.setPauseOnExceptions","params":{" >>>>>>>>>>> state":"none"}} >>>>>>>>>>> >>>>>>>>>>> {"id":9,"method":"Debugger.setAsyncCallStackDepth","params": >>>>>>>>>>> {"maxDepth":0}} >>>>>>>>>>> >>>>>>>>>>> {"id":10,"method":"DOM.enable"} >>>>>>>>>>> >>>>>>>>>>> {"id":11,"method":"CSS.enable"} >>>>>>>>>>> >>>>>>>>>>> {"id":12,"method":"Target.setAutoAttach","params":{"autoAtta >>>>>>>>>>> ch":true,"waitForDebuggerOnStart":true}} >>>>>>>>>>> >>>>>>>>>>> {"id":13,"method":"Profiler.enable"} >>>>>>>>>>> >>>>>>>>>>> {"id":14,"method":"Profiler.setSamplingInterval","params":{" >>>>>>>>>>> interval":100}} >>>>>>>>>>> >>>>>>>>>>> {"id":15,"method":"ServiceWorker.enable"} >>>>>>>>>>> >>>>>>>>>>> {"error":{"code":-32601,"message":"'Log.enable' wasn't >>>>>>>>>>> found"},"id":1} >>>>>>>>>>> >>>>>>>>>>> {"error":{"code":-32601,"message":"'Log.startViolationsReport' >>>>>>>>>>> wasn't found"},"id":2} >>>>>>>>>>> >>>>>>>>>>> {"error":{"code":-32601,"message":"'Network.enable' wasn't >>>>>>>>>>> found"},"id":3} >>>>>>>>>>> >>>>>>>>>>> {"error":{"code":-32601,"message":"'Page.enable' wasn't >>>>>>>>>>> found"},"id":4} >>>>>>>>>>> >>>>>>>>>>> {"error":{"code":-32601,"message":"'Page.getResourceTree' >>>>>>>>>>> wasn't found"},"id":5} >>>>>>>>>>> >>>>>>>>>>> {"method":"Runtime.executionContextCreated","params":{" >>>>>>>>>>> context":{"id":1,"origin":"","name":""}}} >>>>>>>>>>> >>>>>>>>>>> {"id":6,"result":{}} >>>>>>>>>>> >>>>>>>>>>> {"method":"Debugger.scriptParsed","params":{"scriptId":"22", >>>>>>>>>>> "url":"my_Screen1","startLine":0,"startColumn":0,"endLine":19," >>>>>>>>>>> endColumn":0,"executionContextId":1,"hash":"FF07566204EF >>>>>>>>>>> 7A37E97781F777DD9282456E48B3","isLiveEdit":false," >>>>>>>>>>> sourceMapURL":"","hasSourceURL":false}} >>>>>>>>>>> >>>>>>>>>>> {"id":22,"method":"Debugger.setBreakpointByUrl","params":{" >>>>>>>>>>> lineNumber":13,"url":"my_Screen1","columnNumber":39,"conditi >>>>>>>>>>> on":""}} >>>>>>>>>>> >>>>>>>>>>> {"id":7,"result":{}} >>>>>>>>>>> >>>>>>>>>>> {"id":8,"result":{}} >>>>>>>>>>> >>>>>>>>>>> {"id":9,"result":{}} >>>>>>>>>>> >>>>>>>>>>> {"error":{"code":-32601,"message":"'DOM.enable' wasn't >>>>>>>>>>> found"},"id":10} >>>>>>>>>>> >>>>>>>>>>> {"error":{"code":-32601,"message":"'CSS.enable' wasn't >>>>>>>>>>> found"},"id":11} >>>>>>>>>>> >>>>>>>>>>> {"error":{"code":-32601,"message":"'Target.setAutoAttach' >>>>>>>>>>> wasn't found"},"id":12} >>>>>>>>>>> >>>>>>>>>>> {"id":13,"result":{}} >>>>>>>>>>> >>>>>>>>>>> {"id":14,"result":{}} >>>>>>>>>>> >>>>>>>>>>> {"error":{"code":-32601,"message":"'ServiceWorker.enable' >>>>>>>>>>> wasn't found"},"id":15} >>>>>>>>>>> >>>>>>>>>>> {"id":16,"result":{}} >>>>>>>>>>> >>>>>>>>>>> {"error":{"code":-32601,"message":"'Page.setAutoAttachToCreatedPages' >>>>>>>>>>> >>>>>>>>>>> wasn't found"},"id":17} >>>>>>>>>>> >>>>>>>>>>> {"error":{"code":-32601,"message":"'Emulation.setScriptExecutionDisabled' >>>>>>>>>>> >>>>>>>>>>> wasn't found"},"id":18} >>>>>>>>>>> >>>>>>>>>>> {"error":{"code":-32601,"message":"'Rendering.setShowViewportSizeOnResize' >>>>>>>>>>> >>>>>>>>>>> wasn't found"},"id":19} >>>>>>>>>>> >>>>>>>>>>> {"error":{"code":-32601,"message":"'Inspector.enable' wasn't >>>>>>>>>>> found"},"id":20} >>>>>>>>>>> >>>>>>>>>>> {"id":21,"result":{}} >>>>>>>>>>> >>>>>>>>>>> {"id":22,"result":{"breakpointId":"my_Screen1:13:39"," >>>>>>>>>>> locations":[{"scriptId":"22","lineNumber":13,"columnNumber": >>>>>>>>>>> 39}]}} >>>>>>>>>>> >>>>>>>>>>> Please let me know if this is of any help for you. >>>>>>>>>>> >>>>>>>>>>> regards, >>>>>>>>>>> Anoop R. S. >>>>>>>>>>> >>>>>>>>>>> On Monday, 8 May 2017 20:01:43 UTC+5:30, Harsha HS wrote: >>>>>>>>>>>> >>>>>>>>>>>> Hi, >>>>>>>>>>>> I am trying to use chrome protocol with chrom-devtools in front >>>>>>>>>>>> end. >>>>>>>>>>>> I am not receiving any message from frontend after id:8 >>>>>>>>>>>> >>>>>>>>>>>> message {"id":1,"method":"Runtime.enable"} >>>>>>>>>>>> message {"id":2,"method":"Debugger.enable"} >>>>>>>>>>>> message {"id":3,"method":"Debugger.set >>>>>>>>>>>> PauseOnExceptions","params":{"state":"none"}} >>>>>>>>>>>> message {"id":4,"method":"Debugger.setAsyncCallStackDepth"," >>>>>>>>>>>> params":{"maxDepth":0}} >>>>>>>>>>>> message {"id":5,"method":"Profiler.enable"} >>>>>>>>>>>> message {"id":6,"method":"Profiler.set >>>>>>>>>>>> SamplingInterval","params":{"interval":100}} >>>>>>>>>>>> message {"id":7,"method":"Debugger.set >>>>>>>>>>>> BlackboxPatterns","params":{"patterns":[]}} >>>>>>>>>>>> message {"id":8,"method":"Runtime.runIfWaitingForDebugger"} >>>>>>>>>>>> >>>>>>>>>>>> For each of these messages, I am replying to frontend with >>>>>>>>>>>> {id:xx, result:{}}. >>>>>>>>>>>> >>>>>>>>>>>> Code is at https://github.com/hsharsha/v8inspector >>>>>>>>>>>> >>>>>>>>>>>> -Harsha >>>>>>>>>>>> >>>>>>>>>>> … >>>>>>>>>> >>>>>>>>> >>>>>>>>> On Thursday, 18 May 2017 13:35:15 UTC+5:30, Anoop R. S. wrote: >>>>>>>>>> >>>>>>>>>> Hi Harsha, >>>>>>>>>> We also developed a debugging framework for JS using V8 >>>>>>>>>> inspector. While doing that, in between we were also getting this >>>>>>>>>> error, >>>>>>>>>> but resolved it by debugging our code. >>>>>>>>>> I can send you the websocket messages that we are getting. Maybe >>>>>>>>>> that would help in some way. >>>>>>>>>> I haven't run your code provided at [https://github.com/hsharsha/ >>>>>>>>>> v8inspector]. Maybe if you need further help, I can check it. >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> {"id":1,"method":"Log.enable"} >>>>>>>>>> >>>>>>>>>> {"id":2,"method":"Log.startViolationsReport","params":{" >>>>>>>>>> config":[{"name":"longTask","threshold":200},{"name":" >>>>>>>>>> longLayout","threshold":30},{"name":"blockedEvent","threshol >>>>>>>>>> d":100},{"name":"blockedParser","threshold":-1},{"name":" >>>>>>>>>> handler","threshold":150},{"name":"recurringHandler","threshold": >>>>>>>>>> 50}]}} >>>>>>>>>> >>>>>>>>>> {"id":3,"method":"Network.enable","params":{"maxTotalBufferS >>>>>>>>>> ize":10000000,"maxResourceBufferSize":5000000}} >>>>>>>>>> >>>>>>>>>> {"id":4,"method":"Page.enable"} >>>>>>>>>> >>>>>>>>>> {"id":5,"method":"Page.getResourceTree"} >>>>>>>>>> >>>>>>>>>> {"id":6,"method":"Runtime.enable"} >>>>>>>>>> >>>>>>>>>> {"id":7,"method":"Debugger.enable"} >>>>>>>>>> >>>>>>>>>> {"id":8,"method":"Debugger.setPauseOnExceptions","params":{" >>>>>>>>>> state":"none"}} >>>>>>>>>> >>>>>>>>>> {"id":9,"method":"Debugger.setAsyncCallStackDepth","params": >>>>>>>>>> {"maxDepth":0}} >>>>>>>>>> >>>>>>>>>> {"id":10,"method":"DOM.enable"} >>>>>>>>>> >>>>>>>>>> {"id":11,"method":"CSS.enable"} >>>>>>>>>> >>>>>>>>>> {"id":12,"method":"Target.setAutoAttach","params":{"autoAtta >>>>>>>>>> ch":true,"waitForDebuggerOnStart":true}} >>>>>>>>>> >>>>>>>>>> {"id":13,"method":"Profiler.enable"} >>>>>>>>>> >>>>>>>>>> {"id":14,"method":"Profiler.setSamplingInterval","params":{" >>>>>>>>>> interval":100}} >>>>>>>>>> >>>>>>>>>> {"id":15,"method":"ServiceWorker.enable"} >>>>>>>>>> >>>>>>>>>> {"error":{"code":-32601,"message":"'Log.enable' wasn't >>>>>>>>>> found"},"id":1} >>>>>>>>>> >>>>>>>>>> {"error":{"code":-32601,"message":"'Log.startViolationsReport' >>>>>>>>>> wasn't found"},"id":2} >>>>>>>>>> >>>>>>>>>> {"error":{"code":-32601,"message":"'Network.enable' wasn't >>>>>>>>>> found"},"id":3} >>>>>>>>>> >>>>>>>>>> {"error":{"code":-32601,"message":"'Page.enable' wasn't >>>>>>>>>> found"},"id":4} >>>>>>>>>> >>>>>>>>>> {"error":{"code":-32601,"message":"'Page.getResourceTree' wasn't >>>>>>>>>> found"},"id":5} >>>>>>>>>> >>>>>>>>>> {"method":"Runtime.executionContextCreated","params":{" >>>>>>>>>> context":{"id":1,"origin":"","name":""}}} >>>>>>>>>> >>>>>>>>>> {"id":6,"result":{}} >>>>>>>>>> >>>>>>>>>> {"method":"D >>>>>>>>>> >>>>>>>>> -- -- 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.
