Eventually I managed to sort it out. It does not seem to have huge interest 
about it but I share it anyway, someone might find it useful.
Basically we have to create a web socket server along with our VM that we 
want to debug. Anything that comes through the ws connection (commands from 
CDT) has to be forwarded to the InspectorClient 
(v8_inspector::V8InspectorClient, 
v8_inspector::V8InspectorSession::dispatchProtocolMessage method) and 
anything (events and responses) that comes from the InspectorFrontend 
(v8_inspector::V8Inspector::Channel) has to be sent through the ws 
connection. We do not want to touch the JSON messages at all, no need for 
parsing. We just forward them to CDT/V8. The tricky bit is the 
runMessageLoopOnPause and quitMessageLoopOnPause methods. They have to be 
overridden. runMessageLoopOnPause should not return and has to handle 
messages until quitMessageLoopOnPause is called. That's it. In CDT we can 
see the call stack, scripts, we set break points, whatever. Launch your 
browser with --remote-debugging-port=2222 then type 
http://localhost:2222/devtools/inspector.html?ws=localhost:2000 
(localhost:2000 where the ws server listens) and you can start debugging 
your v8 context.

On Friday, 3 March 2017 09:41:44 UTC, DánielN wrote:
>
> I have just started exploring debugging. I am lifting code 
> (InspectorClient, InspectorFrontend) from d8 to my test project. I would 
> like to connect my embedded v8 VM to CDT and debug it. Does anyone have 
> some simple example that does that? It seems to me to be a long way and a 
> big learning curve from dismantling d8 code to connect to CDT.
> Any help would be very much appreciated.
>
> On Friday, 3 March 2017 09:21:43 UTC, Ben Noordhuis wrote:
>>
>> On Fri, Mar 3, 2017 at 10:10 AM, Rishi Kumar <[email protected]> 
>> wrote: 
>> > Hi, 
>> > 
>> > I was reading and using the debugging protocol from this page 
>> > https://github.com/v8/v8/wiki/Debugging-Protocol . Its looks like it 
>> has 
>> > been removed from the github wiki. I dont know how to get that link 
>> page to 
>> > complete my work. I need these protocol documentation which was clear 
>> and 
>> > proper in that page link. is anyone can help me to get that ? 
>>
>> This is the new API: 
>> https://github.com/v8/v8/wiki/Debugging-over-the-V8-Inspector-API 
>>
>> The old JSON-based protocol was deprecated two or three years ago and 
>> was removed recently. 
>>
>

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