-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
inspector: make debug
an alias for inspect
#11441
Conversation
@@ -1,13 +0,0 @@ | |||
'use strict'; |
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.
Removed because inspect
behaviour is different from debug
. The former stops before reaching the repl. This test doesn't make sense anymore.
debug
and alias for inspect
debug
an alias for inspect
deps/node-inspect/lib/_inspect.js
Outdated
@@ -39,7 +39,7 @@ const [ InspectClient, createRepl ] = | |||
|
|||
const debuglog = util.debuglog('inspect'); | |||
|
|||
exports.port = 9229; |
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 assume this is to support node --{inspect,debug}-port=1234 {inspect,debug} my-script.js
etc.? If so, I'd rather make that explicit.
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.
Maybe something like this? nodejs/node-inspect#26
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.
Done.
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.
Summary: I think we should wait to alias debug
till Node integrates V8 5.8+, and not at the start of Node 8, assuming Node 8 uses V8 5.7. This provides more notification time for those depending on the legacy interface.
Also, there's a lot of code here unrelated to aliasing debug
. Could that be separated into another PR? It would make review easier. Thanks!
src/node_debug_options.cc
Outdated
@@ -93,15 +93,15 @@ bool DebugOptions::ParseOption(const std::string& option) { | |||
} | |||
|
|||
// --debug and --inspect are mutually exclusive | |||
if (option_name == "--debug") { | |||
/*if (option_name == "--debug") { |
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.
--debug
is the primary way to activate the legacy debugger interface. Aliasing it to --inspect
instead would make it impossible to start that interface. That would break tools which still depend on it.
I think we should keep --debug
associated with the legacy debugger as long as possible, i.e. till we update to V8 5.8+.
lib/internal/bootstrap_node.js
Outdated
NativeModule.require('_debugger').start(); | ||
|
||
} else if (process.argv[1] === 'inspect') { | ||
} else if (process.argv[1] === 'inspect' || process.argv[1] === 'debug') { |
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.
Per my previous comment, I think we should not yet alias --debug
to --inspect
. The reason for not yet aliasing --debug
doesn't apply to node debug
, but for consistency's sake, we should probably not yet alias node debug
to node inspect
either.
|
test/parallel/test-debug-usage.js
Outdated
const expectedUsageMessage = `Usage: node debug script.js | ||
node debug <host>:<port> | ||
node debug -p <pid> | ||
const expectedUsageMessage = `Usage: node-inspect script.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.
Note to future self: This test will need to be updated once we pull in @addaleax's usage text fix. https://github.com/nodejs/node-inspect/pull/20/files
👍 to "cherry-picking" that change (I'll try to do another dependency pull soon so the two code bases don't drift apart too much). |
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 modulo comment.
test/parallel/test-debug-brk.js
Outdated
@@ -65,6 +65,6 @@ function test(extraArgs, stdoutPattern) { | |||
|
|||
test(['-e', '0']); | |||
test(['-e', '0', 'foo']); | |||
test(['-p', 'process.argv[1]', 'foo'], /^\s*foo\s*$/); | |||
test(['-p', 'process.argv[1]', 'foo']); |
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.
You're leaving behind dead code with this change. Remove stdoutPattern
and outputMatched
from test(). There may be more.
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.
Done.
I'm afraid this needs a rebase. Seems some conflicting changes were landed today. |
node debug
is now an alias ofnode inspect
. This is intended to be a minimal change – it doesnot get rid of the old debugger code. That can be done in a follow-on.
This commit has a circular dependency on Take --debug-port into account node-inspect#26. I propose that we land here, and then later land upstream.test-debugger-pid.js
disabled because it depends on ability to debug apid in node-inspect. Once upstream adds this capability, we can enable
the test back again.
/cc @nodejs/diagnostics @eugeneo @jkrems