diff options
author | Fedor Indutny <fedor.indutny@gmail.com> | 2011-11-04 22:20:53 +0600 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2011-11-04 17:50:46 +0100 |
commit | b5d32d4a9ecc76ccb5291badf5e9d91dbfc9fda4 (patch) | |
tree | e9758a8d146bc838fac4f5be12d479a2c59f2d37 | |
parent | 829735e738d34d880ba35c0e114cf9cff4dfedaf (diff) | |
download | nodejs-b5d32d4a9ecc76ccb5291badf5e9d91dbfc9fda4.tar.gz nodejs-b5d32d4a9ecc76ccb5291badf5e9d91dbfc9fda4.tar.bz2 nodejs-b5d32d4a9ecc76ccb5291badf5e9d91dbfc9fda4.zip |
debugger: do not request `continue` on connection
* Updated test
* Use `node debug file`, not `node debug -e "..."` in test
-rw-r--r-- | lib/_debugger.js | 18 | ||||
-rw-r--r-- | test/fixtures/breakpoints.js | 2 | ||||
-rw-r--r-- | test/simple/test-debugger-repl.js | 28 |
3 files changed, 20 insertions, 28 deletions
diff --git a/lib/_debugger.js b/lib/_debugger.js index 7c4db460b..a9c98b271 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -1557,20 +1557,14 @@ Interface.prototype.trySpawn = function(cb) { client.once('ready', function() { self.stdout.write(' ok\n'); - // since we did debug-brk, we're hitting a break point immediately - // continue before anything else. - client.reqContinue(function(err) { - if (err) self.error(err); - - if (cb) cb(); + // Restore breakpoints + breakpoints.forEach(function(bp) { + self.setBreakpoint(bp.scriptId, bp.line, bp.condition, true); + }); - // Restore breakpoints - breakpoints.forEach(function(bp) { - self.setBreakpoint(bp.scriptId, bp.line, bp.condition, true); - }); + if (cb) cb(); - self.resume(); - }); + self.resume(); client.on('close', function() { self.pause(); diff --git a/test/fixtures/breakpoints.js b/test/fixtures/breakpoints.js index c22a56067..8445558df 100644 --- a/test/fixtures/breakpoints.js +++ b/test/fixtures/breakpoints.js @@ -1,5 +1,3 @@ -// wrapper line -debugger; debugger; function a(x) { var i = 10; diff --git a/test/simple/test-debugger-repl.js b/test/simple/test-debugger-repl.js index 500f17952..1bb03a364 100644 --- a/test/simple/test-debugger-repl.js +++ b/test/simple/test-debugger-repl.js @@ -25,9 +25,9 @@ var assert = require('assert'); var spawn = require('child_process').spawn; var debug = require('_debugger'); -var code = require('fs').readFileSync(common.fixturesDir + '/breakpoints.js'); +var script = common.fixturesDir + '/breakpoints.js'; -var child = spawn(process.execPath, ['debug', '-e', code]); +var child = spawn(process.execPath, ['debug', script]); var buffer = ''; child.stdout.setEncoding('utf-8'); @@ -46,7 +46,7 @@ child.on('line', function(line) { assert.ok(expected.length > 0, 'Got unexpected line: ' + line); var expectedLine = expected[0].lines.shift(); - assert.ok(line.match(expectedLine) !== null, expectedLine); + assert.ok(line.match(expectedLine) !== null, line + ' != ' + expectedLine); if (expected[0].lines.length === 0) { var callback = expected[0].callback; @@ -79,14 +79,14 @@ function addTest(input, output) { addTest(null, [ /listening on port 5858/, /connecting... ok/, - /break in .*:3/, - /1/, /2/, /3/, /4/, /5/ + /break in .*:1/, + /1/, /2/, /3/ ]); // Next addTest('n', [ - /break in .*:13/, - /11/, /12/, /13/, /14/, /15/ + /break in .*:11/, + /9/, /10/, /11/, /12/, /13/ ]); // Watch @@ -94,11 +94,11 @@ addTest('watch("\'x\'")'); // Continue addTest('c', [ - /break in .*:7/, + /break in .*:5/, /Watchers/, /0:\s+'x' = "x"/, /()/, - /5/, /6/, /7/, /8/, /9/ + /3/, /4/, /5/, /6/, /7/ ]); // Show watchers @@ -111,19 +111,19 @@ addTest('unwatch("\'x\'")'); // Step out addTest('o', [ - /break in .*:14/, - /12/, /13/, /14/, /15/, /16/ + /break in .*:12/, + /10/, /11/, /12/, /13/, /14/ ]); // Continue addTest('c', [ - /break in .*:7/, - /5/, /6/, /7/, /8/, /9/ + /break in .*:5/, + /3/, /4/, /5/, /6/, /7/ ]); // Set breakpoint by function name addTest('sb("setInterval()", "!(setInterval.flag++)")', [ - /2/, /3/, /4/, /5/, /6/, /7/, /8/, /9/, /10/, /11/, /12/ + /1/, /2/, /3/, /4/, /5/, /6/, /7/, /8/, /9/, /10/ ]); // Continue |