Skip to content

Commit 7da19db

Browse files
vsemozhetbytgibfahn
authored andcommitted
doc: update output examples in debugger.md
PR-URL: #10944 Backport-PR-URL: #13751 Reviewed-By: Josh Gavant <joshgavant@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 7a22964 commit 7da19db

File tree

1 file changed

+31
-25
lines changed

1 file changed

+31
-25
lines changed

doc/api/debugger.md

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ will be displayed indicating successful launch of the debugger:
1111

1212
```txt
1313
$ node debug myscript.js
14-
< debugger listening on port 5858
15-
connecting... ok
14+
< Debugger listening on [::]:5858
15+
connecting to 127.0.0.1:5858 ... ok
1616
break in /home/indutny/Code/git/indutny/myscript.js:1
17-
1 x = 5;
17+
> 1 global.x = 5;
1818
2 setTimeout(() => {
1919
3 debugger;
2020
debug>
@@ -28,37 +28,37 @@ enable a breakpoint at that position in the code:
2828

2929
```js
3030
// myscript.js
31-
x = 5;
31+
global.x = 5;
3232
setTimeout(() => {
3333
debugger;
3434
console.log('world');
3535
}, 1000);
3636
console.log('hello');
3737
```
3838

39-
Once the debugger is run, a breakpoint will occur at line 4:
39+
Once the debugger is run, a breakpoint will occur at line 3:
4040

4141
```txt
4242
$ node debug myscript.js
43-
< debugger listening on port 5858
44-
connecting... ok
43+
< Debugger listening on [::]:5858
44+
connecting to 127.0.0.1:5858 ... ok
4545
break in /home/indutny/Code/git/indutny/myscript.js:1
46-
1 x = 5;
46+
> 1 global.x = 5;
4747
2 setTimeout(() => {
4848
3 debugger;
4949
debug> cont
5050
< hello
5151
break in /home/indutny/Code/git/indutny/myscript.js:3
52-
1 x = 5;
52+
1 global.x = 5;
5353
2 setTimeout(() => {
54-
3 debugger;
54+
> 3 debugger;
5555
4 console.log('world');
5656
5 }, 1000);
5757
debug> next
5858
break in /home/indutny/Code/git/indutny/myscript.js:4
5959
2 setTimeout(() => {
6060
3 debugger;
61-
4 console.log('world');
61+
> 4 console.log('world');
6262
5 }, 1000);
6363
6 console.log('hello');
6464
debug> repl
@@ -68,11 +68,11 @@ Press Ctrl + C to leave debug repl
6868
> 2+2
6969
4
7070
debug> next
71-
< world
7271
break in /home/indutny/Code/git/indutny/myscript.js:5
72+
< world
7373
3 debugger;
7474
4 console.log('world');
75-
5 }, 1000);
75+
> 5 }, 1000);
7676
6 console.log('hello');
7777
7
7878
debug> quit
@@ -121,24 +121,26 @@ is not loaded yet:
121121

122122
```txt
123123
$ node debug test/fixtures/break-in-module/main.js
124-
< debugger listening on port 5858
125-
connecting to port 5858... ok
124+
< Debugger listening on [::]:5858
125+
connecting to 127.0.0.1:5858 ... ok
126126
break in test/fixtures/break-in-module/main.js:1
127-
1 var mod = require('./mod.js');
127+
> 1 var mod = require('./mod.js');
128128
2 mod.hello();
129129
3 mod.hello();
130-
debug> setBreakpoint('mod.js', 23)
130+
debug> setBreakpoint('mod.js', 2)
131131
Warning: script 'mod.js' was not loaded yet.
132-
1 var mod = require('./mod.js');
132+
> 1 var mod = require('./mod.js');
133133
2 mod.hello();
134134
3 mod.hello();
135+
4 debugger;
136+
5
137+
6 });
135138
debug> c
136-
break in test/fixtures/break-in-module/mod.js:23
137-
21
138-
22 exports.hello = () => {
139-
23 return 'hello from module';
140-
24 };
141-
25
139+
break in test/fixtures/break-in-module/mod.js:2
140+
1 exports.hello = function() {
141+
> 2 return 'hello from module';
142+
3 };
143+
4
142144
debug>
143145
```
144146

@@ -198,7 +200,11 @@ $ node --inspect index.js
198200
Debugger listening on port 9229.
199201
Warning: This is an experimental feature and could change at any time.
200202
To start debugging, open the following URL in Chrome:
201-
chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=localhost:9229/node
203+
chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/3a6d0a9e-0707-48f8-a7c6-48f157b67ab5
202204
```
203205

206+
(In the example above, the UUID 3a6d0a9e-0707-48f8-a7c6-48f157b67ab5
207+
at the end of the URL is generated on the fly, it varies in different
208+
debugging sessions.)
209+
204210
[TCP-based protocol]: https://github.com/v8/v8/wiki/Debugging-Protocol

0 commit comments

Comments
 (0)