]> khamidou — GitHub mirrors - electron.git/commitdiff
docs: Add chapter on debugging with node-inspector.
authorCheng Zhao <zcbenz@gmail.com>
Wed, 20 Aug 2014 02:43:41 +0000 (10:43 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 20 Aug 2014 02:43:41 +0000 (10:43 +0800)
docs/tutorial/debugging-browser-process.md

index 0e4a3ebbf5f03f3511edcde233fea36e6722d423..34957312b0d37fe29f5ac8c452844711a42c43d5 100644 (file)
@@ -5,11 +5,45 @@ The devtools of browser window can only debug the scripts of the web pages
 the browser side (e.g. the browser process), atom-shell has provided the
 `--debug` and `--debug-brk` switches.
 
-## `--debug=[port]`
+## Command line switches
+
+### `--debug=[port]`
 
 When this switch is used atom-shell would listen for V8 debugger protocol on
 `port`, the `port` is `5858` by default.
 
-## `debug-brk=[port]`
+### `debug-brk=[port]`
 
 Like `--debug` but pauses the script on the first line.
+
+## Use node-inspector for debugging
+
+__Note:__ Atom Shell uses node v0.11.13, which currently doesn't work very well
+with node-inspector, and the browser process would crash if you inspect the
+`process` object under node-inspector's console.
+
+### 1. Start the [node-inspector](node-inspector) server
+
+```bash
+$ node-inspector
+```
+
+### 2. Enable debug mode for atom-shell
+
+You can either start atom-shell with a debug flag like:
+
+```bash
+$ atom-shell --debug your/app
+```
+
+or, to pause your script on the first line:
+
+```bash
+$ atom-shell --debug-brk your/app
+```
+
+### 3. Load the debugger UI
+
+Open http://127.0.0.1:8080/debug?port=5858 in the Chrome browser.
+
+[node-inspector](https://github.com/node-inspector/node-inspector)