-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: update output examples in debugger.md #10944
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,10 @@ will be displayed indicating successful launch of the debugger: | |
|
||
```txt | ||
$ node debug myscript.js | ||
< debugger listening on port 5858 | ||
connecting... ok | ||
< Debugger listening on 127.0.0.1:5858 | ||
connecting to 127.0.0.1:5858 ... ok | ||
break in /home/indutny/Code/git/indutny/myscript.js:1 | ||
1 x = 5; | ||
> 1 global.x = 5; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
2 setTimeout(() => { | ||
3 debugger; | ||
debug> | ||
|
@@ -28,7 +28,7 @@ enable a breakpoint at that position in the code: | |
|
||
```js | ||
// myscript.js | ||
x = 5; | ||
global.x = 5; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
setTimeout(() => { | ||
debugger; | ||
console.log('world'); | ||
|
@@ -40,25 +40,25 @@ Once the debugger is run, a breakpoint will occur at line 4: | |
|
||
```txt | ||
$ node debug myscript.js | ||
< debugger listening on port 5858 | ||
connecting... ok | ||
< Debugger listening on 127.0.0.1:5858 | ||
connecting to 127.0.0.1:5858 ... ok | ||
break in /home/indutny/Code/git/indutny/myscript.js:1 | ||
1 x = 5; | ||
> 1 global.x = 5; | ||
2 setTimeout(() => { | ||
3 debugger; | ||
debug> cont | ||
< hello | ||
break in /home/indutny/Code/git/indutny/myscript.js:3 | ||
1 x = 5; | ||
1 global.x = 5; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
2 setTimeout(() => { | ||
3 debugger; | ||
> 3 debugger; | ||
4 console.log('world'); | ||
5 }, 1000); | ||
debug> next | ||
break in /home/indutny/Code/git/indutny/myscript.js:4 | ||
2 setTimeout(() => { | ||
3 debugger; | ||
4 console.log('world'); | ||
> 4 console.log('world'); | ||
5 }, 1000); | ||
6 console.log('hello'); | ||
debug> repl | ||
|
@@ -68,11 +68,11 @@ Press Ctrl + C to leave debug repl | |
> 2+2 | ||
4 | ||
debug> next | ||
< world | ||
break in /home/indutny/Code/git/indutny/myscript.js:5 | ||
< world | ||
3 debugger; | ||
4 console.log('world'); | ||
5 }, 1000); | ||
> 5 }, 1000); | ||
6 console.log('hello'); | ||
7 | ||
debug> quit | ||
|
@@ -121,24 +121,26 @@ isn't loaded yet: | |
|
||
```txt | ||
$ node debug test/fixtures/break-in-module/main.js | ||
< debugger listening on port 5858 | ||
connecting to port 5858... ok | ||
< Debugger listening on 127.0.0.1:5858 | ||
connecting to 127.0.0.1:5858 ... ok | ||
break in test/fixtures/break-in-module/main.js:1 | ||
1 var mod = require('./mod.js'); | ||
> 1 const mod = require('./mod.js'); | ||
2 mod.hello(); | ||
3 mod.hello(); | ||
debug> setBreakpoint('mod.js', 23) | ||
debug> setBreakpoint('mod.js', 2) | ||
Warning: script 'mod.js' was not loaded yet. | ||
1 var mod = require('./mod.js'); | ||
> 1 const mod = require('./mod.js'); | ||
2 mod.hello(); | ||
3 mod.hello(); | ||
4 debugger; | ||
5 | ||
6 }); | ||
debug> c | ||
break in test/fixtures/break-in-module/mod.js:23 | ||
21 | ||
22 exports.hello = () => { | ||
23 return 'hello from module'; | ||
24 }; | ||
25 | ||
break in test/fixtures/break-in-module/mod.js:2 | ||
1 exports.hello = function() { | ||
> 2 return 'hello from module'; | ||
3 }; | ||
4 | ||
debug> | ||
``` | ||
|
||
|
@@ -203,9 +205,13 @@ $ node --inspect index.js | |
Debugger listening on port 9229. | ||
Warning: This is an experimental feature and could change at any time. | ||
To start debugging, open the following URL in Chrome: | ||
chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=localhost:9229/node | ||
chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/dc9010dd-f8b8-4ac5-a510-c1a114ec7d29 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfotunately the UUID changes with each Node instance, so we shouldn't use a specific one here. Perhaps a placeholder like |
||
``` | ||
|
||
(In the example above, the UUID dc9010dd-f8b8-4ac5-a510-c1a114ec7d29 | ||
at the end of the URL is generated on the fly, it varies in different | ||
debugging sessions) | ||
|
||
[Chrome Debugging Protocol]: https://chromedevtools.github.io/debugger-protocol-viewer/ | ||
[TCP-based protocol]: #debugger_tcp_based_protocol | ||
[V8 Inspector Integration]: #debugger_v8_inspector_integration_for_node_js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var x = 5