Reputation: 185
I try to add inspector in my application that embed v8 engine.
All my try failed, so i try to look on node.js implementation : it's to heavy, so i switch to inspector-test and d8 from v8 soucres. But i don't found how connect it to chrome :(
So before continue dev, i will want to establish a debug connection between chrome and a debuggable application like d8 or v8_shell to analyse how it work.
My question : how to connect "inspector-test or d8 or v8_shell" to chrome://inspect/#devices on the same computer.
Thanks for your help
Upvotes: 2
Views: 3129
Reputation: 185
1 : Be sure to understand this :
=> https://github.com/v8/v8/wiki/Embedder%27s-Guide (very important)
2 : Compile your own version of v8, the goal is to understand a lot a things (when you found how do this it will be your first victory and you way use precompiled version).
=> Under windows it's a nightmare and you need VS2015 some extra lib.
=> The simple & safe way is to setup an ubuntu virtual machine.
3 : Read the code of D8 (include in v8 source), D for debug and inspector-test.cc .
=> It a minimal debugger (no communication with frontend).
=> Can be done online : https://cs.chromium.org/chromium/src/v8/src/d8.cc?type=cs&q=InspectorClient+package:%5Echromium$&l=1916
4 : Lock at Node.js source code there's a complete integration of debugger with Chrome as front-end, but the code is connected with node internal framework it's not easy to remove all un-need things...
=> This link may help : https://github.com/nodejs/node/pull/6792
5 : If you have not a minimal command line sample that allow you to execute your own java-script file, write it, be sure to handle all error you will known where it crash...
=> This will help : https://github.com/underscorediscovery/v8-tutorials
6 : When you v8 engine embedded code is ok (no crash) : lock at this it will help you to start :
=> https://github.com/v8/v8/wiki/Debugging-over-the-V8-Inspector-API
=> https://medium.com/@hyperandroid/v8-inspector-from-an-embedder-standpoint-7f9c0472e2b7
Warning : javascript is executed on a single thread, and debugger need to run in an other one (v8 task if i remember correctly).
Good luke it's a hard job.
Upvotes: 8
Reputation: 2366
You can use the V8 inspector programmatically in Node.js. E.g., you can write a module that's starting the inspector, runs some code, parses the results from the inspector and so on.
Have a look at this example code:
Demo for collecting code coverage within Node.js
You need Node 9.3 or newer, then run node coverage/demo.js
and open localhost:8080. (For the type profile demo, you need a custom build Node with newer V8.)
Upvotes: 0