debugger: check -e flag in debug break setup #8876

Closed
wants to merge 2 commits into
from

Projects

None yet

7 participants

@kjin
Contributor
kjin commented Oct 1, 2016
Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

module

Description of change

When both --debug-brk and --eval are set, and a filename is
specified, its full path is not set correctly, causing an error
for relative filenames with './' omitted.

For example, 'node --debug-brk -e 0 hello.js' throws an error.

Since the script referenced by the filename is never run anyway,
this change skips resolving its full path if both --debug-brk and
--eval are set.

@mscdex mscdex added the debugger label Oct 1, 2016
lib/module.js
@@ -61,7 +61,6 @@ Module._debug = util.debuglog('module');
// We use this alias for the preprocessor that filters it out
const debug = Module._debug;
-
@mscdex
mscdex Oct 1, 2016 Contributor

Unnecessary whitespace change

@kjin
kjin Oct 1, 2016 Contributor

Whoops, updated!

@mscdex mscdex added process and removed module labels Oct 1, 2016
@kjin kjin module: check -e flag in debug break setup
When both --debug-brk and --eval are set, and a filename is
specified, its full path is not set correctly, causing an error
for relative filenames with './' omitted.

For example, 'node --debug-brk -e 0 hello.js' throws an error.

Since the script referenced by the filename is never run anyway,
this change skips resolving its full path if both --debug-brk and
--eval are set.
9f22b8c
@bnoordhuis

Can you add a check that verifies the 'foo' argument is not evaluated? Basically, that node --debug-brk -p process.argv[1] foo prints 'foo'.

@kjin
Contributor
kjin commented Oct 2, 2016

@bnoordhuis I've modified test-debug-brk.js to match the contents of stdout - it checks that node --debug-brk -p process.argv[1] foo does indeed print 'foo'.

