Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e244d56

Browse filesBrowse files
jasnellMyles Borins
authored andcommitted
doc: improvements to debugger.markdown copy
General improvements to debugger.markdown PR-URL: #4436 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Minwoo Jung <jmwsoft@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent df7e128 commit e244d56
Copy full SHA for e244d56

File tree

Expand file treeCollapse file tree

1 file changed

+31
-27
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+31
-27
lines changed
Open diff view settings
Collapse file

‎doc/api/debugger.markdown‎

Copy file name to clipboardExpand all lines: doc/api/debugger.markdown
+31-27Lines changed: 31 additions & 27 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
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

@@ -153,19 +156,20 @@ breakpoint)
153156
### Various
154157

155158
* `scripts` - List all loaded scripts
156-
* `version` - Display v8's version
159+
* `version` - Display V8's version
157160

158161
## Advanced Usage
159162

160-
The V8 debugger can be enabled and accessed either by starting Node.js with
161-
the `--debug` command-line flag or by signaling an existing Node.js process
162-
with `SIGUSR1`.
163+
An alternative way of enabling and accessing the debugger is to start
164+
Node.js with the `--debug` command-line flag or by signaling an existing
165+
Node.js process with `SIGUSR1`.
163166

164-
Once a process has been set in debug mode with this it can be connected to
165-
with the Node.js debugger. Either connect to the `pid` or the URI to the
166-
debugger. The syntax is:
167+
Once a process has been set in debug mode this way, it can be connected to
168+
using the Node.js debugger by either connecting to the `pid` of the running
169+
process or via URI reference to the listening debugger:
167170

168171
* `node debug -p <pid>` - Connects to the process via the `pid`
169-
* `node debug <URI>` - Connects to the process via the URI such as localhost:5858
172+
* `node debug <URI>` - Connects to the process via the URI such as
173+
localhost:5858
170174

171-
[TCP protocol]: https://github.com/v8/v8/wiki/Debugging-Protocol
175+
[TCP-based protocol]: https://github.com/v8/v8/wiki/Debugging-Protocol

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.