44
55<!-- type=misc -->
66
7- V8 comes with an extensive debugger which is accessible out-of-process via a
8- simple [ TCP protocol] [ ] . Node.js has a built-in client for this debugger. To
9- use this, start Node.js with the ` debug ` argument; a prompt will appear:
7+ Node.js includes a full-featured out-of-process debugging utility accessible
8+ via a simple [ TCP-based protocol] [ ] and built-in debugging client. To use it,
9+ start Node.js with the ` debug ` argument followed by the path to the script to
10+ debug; a prompt will be displayed indicating successful launch of the debugger:
1011
1112 % node debug myscript.js
1213 < debugger listening on port 5858
@@ -17,11 +18,13 @@ use this, start Node.js with the `debug` argument; a prompt will appear:
1718 3 debugger;
1819 debug>
1920
20- Node.js's debugger client doesn't support the full range of commands, but
21- simple step and inspection is possible. By putting the statement ` debugger; `
22- into the source code of your script, you will enable a breakpoint.
21+ Node.js's debugger client does not yet support the full range of commands, but
22+ simple step and inspection are possible.
2323
24- For example, suppose ` myscript.js ` looked like this:
24+ Inserting the statement ` debugger; ` into the source code of a script will
25+ enable a breakpoint at that position in the code.
26+
27+ For example, suppose ` myscript.js ` is written as:
2528
2629 // myscript.js
2730 x = 5;
@@ -31,7 +34,7 @@ For example, suppose `myscript.js` looked like this:
3134 }, 1000);
3235 console.log('hello');
3336
34- Then once the debugger is run, it will break on line 4.
37+ Once the debugger is run, a breakpoint will occur at line 4:
3538
3639 % node debug myscript.js
3740 < debugger listening on port 5858
@@ -73,20 +76,20 @@ Then once the debugger is run, it will break on line 4.
7376 %
7477
7578
76- The ` repl ` command allows you to evaluate code remotely. The ` next ` command
77- steps over to the next line. There are a few other commands available and more
78- to come. Type ` help ` to see others .
79+ The ` repl ` command allows code to be evaluated remotely. The ` next ` command
80+ steps over to the next line. Type ` help ` to see what other commands are
81+ available .
7982
8083## Watchers
8184
82- You can watch expression and variable values while debugging your code.
83- On every breakpoint each expression from the watchers list will be evaluated
84- in the current context and displayed just before the breakpoint's source code
85- listing.
85+ It is possible to watch expression and variable values while debugging. On
86+ every breakpoint, each expression from the watchers list will be evaluated
87+ in the current context and displayed immediately before the breakpoint's
88+ source code listing.
8689
87- To start watching an expression, type ` watch(" my_expression" ) ` . ` watchers `
88- prints the active watchers. To remove a watcher, type
89- ` unwatch(" my_expression" ) ` .
90+ To begin watching an expression, type ` watch(' my_expression' ) ` . The command
91+ ` watchers ` will print the active watchers. To remove a watcher, type
92+ ` unwatch(' my_expression' ) ` .
9093
9194## Commands reference
9295
@@ -154,19 +157,20 @@ breakpoint)
154157### Various
155158
156159* ` scripts ` - List all loaded scripts
157- * ` version ` - Display v8 's version
160+ * ` version ` - Display V8 's version
158161
159162## Advanced Usage
160163
161- The V8 debugger can be enabled and accessed either by starting Node.js with
162- the ` --debug ` command-line flag or by signaling an existing Node.js process
163- with ` SIGUSR1 ` .
164+ An alternative way of enabling and accessing the debugger is to start
165+ Node.js with the ` --debug ` command-line flag or by signaling an existing
166+ Node.js process with ` SIGUSR1 ` .
164167
165- Once a process has been set in debug mode with this it can be connected to
166- with the Node.js debugger. Either connect to the ` pid ` or the URI to the
167- debugger. The syntax is :
168+ Once a process has been set in debug mode this way, it can be connected to
169+ using the Node.js debugger by either connecting to the ` pid ` of the running
170+ process or via URI reference to the listening debugger :
168171
169172* ` node debug -p <pid> ` - Connects to the process via the ` pid `
170- * ` node debug <URI> ` - Connects to the process via the URI such as localhost:5858
173+ * ` node debug <URI> ` - Connects to the process via the URI such as
174+ localhost:5858
171175
172- [ TCP protocol ] : https://github.com/v8/v8/wiki/Debugging-Protocol
176+ [ TCP-based protocol ] : https://github.com/v8/v8/wiki/Debugging-Protocol
0 commit comments