@@ -11,10 +11,10 @@ will be displayed indicating successful launch of the debugger:
11
11
12
12
``` txt
13
13
$ 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
16
16
break in /home/indutny/Code/git/indutny/myscript.js:1
17
- 1 x = 5;
17
+ > 1 global. x = 5;
18
18
2 setTimeout(() => {
19
19
3 debugger;
20
20
debug>
@@ -28,37 +28,37 @@ enable a breakpoint at that position in the code:
28
28
29
29
``` js
30
30
// myscript.js
31
- x = 5 ;
31
+ global . x = 5 ;
32
32
setTimeout (() => {
33
33
debugger ;
34
34
console .log (' world' );
35
35
}, 1000 );
36
36
console .log (' hello' );
37
37
```
38
38
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 :
40
40
41
41
``` txt
42
42
$ 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
45
45
break in /home/indutny/Code/git/indutny/myscript.js:1
46
- 1 x = 5;
46
+ > 1 global. x = 5;
47
47
2 setTimeout(() => {
48
48
3 debugger;
49
49
debug> cont
50
50
< hello
51
51
break in /home/indutny/Code/git/indutny/myscript.js:3
52
- 1 x = 5;
52
+ 1 global. x = 5;
53
53
2 setTimeout(() => {
54
- 3 debugger;
54
+ > 3 debugger;
55
55
4 console.log('world');
56
56
5 }, 1000);
57
57
debug> next
58
58
break in /home/indutny/Code/git/indutny/myscript.js:4
59
59
2 setTimeout(() => {
60
60
3 debugger;
61
- 4 console.log('world');
61
+ > 4 console.log('world');
62
62
5 }, 1000);
63
63
6 console.log('hello');
64
64
debug> repl
@@ -68,11 +68,11 @@ Press Ctrl + C to leave debug repl
68
68
> 2+2
69
69
4
70
70
debug> next
71
- < world
72
71
break in /home/indutny/Code/git/indutny/myscript.js:5
72
+ < world
73
73
3 debugger;
74
74
4 console.log('world');
75
- 5 }, 1000);
75
+ > 5 }, 1000);
76
76
6 console.log('hello');
77
77
7
78
78
debug> quit
@@ -121,24 +121,26 @@ is not loaded yet:
121
121
122
122
``` txt
123
123
$ 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
126
126
break in test/fixtures/break-in-module/main.js:1
127
- 1 var mod = require('./mod.js');
127
+ > 1 var mod = require('./mod.js');
128
128
2 mod.hello();
129
129
3 mod.hello();
130
- debug> setBreakpoint('mod.js', 23 )
130
+ debug> setBreakpoint('mod.js', 2 )
131
131
Warning: script 'mod.js' was not loaded yet.
132
- 1 var mod = require('./mod.js');
132
+ > 1 var mod = require('./mod.js');
133
133
2 mod.hello();
134
134
3 mod.hello();
135
+ 4 debugger;
136
+ 5
137
+ 6 });
135
138
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
142
144
debug>
143
145
```
144
146
@@ -198,7 +200,11 @@ $ node --inspect index.js
198
200
Debugger listening on port 9229.
199
201
Warning: This is an experimental feature and could change at any time.
200
202
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
202
204
```
203
205
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
+
204
210
[ TCP-based protocol ] : https://github.com/v8/v8/wiki/Debugging-Protocol
0 commit comments