doc: match debugger output & instructions to master behavior
PR-URL: https://github.com/nodejs/node/pull/13885 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
6a1b8135d6
commit
b647f04df1
@ -6,17 +6,18 @@
|
|||||||
|
|
||||||
Node.js includes an out-of-process debugging utility accessible via a
|
Node.js includes an out-of-process debugging utility accessible via a
|
||||||
[TCP-based protocol][] and built-in debugging client. To use it, start Node.js
|
[TCP-based protocol][] and built-in debugging client. To use it, start Node.js
|
||||||
with the `debug` argument followed by the path to the script to debug; a prompt
|
with the `inspect` argument followed by the path to the script to debug; a prompt
|
||||||
will be displayed indicating successful launch of the debugger:
|
will be displayed indicating successful launch of the debugger:
|
||||||
|
|
||||||
```txt
|
```txt
|
||||||
$ node debug myscript.js
|
$ node inspect myscript.js
|
||||||
< Debugger listening on 127.0.0.1:5858
|
< Debugger listening on ws://127.0.0.1:9229/80e7a814-7cd3-49fb-921a-2e02228cd5ba
|
||||||
connecting to 127.0.0.1:5858 ... ok
|
< For help see https://nodejs.org/en/docs/inspector
|
||||||
break in /home/indutny/Code/git/indutny/myscript.js:1
|
< Debugger attached.
|
||||||
> 1 global.x = 5;
|
Break on start in myscript.js:1
|
||||||
|
> 1 (function (exports, require, module, __filename, __dirname) { global.x = 5;
|
||||||
2 setTimeout(() => {
|
2 setTimeout(() => {
|
||||||
3 debugger;
|
3 console.log('world');
|
||||||
debug>
|
debug>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -40,23 +41,24 @@ console.log('hello');
|
|||||||
Once the debugger is run, a breakpoint will occur at line 3:
|
Once the debugger is run, a breakpoint will occur at line 3:
|
||||||
|
|
||||||
```txt
|
```txt
|
||||||
$ node debug myscript.js
|
$ node inspect myscript.js
|
||||||
< Debugger listening on 127.0.0.1:5858
|
< Debugger listening on ws://127.0.0.1:9229/80e7a814-7cd3-49fb-921a-2e02228cd5ba
|
||||||
connecting to 127.0.0.1:5858 ... ok
|
< For help see https://nodejs.org/en/docs/inspector
|
||||||
break in /home/indutny/Code/git/indutny/myscript.js:1
|
< Debugger attached.
|
||||||
> 1 global.x = 5;
|
Break on start in myscript.js:1
|
||||||
|
> 1 (function (exports, require, module, __filename, __dirname) { global.x = 5;
|
||||||
2 setTimeout(() => {
|
2 setTimeout(() => {
|
||||||
3 debugger;
|
3 debugger;
|
||||||
debug> cont
|
debug> cont
|
||||||
< hello
|
< hello
|
||||||
break in /home/indutny/Code/git/indutny/myscript.js:3
|
break in myscript.js:3
|
||||||
1 global.x = 5;
|
1 (function (exports, require, module, __filename, __dirname) { global.x = 5;
|
||||||
2 setTimeout(() => {
|
2 setTimeout(() => {
|
||||||
> 3 debugger;
|
> 3 debugger;
|
||||||
4 console.log('world');
|
4 console.log('world');
|
||||||
5 }, 1000);
|
5 }, 1000);
|
||||||
debug> next
|
debug> next
|
||||||
break in /home/indutny/Code/git/indutny/myscript.js:4
|
break in myscript.js:4
|
||||||
2 setTimeout(() => {
|
2 setTimeout(() => {
|
||||||
3 debugger;
|
3 debugger;
|
||||||
> 4 console.log('world');
|
> 4 console.log('world');
|
||||||
@ -69,14 +71,14 @@ Press Ctrl + C to leave debug repl
|
|||||||
> 2+2
|
> 2+2
|
||||||
4
|
4
|
||||||
debug> next
|
debug> next
|
||||||
break in /home/indutny/Code/git/indutny/myscript.js:5
|
|
||||||
< world
|
< world
|
||||||
|
break in myscript.js:5
|
||||||
3 debugger;
|
3 debugger;
|
||||||
4 console.log('world');
|
4 console.log('world');
|
||||||
> 5 }, 1000);
|
> 5 }, 1000);
|
||||||
6 console.log('hello');
|
6 console.log('hello');
|
||||||
7
|
7
|
||||||
debug> quit
|
debug> .exit
|
||||||
```
|
```
|
||||||
|
|
||||||
The `repl` command allows code to be evaluated remotely. The `next` command
|
The `repl` command allows code to be evaluated remotely. The `next` command
|
||||||
@ -121,27 +123,23 @@ It is also possible to set a breakpoint in a file (module) that
|
|||||||
is not loaded yet:
|
is not loaded yet:
|
||||||
|
|
||||||
```txt
|
```txt
|
||||||
$ node debug test/fixtures/break-in-module/main.js
|
$ node inspect test/fixtures/break-in-module/main.js
|
||||||
< Debugger listening on 127.0.0.1:5858
|
< Debugger listening on ws://127.0.0.1:9229/4e3db158-9791-4274-8909-914f7facf3bd
|
||||||
connecting to 127.0.0.1:5858 ... ok
|
< For help see https://nodejs.org/en/docs/inspector
|
||||||
break in test/fixtures/break-in-module/main.js:1
|
< Debugger attached.
|
||||||
> 1 const mod = require('./mod.js');
|
Break on start in test/fixtures/break-in-module/main.js:1
|
||||||
|
> 1 (function (exports, require, module, __filename, __dirname) { const mod = require('./mod.js');
|
||||||
2 mod.hello();
|
2 mod.hello();
|
||||||
3 mod.hello();
|
3 mod.hello();
|
||||||
debug> setBreakpoint('mod.js', 2)
|
debug> setBreakpoint('mod.js', 22)
|
||||||
Warning: script 'mod.js' was not loaded yet.
|
Warning: script 'mod.js' was not loaded yet.
|
||||||
> 1 const mod = require('./mod.js');
|
|
||||||
2 mod.hello();
|
|
||||||
3 mod.hello();
|
|
||||||
4 debugger;
|
|
||||||
5
|
|
||||||
6 });
|
|
||||||
debug> c
|
debug> c
|
||||||
break in test/fixtures/break-in-module/mod.js:2
|
break in test/fixtures/break-in-module/mod.js:22
|
||||||
1 exports.hello = function() {
|
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
> 2 return 'hello from module';
|
21
|
||||||
3 };
|
>22 exports.hello = function() {
|
||||||
4
|
23 return 'hello from module';
|
||||||
|
24 };
|
||||||
debug>
|
debug>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user