Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

debugger: do not request `continue` on connection

* Updated test
* Use `node debug file`, not `node debug -e "..."` in test
  • Loading branch information...
indutny authored and piscisaureus committed Nov 4, 2011
1 parent 829735e commit b5d32d4a9ecc76ccb5291badf5e9d91dbfc9fda4
Showing with 20 additions and 28 deletions.
  1. +6 −12 lib/_debugger.js
  2. +0 −2 test/fixtures/breakpoints.js
  3. +14 −14 test/simple/test-debugger-repl.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();
@@ -1,5 +1,3 @@
// wrapper line
debugger;
debugger;
function a(x) {
var i = 10;
@@ -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,26 +79,26 @@ 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
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

0 comments on commit b5d32d4

Please sign in to comment.
You can’t perform that action at this time.