test/parallel/test-debug-brk.js
+ proc.stderr.on('data', (chunk) => {
+ procStderr += chunk;
+ debuggerListening = debuggerListening ||
+ /Debugger listening on/.test(procStderr);
@bnoordhuis
bnoordhuis Oct 3, 2016 Member

Tiny style nit: line continuations should have four spaces of indent. The linter is supposed to check that but it's possible it gets thrown off by the binary operator.

test/parallel/test-debug-brk.js
+
+test(['-e', '0']);
+test(['-e', '0', 'foo']);
+test(['-p', 'process.argv[1]', 'foo'], /foo/);
@bnoordhuis
bnoordhuis Oct 3, 2016 Member

Can you make this a little stricter? E.g. /^\s*foo\s*$/.

@kjin kjin test checks output
54be1e4
@kjin
Contributor
kjin commented Oct 3, 2016

@bnoordhuis Thanks for taking a look - I've made the requested changes, make lint is error-free.

@kjin kjin changed the title from module: check -e flag in debug break setup to debugger: check -e flag in debug break setup Oct 3, 2016
@jasnell
jasnell approved these changes Oct 6, 2016 View changes

LGTM if @bnoordhuis and @mscdex are also good with it.

@bnoordhuis

LGTM too.

@jasnell
Member
jasnell commented Oct 7, 2016

CI failures appear to be unrelated flaky tests. @mscdex does this LGTY?

@jasnell
Member
jasnell commented Oct 26, 2016

ping @mscdex

@mscdex
Contributor
mscdex commented Oct 26, 2016 edited

@jasnell I'm not familiar enough with the debugger to really sign off on the (non-test) change, but as far as the one whitespace change I pointed out is concerned, @kjin removed that.

@kjin
Contributor
kjin commented Nov 14, 2016

@jasnell It seems like there are no significant build problems with this change, is it ready to be merged in?

@matthewloring matthewloring added a commit to matthewloring/node that referenced this pull request Nov 15, 2016
@kjin @matthewloring kjin + matthewloring module: check -e flag in debug break setup
When both --debug-brk and --eval are set, and a filename is
specified, its full path is not set correctly, causing an error
for relative filenames with './' omitted.

For example, 'node --debug-brk -e 0 hello.js' throws an error.

Since the script referenced by the filename is never run anyway,
this change skips resolving its full path if both --debug-brk and
--eval are set.

PR-URL: nodejs#8876
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
ebff29f
@matthewloring
Contributor

Thanks! Landed in ebff29f.

@addaleax addaleax added a commit that referenced this pull request Nov 22, 2016
@kjin @addaleax kjin + addaleax module: check -e flag in debug break setup
When both --debug-brk and --eval are set, and a filename is
specified, its full path is not set correctly, causing an error
for relative filenames with './' omitted.

For example, 'node --debug-brk -e 0 hello.js' throws an error.

Since the script referenced by the filename is never run anyway,
this change skips resolving its full path if both --debug-brk and
--eval are set.

PR-URL: #8876
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
34c8b0b
@MylesBorins
Member

this is not landing cleanly on v4.x. Can someone please do a manual backport?

@MylesBorins MylesBorins added a commit that referenced this pull request Dec 13, 2016
@kjin @MylesBorins kjin + MylesBorins module: check -e flag in debug break setup
When both --debug-brk and --eval are set, and a filename is
specified, its full path is not set correctly, causing an error
for relative filenames with './' omitted.

For example, 'node --debug-brk -e 0 hello.js' throws an error.

Since the script referenced by the filename is never run anyway,
this change skips resolving its full path if both --debug-brk and
--eval are set.

PR-URL: #8876
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
3689813
@MylesBorins MylesBorins added a commit that referenced this pull request Dec 21, 2016
@kjin @MylesBorins kjin + MylesBorins module: check -e flag in debug break setup
When both --debug-brk and --eval are set, and a filename is
specified, its full path is not set correctly, causing an error
for relative filenames with './' omitted.

For example, 'node --debug-brk -e 0 hello.js' throws an error.

Since the script referenced by the filename is never run anyway,
this change skips resolving its full path if both --debug-brk and
--eval are set.

PR-URL: #8876
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
d833be3
@MylesBorins MylesBorins referenced this pull request Dec 21, 2016
Merged

V6.9.3 proposal #10394

@MylesBorins MylesBorins added a commit to MylesBorins/node that referenced this pull request Jan 3, 2017
@MylesBorins MylesBorins 2016-01-03, Version 6.9.3 'Boron' (LTS) Release
This LTS release comes with 312 commits. This includes 229 that are
test related, 62 that are docs related, 17 which are build / tools
related, and 4 commits which are updates to dependencies.

Notable Changes:

* build:
  - shared library support is now working for AIX builds
    (Stewart Addison) nodejs#9675
* deps:
    - *npm*: upgrade npm to 3.10.10 (Rebecca Turner)
             nodejs#9847
    - *V8*: Destructuring of arrow function arguments via computed
            property no longer throws (Michaël Zasso)
            nodejs#10386)
* inspector:
  - /json/version returns object, not an object wrapped in an array
    (Ben Noordhuis) nodejs#9762
* module:
  - using --debug-brk and --eval together now works as expected
    (Kelvin Jin) nodejs#8876
* process:
  - improve performance of nextTick up to 20% (Evan Lucas)
    nodejs#8932
* repl:
    - the division operator will no longer be accidentally parsed as
      regex (Teddy Katz) nodejs#10103
    - improved support for generator functions (Teddy Katz)
      nodejs#9852
* timers:
  - Re canceling a cancelled timers will no longer throw
    (Jeremiah Senkpiel) nodejs#9685

PR-URL: nodejs#10394
93a9109
@MylesBorins MylesBorins added a commit that referenced this pull request Jan 3, 2017
@MylesBorins MylesBorins 2017-01-03, Version 6.9.3 'Boron' (LTS) Release
This LTS release comes with 312 commits. This includes 229 that are
test related, 62 that are docs related, 17 which are build / tools
related, and 4 commits which are updates to dependencies.

Notable Changes:

* build:
  - shared library support is now working for AIX builds
    (Stewart Addison) #9675
* deps:
    - *npm*: upgrade npm to 3.10.10 (Rebecca Turner)
             #9847
    - *V8*: Destructuring of arrow function arguments via computed
            property no longer throws (Michaël Zasso)
            #10386)
* inspector:
  - /json/version returns object, not an object wrapped in an array
    (Ben Noordhuis) #9762
* module:
  - using --debug-brk and --eval together now works as expected
    (Kelvin Jin) #8876
* process:
  - improve performance of nextTick up to 20% (Evan Lucas)
    #8932
* repl:
    - the division operator will no longer be accidentally parsed as
      regex (Teddy Katz) #10103
    - improved support for generator functions (Teddy Katz)
      #9852
* timers:
  - Re canceling a cancelled timers will no longer throw
    (Jeremiah Senkpiel) #9685

PR-URL: #10394
42149d7
@MylesBorins MylesBorins added a commit that referenced this pull request Jan 3, 2017
@MylesBorins MylesBorins 2017-01-03, Version 6.9.3 'Boron' (LTS) Release
This LTS release comes with 312 commits. This includes 229 that are
test related, 62 that are docs related, 17 which are build / tools
related, and 4 commits which are updates to dependencies.

Notable Changes:

* build:
  - shared library support is now working for AIX builds
    (Stewart Addison) #9675
* deps:
    - *npm*: upgrade npm to 3.10.10 (Rebecca Turner)
             #9847
    - *V8*: Destructuring of arrow function arguments via computed
            property no longer throws (Michaël Zasso)
            #10386)
* inspector:
  - /json/version returns object, not an object wrapped in an array
    (Ben Noordhuis) #9762
* module:
  - using --debug-brk and --eval together now works as expected
    (Kelvin Jin) #8876
* process:
  - improve performance of nextTick up to 20% (Evan Lucas)
    #8932
* repl:
    - the division operator will no longer be accidentally parsed as
      regex (Teddy Katz) #10103
    - improved support for generator functions (Teddy Katz)
      #9852
* timers:
  - Re canceling a cancelled timers will no longer throw
    (Jeremiah Senkpiel) #9685

PR-URL: #10394
2bf1c24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment