forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: Only allow --debug-brk w/ --inspect
- Loading branch information
Jan Krems
committed
May 4, 2017
1 parent
3426b93
commit 50ecfe4
Showing
6 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
const assert = require('assert'); | ||
const execFile = require('child_process').execFile; | ||
const path = require('path'); | ||
|
||
const common = require('../common'); | ||
|
||
const mainScript = path.join(common.fixturesDir, 'loop.js'); | ||
|
||
execFile(process.execPath, [ '--debug-brk', mainScript ], common.mustCall((error, stdout, stderr) => { | ||
assert.equal(error.code, 9); | ||
assert.notEqual(stderr.indexOf('Using --debug-brk without --inspect is no longer supported', -1)); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
common.skipIfInspectorDisabled(); | ||
const assert = require('assert'); | ||
const helper = require('./inspector-helper.js'); | ||
|
||
function setupExpectBreakOnLine(line, url, session, scopeIdCallback) { | ||
return function(message) { | ||
if ('Debugger.paused' === message['method']) { | ||
const callFrame = message['params']['callFrames'][0]; | ||
const location = callFrame['location']; | ||
assert.strictEqual(url, session.scriptUrlForId(location['scriptId'])); | ||
assert.strictEqual(line, location['lineNumber']); | ||
scopeIdCallback && | ||
scopeIdCallback(callFrame['scopeChain'][0]['object']['objectId']); | ||
return true; | ||
} | ||
}; | ||
} | ||
|
||
function testBreakpointOnStart(session) { | ||
const commands = [ | ||
{ 'method': 'Runtime.enable' }, | ||
{ 'method': 'Debugger.enable' }, | ||
{ 'method': 'Debugger.setPauseOnExceptions', | ||
'params': {'state': 'none'} }, | ||
{ 'method': 'Debugger.setAsyncCallStackDepth', | ||
'params': {'maxDepth': 0} }, | ||
{ 'method': 'Profiler.enable' }, | ||
{ 'method': 'Profiler.setSamplingInterval', | ||
'params': {'interval': 100} }, | ||
{ 'method': 'Debugger.setBlackboxPatterns', | ||
'params': {'patterns': []} }, | ||
{ 'method': 'Runtime.runIfWaitingForDebugger' } | ||
]; | ||
|
||
session | ||
.sendInspectorCommands(commands) | ||
.expectMessages(setupExpectBreakOnLine(0, session.mainScriptPath, session)); | ||
} | ||
|
||
function testWaitsForFrontendDisconnect(session, harness) { | ||
console.log('[test]', 'Verify node waits for the frontend to disconnect'); | ||
session.sendInspectorCommands({ 'method': 'Debugger.resume'}) | ||
.expectStderrOutput('Waiting for the debugger to disconnect...') | ||
.disconnect(true); | ||
} | ||
|
||
function runTests(harness) { | ||
harness | ||
.runFrontendSession([ | ||
testBreakpointOnStart, | ||
testWaitsForFrontendDisconnect | ||
]).expectShutDown(55); | ||
} | ||
|
||
helper.startNodeForInspectorTest(runTests, ['--inspect', '--debug-brk']); |
50ecfe4
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.
/cc @ChALkeR FYI - this was my idea for solving the compatibility issue around the change in behavior: Only allowing
--debug-brk
if it's used w/--inspect
and failing otherwise.