Skip to content
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

Merged
merged 2 commits into from
Apr 12, 2017
Merged

Conversation

ofrobots
Copy link
Contributor

@ofrobots ofrobots commented Feb 17, 2017

node debug is now an alias of node inspect. This is intended to be a minimal change – it does
not 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 a
    pid in node-inspect. Once upstream adds this capability, we can enable
    the test back again.

/cc @nodejs/diagnostics @eugeneo @jkrems

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. c++ Issues and PRs that require attention from people who are familiar with C++. debugger lib / src Issues and PRs related to general changes in the lib or src directory. inspector Issues and PRs related to the V8 inspector protocol labels Feb 17, 2017
@ofrobots ofrobots added semver-major PRs that contain breaking changes and should be released in the next major version. inspector Issues and PRs related to the V8 inspector protocol and removed inspector Issues and PRs related to the V8 inspector protocol labels Feb 17, 2017
@@ -1,13 +0,0 @@
'use strict';
Copy link
Contributor Author

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.

@jasnell jasnell added the wip Issues and PRs that are still a work in progress. label Feb 17, 2017
@joshgav joshgav changed the title inspector: make debug and alias for inspect inspector: make debug an alias for inspect Feb 22, 2017
@joshgav joshgav added the diag-agenda Issues and PRs to discuss during the meetings of the diagnostics working group. label Feb 23, 2017
@@ -39,7 +39,7 @@ const [ InspectClient, createRepl ] =

const debuglog = util.debuglog('inspect');

exports.port = 9229;
Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

joshgav
joshgav previously requested changes Mar 7, 2017
Copy link
Contributor

@joshgav joshgav left a 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!

@@ -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") {
Copy link
Contributor

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+.

NativeModule.require('_debugger').start();

} else if (process.argv[1] === 'inspect') {
} else if (process.argv[1] === 'inspect' || process.argv[1] === 'debug') {
Copy link
Contributor

@joshgav joshgav Mar 7, 2017

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.

@ofrobots
Copy link
Contributor Author

  • @joshgav I have updated the PR to only make debug and alias of inspect. --debug will continue to start the old debug protocol. PTAL.
  • @jkrems This includes Take --debug-port into account node-inspect#26. This is a circular dependency, but I propose we land it here first (assuming tests pass upstream). Also, once node-inspect has the ability to debug PIDs, we can re-enable test-debugger-pid.js.

@ofrobots ofrobots dismissed joshgav’s stale review March 14, 2017 21:53

This PR no longer affects --debug

const expectedUsageMessage = `Usage: node debug script.js
node debug <host>:<port>
node debug -p <pid>
const expectedUsageMessage = `Usage: node-inspect script.js
Copy link
Contributor

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

@jkrems
Copy link
Contributor

jkrems commented Mar 14, 2017

👍 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).

@ofrobots ofrobots added this to the 8.0.0 milestone Mar 15, 2017
Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo comment.

@@ -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']);
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@bnoordhuis
Copy link
Member

I'm afraid this needs a rebase. Seems some conflicting changes were landed today.

@ofrobots
Copy link
Contributor Author

ofrobots commented Apr 4, 2017

Yep, working on that now. In any case, I think it might make sense to land after #11431 and #12197 have landed to minimize conflicts.

@tniessen tniessen added deprecations Issues and PRs related to deprecations. and removed wip Issues and PRs that are still a work in progress. labels Sep 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. c++ Issues and PRs that require attention from people who are familiar with C++. deprecations Issues and PRs related to deprecations. inspector Issues and PRs related to the V8 inspector protocol lib / src Issues and PRs related to general changes in the lib or src directory. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants