{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/6792","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/6792/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/6792/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/6792/events","html_url":"https://github.com/nodejs/node/pull/6792","id":155114186,"number":6792,"title":"Add v8_inspector support","user":{"login":"ofrobots","id":79017,"avatar_url":"https://avatars.githubusercontent.com/u/79017?v=3","gravatar_id":"","url":"https://api.github.com/users/ofrobots","html_url":"https://github.com/ofrobots","followers_url":"https://api.github.com/users/ofrobots/followers","following_url":"https://api.github.com/users/ofrobots/following{/other_user}","gists_url":"https://api.github.com/users/ofrobots/gists{/gist_id}","starred_url":"https://api.github.com/users/ofrobots/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ofrobots/subscriptions","organizations_url":"https://api.github.com/users/ofrobots/orgs","repos_url":"https://api.github.com/users/ofrobots/repos","events_url":"https://api.github.com/users/ofrobots/events{/privacy}","received_events_url":"https://api.github.com/users/ofrobots/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/debugger","name":"debugger","color":"bfd4f2"},{"url":"https://api.github.com/repos/nodejs/node/labels/doc","name":"doc","color":"006b75"},{"url":"https://api.github.com/repos/nodejs/node/labels/dont-land-on-v6.x","name":"dont-land-on-v6.x","color":"bfdadc"},{"url":"https://api.github.com/repos/nodejs/node/labels/semver-minor","name":"semver-minor","color":"fef2c0"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":127,"created_at":"2016-05-16T20:27:18Z","updated_at":"2016-05-31T16:50:51Z","closed_at":"2016-05-30T16:12:40Z","pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/6792","html_url":"https://github.com/nodejs/node/pull/6792","diff_url":"https://github.com/nodejs/node/pull/6792.diff","patch_url":"https://github.com/nodejs/node/pull/6792.patch"},"body":"For background see: https://github.com/nodejs/node/issues/2546#issuecomment-189311746\r\n\r\nThis PR brings in v8_inspector support to Node.js (currently behind a compile time flag.) This means Node.js can now be debugged and profiled via the [Chrome Debugging Protocol](https://developer.chrome.com/devtools/docs/debugger-protocol), which enables inspection via Chrome DevTools and other tools & IDEs. So far, v8_inspector includes support for the following protocol domains: [Debugger](https://chromedevtools.github.io/debugger-protocol-viewer/v8/Debugger/), [Profiler](https://chromedevtools.github.io/debugger-protocol-viewer/v8/Profiler/), [Runtime](https://chromedevtools.github.io/debugger-protocol-viewer/v8/Runtime/), [HeapProfiler](https://chromedevtools.github.io/debugger-protocol-viewer/v8/HeapProfiler/)\r\n\r\nIn the Chrome DevTools client, the following is now available:\r\n\r\n* Complete breakpoint debugging, stepping w/ blackboxing \r\n* Source maps for transpiled code\r\n* LiveEdit: JavaScript hot-swap evaluation w/ V8\r\n* Console evaluation with ES6 feature/object support and [custom object formatting](https://docs.google.com/document/d/1FTascZXT9cxfetuPRT2eXPQKXui4nWFivUnS_335T3U/view)\r\n* Sampling JavaScript profiler w/ flamechart\r\n* Heap snapshot inspection, heap allocation timeline, allocation profiling\r\n* Asynchronous stacks for native promises\r\n\r\nThere is more functionality that could be implemented, but we've reached a good point to  get input from the community on the feature set and on the integration with Node.js core.\r\n\r\nThis PR has two logical sets of changes:\r\n\r\n### Bring in v8_inspector as a dependency\r\n\r\n`v8_inspector` used to be part of Blink. We have removed almost all of the dependencies on Blink and are working on getting this code merged directly into V8 – the biggest piece remaining is integrating the DevTools tests into the V8 test infrastructure. However, this work will likely complete in V8 5.3 / 5.4 timeframe. If we wait for this upstream change, it would  mean the improved debugging experience would not be available to Node.js v6.x LTS users.\r\n\r\nIn the meantime, we propose to bring the v8_inspector dependency directly into Node.js. This dependency can be dropped once v8_inspector merges upstream into V8 (in Node.js v7.x timeframe).\r\n\r\n\r\n### Node.js support for the v8_inspector protocol\r\n\r\nThe support for talking to v8_inspector protocol is primarily in `node_inspector.cc`. We also needed support for a subset of the websockets protocol to be able to talk to DevTools. We have implemented this based on the websockets implementation from Chromium. We are calling it the 'inspector socket protocol' as it is not a complete websockets implementation, although it could be extended. This protocol is *not* available to userspace JavaScript code, and is accessible only to internal C++ code in core.\r\n\r\nThe implementation is behind a compile time flag controlled by the `--with-inspector` configure flag.\r\n\r\n## Usage\r\n\r\n```\r\n$ ./configure --with-inspector\r\n$ make -j8\r\n$ ./node --inspect benchmark/http_simple.js\r\nDebugger listening on port 5858. To start debugging, open following URL in Chrome:\r\n\r\nchrome-devtools://devtools/remote/serve_file/@4604d24a75168768584760ba56d175507941852f/inspector.html?experiments=true&v8only=true&ws=localhost:5858/node\r\n```\r\n\r\nYou can attach Chrome DevTools by opening the printed url  in a Chrome browser.\r\n\r\n![2016-05-16](https://cloud.githubusercontent.com/assets/79017/15302743/58e98a62-1b69-11e6-9297-15e6d8bc50a5.png)\r\n\r\n\r\nBy default, the debugging port is 5858. You can optionally specify an alternate port via the `--inspect=9229` flag. If you want the debugger to pause on application start, you can additional pass the `--debug-brk` flag. For example:\r\n\r\n```\r\n$ ./node --inspect=9229 --debug-brk benchmark/http_simple.js\r\nDebugger listening on port 9229. To start debugging, open following URL in Chrome:\r\n\r\nchrome-devtools://devtools/remote/serve_file/@4604d24a75168768584760ba56d175507941852f/inspector.html?experiments=true&v8only=true&ws=localhost:9229/node\r\n```\r\n\r\nGetting this merged into Node.js would allow people to test the DevTools integration and allow proper debugging to be well-tested and stable well in time for the release of the 6.x LTS. It would also enable third-party debug tool writers to start building other debugging and profiling tools that work with Node.js.\r\n\r\nThanks for the review.\r\n\r\n/cc @repenaxa, @eugeneo, @paulirish\r\n"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/222749624","html_url":"https://github.com/nodejs/node/pull/6792#issuecomment-222749624","issue_url":"https://api.github.com/repos/nodejs/node/issues/6792","id":222749624,"user":{"login":"joshgav","id":4421720,"avatar_url":"https://avatars.githubusercontent.com/u/4421720?v=3","gravatar_id":"","url":"https://api.github.com/users/joshgav","html_url":"https://github.com/joshgav","followers_url":"https://api.github.com/users/joshgav/followers","following_url":"https://api.github.com/users/joshgav/following{/other_user}","gists_url":"https://api.github.com/users/joshgav/gists{/gist_id}","starred_url":"https://api.github.com/users/joshgav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshgav/subscriptions","organizations_url":"https://api.github.com/users/joshgav/orgs","repos_url":"https://api.github.com/users/joshgav/repos","events_url":"https://api.github.com/users/joshgav/events{/privacy}","received_events_url":"https://api.github.com/users/joshgav/received_events","type":"User","site_admin":false},"created_at":"2016-05-31T16:50:51Z","updated_at":"2016-05-31T16:50:51Z","body":"@rvagg \r\n\r\n> @joshgav can we get a perspective from Microsoft and/or @nodejs/tracing regarding this functionality and whether this is a good starting point for a vendor neutral debugging API?\r\n\r\n@auchenberg has started updating [vscode-chrome-debug-core](https://github.com/Microsoft/vscode-chrome-debug-core) to support Node+CDP and gain insight, see https://github.com/Microsoft/vscode-chrome-debug-core/issues/17.\r\n\r\nBefore complete integration and official support, I think we all should understand CDP's stability, compatibility, extensibility, and governance model. That is:\r\n\r\n- **Stability** - frequency and effect of significant changes;\r\n- **Compatibility** - support for various permutations of tools and runtime versions;\r\n- **Extensibility** - how to add functionality new to specific tools and runtimes;\r\n- **Governance model** - how changes to the protocol are proposed and integrated.\r\n\r\nWe'll begin discussion in tomorrow's [Tracing/Diag WG Meeting](https://github.com/nodejs/tracing-wg/issues/49).\r\n\r\nWill post something similar to #7072. Thanks!"}}
{"actor":{"display_login":"joshgav"}}