-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: match debugger output & instructions to master behavior #13885
Conversation
doc/api/debugger.md
Outdated
$ node inspect myscript.js | ||
< Debugger listening on ws://127.0.0.1:9229/80e7a814-7cd3-49fb-921a-2e02228cd5ba | ||
< For help see https://nodejs.org/en/docs/inspector | ||
< Debugger attached. |
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.
I do not see this line in 8.1.2 output.
doc/api/debugger.md
Outdated
2 setTimeout(() => { | ||
3 debugger; | ||
3 console.log('world'); |
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.
If you have not changed the code example below, this should still remain:
3 debugger;
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.
Yeah, I wasn't sure about the exact "order" here. Because it first shows this and then later/below says (emphasis mine):
Inserting the statement
debugger;
into the source code of a script will
enable a breakpoint at that position in the code:
I interpreted that as "this is showing the original script run, then you insert debugger
, then you run it again".
doc/api/debugger.md
Outdated
> 1 global.x = 5; | ||
< Debugger listening on ws://127.0.0.1:9229/80e7a814-7cd3-49fb-921a-2e02228cd5ba | ||
< For help see https://nodejs.org/en/docs/inspector | ||
< Debugger attached. |
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.
I do not see this line in 8.1.2 output.
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.
doc/api/debugger.md
Outdated
@@ -69,14 +71,14 @@ Press Ctrl + C to leave debug repl | |||
> 2+2 | |||
4 | |||
debug> next | |||
break in /home/indutny/Code/git/indutny/myscript.js:5 | |||
break in myscript.js:5 |
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.
I see this order in 8.1.2:
debug> next
< world
break in myscript.js:5
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.
Yep! Missed that one.
doc/api/debugger.md
Outdated
@@ -41,22 +42,23 @@ Once the debugger is run, a breakpoint will occur at line 3: | |||
|
|||
```txt | |||
$ node debug myscript.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.
It seems this also should be:
$ node inspect myscript.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.
Good catch!
doc/api/debugger.md
Outdated
$ node inspect test/fixtures/break-in-module/main.js | ||
< Debugger listening on ws://127.0.0.1:9229/4e3db158-9791-4274-8909-914f7facf3bd | ||
< For help see https://nodejs.org/en/docs/inspector | ||
< Debugger attached. |
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.
I do not see this line in 8.1.2 output.
doc/api/debugger.md
Outdated
< For help see https://nodejs.org/en/docs/inspector | ||
< Debugger attached. | ||
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(); | ||
3 mod.hello(); | ||
debug> setBreakpoint('mod.js', 2) |
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.
2 -> 22 (due to copyright added recently):
debug> setBreakpoint('mod.js', 22)
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.
Interesting. I think the current instruction happened to work because it was smart enough to "shift" beyond the comment. But using 22
is definitely less confusing. 👍
doc/api/debugger.md
Outdated
3 mod.hello(); | ||
4 debugger; | ||
5 | ||
6 }); | ||
debug> c | ||
break in test/fixtures/break-in-module/mod.js:2 |
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.
2 -> 22:
break in test/fixtures/break-in-module/mod.js:22
Maybe we also should update the link to redirected one (line 194): |
the last example may also be updated to: $ node --inspect index.js
Debugger listening on ws://127.0.0.1:9229/dc9010dd-f8b8-4ac5-a510-c1a114ec7d29
For help see https://nodejs.org/en/docs/inspector |
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.
I'm LGTM if the nits raised by @vsemozhetbyt are attached - I see the same output as @vsemozhetbyt - without the "Debugger attached." line.
I'm not sure what's up with the "Debugger attached". I'm testing on macOS 10.12.5 if that makes any difference..? Anyhow, the straight-up wrong stuff should be fixed now. :) |
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.
LGTM. If the output is different between master and Node 8, then this might need to be adjusted during backporting.
There is a small glimpse on the start, so I supposed this line was just rewritten on Windows. I've run this with redirection to a file and even have recorded a video and watched it frame by frame. There are some rewritten lines, but still, no "Debugger attached" among them:
�< Debugger listening on ws://127.0.0.1:9229/9ab1ed89-f254-4415-97eb-c99d61555806
< For help see https://nodejs.org/en/docs/inspector
�connecting to 127.0.0.1:9229 ... okdebug> �Break on start in test.js:1
> 1 (function (exports, require, module, __filename, __dirname) { global.x = 5;
2 setTimeout(() => {
3 debugger;
debug> |
Interesting. Will investigate what's up on Windows. One possible answer could be stdout vs. stderr - Line 396 in 6e2c29b
Given current information I suspect this is a bug (?) on Windows. The message should be printed. |
6496ca3
to
b647f04
Compare
Landed in b647f04. |
PR-URL: #13885 Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #13885 Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #13885 Reviewed-By: Colin Ihrig <[email protected]>
Follow-up to #13777. Updates
debugger.md
with instructions & output that match behavior in node 8 / master.Previously the instructions would at best trigger deprecation warnings and at worst fail completely.
Checklist
Affected core subsystem(s)
doc