Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

debugger: deprecate built-in debugger #6507

Closed
wants to merge 1 commit into from

8 participants

@bnoordhuis

Reduce the maintenance burden a little by deprecating the built-in
debugger.

Polls in the IRC channel and on the mailing list suggest that not many
people use the debugger or even know it exists. The few that do are
generally happy to see it get moved into a separate npm module.

This commit takes the first step my deprecating the debugger and
removing its tests. The tests were very flaky anyway, they won't
be missed.

Suggested reviewers: @indutny @tjfontaine @trevnorris - there's not much to review, it's mostly removal.

@bnoordhuis bnoordhuis debugger: deprecate built-in debugger
Reduce the maintenance burden a little by deprecating the built-in
debugger.

Polls in the IRC channel and on the mailing list suggest that not many
people use the debugger or even know it exists.  The few that do are
generally happy to see it get moved into a separate npm module.

This commit takes the first step my deprecating the debugger and
removing its tests.  The tests were very flaky anyway, they won't
be missed.
37dfeac
@indutny
Owner

Its sad to see it, but LGTM. We should move it to user-land!

@trevnorris
Owner

+1 and a LGTM

Do the necessary hooks exist so this can be built in userland?

@luk-

I know the decision is already made and it's probably for the better, but I'm going to be the person to mention that IRC & mailing list polls will only get you a certain kind of feedback. I have multiple colleagues at Yahoo who rely on the debugger and we were hoping to add more functionality to it, noted in #6368. A lot of these developers are so focused on building software that they don't idle in the node.js IRC channel or keep hourly tabs on the mailing list.

I'm aware that deprecation doesn't mean it's being removed from core just yet, but I hope before it is, the hooks can provide enough utility to build something with on-parity base functionality. Maybe that's possible already. If you're looking for feedback on these hooks both @davglass and myself can be points of contact, and we're very interested in being in the loop on the subject.

@tjfontaine
Owner

As much as I'm not a fan of the repl in node in general (debugger or otherwise), I'm not yet convinced we should deprecate the debugger repl outright.

At the very least, I would like to take yet another pass at rewriting the tests to something less magical which may require some of the very hooks in question.

Having better/saner hooks for enabling/disabling a debugger should absolutely be explored as is our custom.

Also, encouraging and helping design a replacement that can be fostered in module space would be key before any potential removal. Node would not be so drastic as to remove the debugger (or any feature) without having a migration path for consumers. We're too late in the game to make such hasty moves.

@luk- don't worry, I think we'll be soliciting more information.

@othiym23

I would happily trade the current core tests and the pain of transitioning the current CLI debugger to an npm package for a well-documented, stable debugger interface that builds on the V8 debugger protocol and adds support for e.g. stepping through asynchronous calls. I am also happy to contribute time to replacing the current flaky tests with something more maintainable and robust.

I have concerns about this PR, though, because the tests for the debugging interface are already pretty minimal / the coverage isn't great, and any replacement for the current debugger REPL is going to need something to build upon. Also, I'd prefer to see a stable npm build of the debugger followed by deprecation and removal rather than the current proposal. Some of us need a stable way to step through JavaScript source that's quick to start and available from the shell, and deprecating it without a replacement being available is a pretty poor developer experience.

@trevnorris
Owner

@tjfontaine You know I'm a fan for Node having more hooks for users to build their own functionality and less core feature implementation. Though I'm not very familiar with the debugger or repl. Let's have a discussion about what hooks are necessary for users to implement the same in user-land.

@tjfontaine
Owner

@trevnorris having the appropriate sane and supportable hooks is going to happen. I am reluctant to remove something we have already shipped and people depend on, even if the first step is only deprecation.

@trevnorris
Owner

@tjfontaine ok, then let's get started on creating those hooks! :)

@bnoordhuis

having the appropriate sane and supportable hooks is going to happen

We already have the hooks and they're not going away. Modules like node-inspector only need --debug/--debug-brk and optionally the ability to start the debugger with a SIGUSR1 signal.

This PR only deals with the debugger client (the REPL.) Truth be told, I don't really have a strong opinion on whether or not it should go. If it's controversial, then we'll just leave it in.

The thing is that it doesn't seem to have many users (but see below), doesn't get much love from us maintainers and the test suite's coverage and reliability is terrible.

That's why I'm proposing to deprecate it in core and move it into a module. It has a better chance of improving that way than when every pull request has to go through one of us.

I know the decision is already made and it's probably for the better, but I'm going to be the person to mention that IRC & mailing list polls will only get you a certain kind of feedback.

That's true but what can you do? It's imperfect but I think some conclusions can be drawn from the results. If many of the "in-crowd" don't even know that the debugger exists (let alone use it), then it's probably fair to extrapolate that to the broader user base.

@rlidwka

Dumb question: what would it take to make gdb work with node/javascript?

@bnoordhuis

You get rudimentary gdb support when you configure with ./configure --gdb (requires a gdb with gdb jit support).

It makes JS function names show up in stack traces and (in theory) makes it possible to place breakpoints on JS functions. It might be possible to make gdb decode function arguments as well but I don't think it does right now.

Another option is to extend gdb through its python API. V8 has a basic script for that but it was a little flaky last time I tested it and, well, it's really basic - there's a lot more you can do.

@bnoordhuis

Okay, after some more discussion we've decided to keep the debugger for now. We still may end up ditching the tests unless someone gets around to rewriting them and make them not fail every 1 out of 2 runs.

@bnoordhuis bnoordhuis closed this
@luk-

That's true but what can you do? It's imperfect but I think some conclusions can be drawn from the results. If many of the "in-crowd" don't even know that the debugger exists (let alone use it), then it's probably fair to extrapolate that to the broader user base.

Sorry for the late reply, I didn't notice the email notification.

I think there's some truth to this but it's not nearly as accurate a depiction when proportionally scaled up.

Consider common arguments that take place on the mailing list: promises vs callbacks, small modules vs large frameworks, testing libraries, preferred control flow aggregation libraries, ES6 is ruining the world, etc, etc, etc.

To an extent, conversations like these will take place internally at large companies in person and on internal mailing lists, sure. The key difference is that while these discussions and mailing list threads are often a runaway train on the node mailing list, their place on internal discussions at companies is a lot more focused, between skilled and experienced engineers who want to solve a problem and get their work done, not argue all day. These conversations tend to end pretty quickly with objective rationality. The official node mailing list is a mainly open discussion forum where participants of all backgrounds and skill levels with various amounts of free time can chime in. That's not a bad thing at all, but it means that it takes more effort to determine how objective and fact-based an argument tends to be.

The point I'm trying to make is that values expressed and not expressed on the official mailing list are a good representative of the people who participate actively in public mailing lists. A colleague of mine today at a daily standup expressed concern over debugger, because it's an indispensable tool for him. Sure, maybe it would help in cases like this if he were more active on the mailing list, but he's not. He's busy spending his work hours writing software that powers node applications at Yahoo, and there are a lot of people like him who dedicate their time to writing software instead of deliberating in public forums. I work with a lot of people like this. I would love to see them participate more in discussions and try to encourage it as much as possible, but "what can you do," right?

#Node.js on IRC is also an even worse crowd to poll for something like this, since most of the discussion there is newcomers asking basic node or javascript questions. Seriously, just look at the logs.

I have a lot of confidence in what the core team does with the project and after talking about debugger more on an individual level, it sounds like this is the right way to go. I know it's not just getting pulled out completely, and there are hooks on the roadmap. If it even comes down to those of us who work on node stuff at Yahoo giving feedback and helping out, I don't doubt we can do that.

Finally, I hate writing conclusions to unnecessarily long replies, so I hope this is good enough closure if I end this sentence without proper punctuation

@VRMink

I am one of those developers who don't often participate in the public debate, and I am also one who spends more time in repl than anywhere else. I would personally regret to see it go.

Node has such a basic set of tools for debugging that if you take "debugger" out of core without replacing it with something else, I believe many newcomers will leave because of this lack of tools.

In my opinion core should consist of all of the tools you need to build a basic application, because many node users are not very well informed about the user land packages available, so removing it from core would remove it from their experience of Node.

+1 for building a better replacement first. GDB support sounds like a great idea.

@bajtos bajtos referenced this pull request in node-inspector/node-inspector
Closed

debugger.js restructured #331

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 13, 2013
  1. @bnoordhuis

    debugger: deprecate built-in debugger

    bnoordhuis authored
    Reduce the maintenance burden a little by deprecating the built-in
    debugger.
    
    Polls in the IRC channel and on the mailing list suggest that not many
    people use the debugger or even know it exists.  The few that do are
    generally happy to see it get moved into a separate npm module.
    
    This commit takes the first step my deprecating the debugger and
    removing its tests.  The tests were very flaky anyway, they won't
    be missed.
This page is out of date. Refresh to see the latest.
View
6 doc/api/debugger.markdown
@@ -1,9 +1,13 @@
# Debugger
- Stability: 3 - Stable
+ Stability: 0 - Deprecated
<!-- type=misc -->
+Note: the built-in debugger is deprecated. No new features will be added, bug
+fixes will be applied sparingly if at all. Longer term, it will be moved out
+of node.js core and into a separate npm module.
+
V8 comes with an extensive debugger which is accessible out-of-process via a
simple [TCP protocol](http://code.google.com/p/v8/wiki/DebuggerProtocol).
Node has a built-in client for this debugger. To use this, start Node with the
View
3  lib/_debugger.js
@@ -35,6 +35,9 @@ exports.start = function(argv, stdin, stdout) {
process.exit(1);
}
+ console.error('* The debugger is unsupported in this release.\n' +
+ '* Please see http://nodejs.org/docs/latest/api/debugger.html');
+
// Setup input/output streams
stdin = stdin || process.stdin;
stdout = stdout || process.stdout;
View
124 test/pummel/test-debug-break-on-uncaught.js
@@ -1,124 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var path = require('path');
-var assert = require('assert');
-var spawn = require('child_process').spawn;
-var common = require('../common');
-var debug = require('_debugger');
-
-addScenario('global.js', null, 2);
-addScenario('timeout.js', null, 2);
-addScenario('domain.js', null, 10);
-
-// Exception is thrown from vm.js via module.js (internal file)
-// var compiledWrapper = runInThisContext(wrapper, filename, 0, true);
-addScenario('parse-error.js', 'vm.js', null);
-
-run();
-
-/***************** IMPLEMENTATION *****************/
-
-var scenarios;
-function addScenario(scriptName, throwsInFile, throwsOnLine) {
- if (!scenarios) scenarios = [];
- scenarios.push(
- runScenario.bind(null, scriptName, throwsInFile, throwsOnLine, run)
- );
-}
-
-function run() {
- var next = scenarios.shift();
- if (next) next();
-}
-
-function runScenario(scriptName, throwsInFile, throwsOnLine, next) {
- console.log('**[ %s ]**', scriptName);
- var asserted = false;
- var port = common.PORT + 1337;
-
- var testScript = path.join(
- common.fixturesDir,
- 'uncaught-exceptions',
- scriptName
- );
-
- var child = spawn(process.execPath, [ '--debug-brk=' + port, testScript ]);
- child.on('close', function() {
- assert(asserted, 'debugger did not pause on exception');
- if (next) next();
- })
-
- var exceptions = [];
-
- setTimeout(setupClient.bind(null, runTest), 200);
-
- function setupClient(callback) {
- var client = new debug.Client();
-
- client.once('ready', callback.bind(null, client));
-
- client.on('unhandledResponse', function(body) {
- console.error('unhandled response: %j', body);
- });
-
- client.on('error', function(err) {
- if (asserted) return;
- assert.ifError(err);
- });
-
- client.connect(port);
- }
-
- function runTest(client) {
- client.req(
- {
- command: 'setexceptionbreak',
- arguments: {
- type: 'uncaught',
- enabled: true
- }
- },
- function(error, result) {
- assert.ifError(error);
-
- client.on('exception', function(event) {
- exceptions.push(event.body);
- });
-
- client.reqContinue(function(error, result) {
- assert.ifError(error);
- setTimeout(assertHasPaused.bind(null, client), 100);
- });
- }
- );
- }
-
- function assertHasPaused(client) {
- assert.equal(exceptions.length, 1, 'debugger did not pause on exception');
- assert.equal(exceptions[0].uncaught, true);
- assert.equal(exceptions[0].script.name, throwsInFile || testScript);
- if (throwsOnLine != null)
- assert.equal(exceptions[0].sourceLine + 1, throwsOnLine);
- asserted = true;
- client.reqContinue(assert.ifError);
- }
-}
View
80 test/pummel/test-debugger-repl-break-in-module.js
@@ -1,80 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var repl = require('../simple/helper-debugger-repl.js');
-
-repl.startDebugger('break-in-module/main.js');
-
-// -- SET BREAKPOINT --
-
-// Set breakpoint by file name + line number where the file is not loaded yet
-repl.addTest('sb("mod.js", 23)', [
- /Warning: script 'mod\.js' was not loaded yet\./,
- /1/, /2/, /3/, /4/, /5/, /6/
-]);
-
-// Check escaping of regex characters
-repl.addTest('sb(")^$*+?}{|][(.js\\\\", 1)', [
- /Warning: script '[^']+' was not loaded yet\./,
- /1/, /2/, /3/, /4/, /5/, /6/
-]);
-
-// continue - the breakpoint should be triggered
-repl.addTest('c', [
- /break in .*[\\\/]mod\.js:23/,
- /21/, /22/, /23/, /24/, /25/
-]);
-
-// -- RESTORE BREAKPOINT ON RESTART --
-
-// Restart the application - breakpoint should be restored
-repl.addTest('restart', [].concat(
- [
- /terminated/
- ],
- repl.handshakeLines,
- [
- /Restoring breakpoint mod.js:23/,
- /Warning: script 'mod\.js' was not loaded yet\./,
- /Restoring breakpoint \).*:\d+/,
- /Warning: script '\)[^']*' was not loaded yet\./
- ],
- repl.initialBreakLines));
-
-// continue - the breakpoint should be triggered
-repl.addTest('c', [
- /break in .*[\\\/]mod\.js:23/,
- /21/, /22/, /23/, /24/, /25/
-]);
-
-// -- CLEAR BREAKPOINT SET IN MODULE TO BE LOADED --
-
-repl.addTest('cb("mod.js", 23)', [
- /18/, /./, /./, /./, /./, /./, /./, /./, /26/
-]);
-
-repl.addTest('c', [
- /break in .*[\\\/]main\.js:4/,
- /2/, /3/, /4/, /5/, /6/
-]);
-
-// -- (END) --
-repl.addTest('quit', []);
View
149 test/simple/helper-debugger-repl.js
@@ -1,149 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-process.env.NODE_DEBUGGER_TIMEOUT = 2000;
-var common = require('../common');
-var assert = require('assert');
-var spawn = require('child_process').spawn;
-
-var port = common.PORT + 1337;
-
-var child;
-var buffer = '';
-var expected = [];
-var quit;
-
-function startDebugger(scriptToDebug) {
- scriptToDebug = process.env.NODE_DEBUGGER_TEST_SCRIPT ||
- common.fixturesDir + '/' + scriptToDebug;
-
- child = spawn(process.execPath, ['debug', '--port=' + port, scriptToDebug]);
-
- console.error('./node', 'debug', '--port=' + port, scriptToDebug);
-
- child.stdout.setEncoding('utf-8');
- child.stdout.on('data', function(data) {
- data = (buffer + data).split('\n');
- buffer = data.pop();
- data.forEach(function(line) {
- child.emit('line', line);
- });
- });
- child.stderr.pipe(process.stderr);
-
- child.on('line', function(line) {
- line = line.replace(/^(debug> *)+/, '');
- console.log(line);
- assert.ok(expected.length > 0, 'Got unexpected line: ' + line);
-
- var expectedLine = expected[0].lines.shift();
- assert.ok(line.match(expectedLine) !== null, line + ' != ' + expectedLine);
-
- if (expected[0].lines.length === 0) {
- var callback = expected[0].callback;
- expected.shift();
- callback && callback();
- }
- });
-
- var childClosed = false;
- child.on('close', function(code) {
- assert(!code);
- childClosed = true;
- });
-
- var quitCalled = false;
- quit = function() {
- if (quitCalled || childClosed) return;
- quitCalled = true;
- child.stdin.write('quit');
- child.kill('SIGTERM');
- }
-
- setTimeout(function() {
- console.error('dying badly buffer=%j', buffer);
- var err = 'Timeout';
- if (expected.length > 0 && expected[0].lines) {
- err = err + '. Expected: ' + expected[0].lines.shift();
- }
-
- child.on('close', function() {
- console.error('child is closed');
- throw new Error(err);
- });
-
- quit();
- }, 5000).unref();
-
- process.once('uncaughtException', function(e) {
- console.error('UncaughtException', e, e.stack);
- quit();
- console.error(e.toString());
- process.exit(1);
- });
-
- process.on('exit', function(code) {
- console.error('process exit', code);
- quit();
- if (code === 0)
- assert(childClosed);
- });
-}
-
-function addTest(input, output) {
- function next() {
- if (expected.length > 0) {
- console.log('debug> ' + expected[0].input);
- child.stdin.write(expected[0].input + '\n');
-
- if (!expected[0].lines) {
- var callback = expected[0].callback;
- expected.shift();
-
- callback && callback();
- }
- } else {
- quit();
- }
- };
- expected.push({input: input, lines: output, callback: next});
-}
-
-var handshakeLines = [
- /listening on port \d+/,
- /connecting.* ok/
-];
-
-var initialBreakLines = [
- /break in .*:1/,
- /1/, /2/, /3/
-];
-
-var initialLines = handshakeLines.concat(initialBreakLines);
-
-// Process initial lines
-addTest(null, initialLines);
-
-exports.startDebugger = startDebugger;
-exports.addTest = addTest;
-exports.initialLines = initialLines;
-exports.handshakeLines = handshakeLines;
-exports.initialBreakLines = initialBreakLines;
View
234 test/simple/test-debugger-client.js
@@ -1,234 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-
-
-process.env.NODE_DEBUGGER_TIMEOUT = 2000;
-var common = require('../common');
-var assert = require('assert');
-var debug = require('_debugger');
-
-var debugPort = common.PORT + 1337;
-debug.port = debugPort;
-var spawn = require('child_process').spawn;
-
-setTimeout(function() {
- if (nodeProcess) nodeProcess.kill('SIGTERM');
- throw new Error('timeout');
-}, 10000).unref();
-
-
-var resCount = 0;
-var p = new debug.Protocol();
-p.onResponse = function(res) {
- resCount++;
-};
-
-p.execute('Type: connect\r\n' +
- 'V8-Version: 3.0.4.1\r\n' +
- 'Protocol-Version: 1\r\n' +
- 'Embedding-Host: node v0.3.3-pre\r\n' +
- 'Content-Length: 0\r\n\r\n');
-assert.equal(1, resCount);
-
-// Make sure split messages go in.
-
-var parts = [];
-parts.push('Content-Length: 336\r\n');
-assert.equal(21, parts[0].length);
-parts.push('\r\n');
-assert.equal(2, parts[1].length);
-var bodyLength = 0;
-
-parts.push('{"seq":12,"type":"event","event":"break","body":' +
- '{"invocationText":"#<a Server>');
-assert.equal(78, parts[2].length);
-bodyLength += parts[2].length;
-
-parts.push('.[anonymous](req=#<an IncomingMessage>, ' +
- 'res=#<a ServerResponse>)","sourceLine"');
-assert.equal(78, parts[3].length);
-bodyLength += parts[3].length;
-
-parts.push(':45,"sourceColumn":4,"sourceLineText":" debugger;",' +
- '"script":{"id":24,"name":"/home/ryan/projects/node/' +
- 'benchmark/http_simple.js","lineOffset":0,"columnOffset":0,' +
- '"lineCount":98}}}');
-assert.equal(180, parts[4].length);
-bodyLength += parts[4].length;
-
-assert.equal(336, bodyLength);
-
-for (var i = 0; i < parts.length; i++) {
- p.execute(parts[i]);
-}
-assert.equal(2, resCount);
-
-
-// Make sure that if we get backed up, we still manage to get all the
-// messages
-var d = 'Content-Length: 466\r\n\r\n' +
- '{"seq":10,"type":"event","event":"afterCompile","success":true,' +
- '"body":{"script":{"handle":1,"type":"script","name":"dns.js",' +
- '"id":34,"lineOffset":0,"columnOffset":0,"lineCount":241,' +
- '"sourceStart":"(function (module, exports, require) {' +
- 'var dns = process.binding(\'cares\')' +
- ';\\nvar ne","sourceLength":6137,"scriptType":2,"compilationType":0,' +
- '"context":{"ref":0},"text":"dns.js (lines: 241)"}},"refs":' +
- '[{"handle":0' +
- ',"type":"context","text":"#<a ContextMirror>"}],"running":true}' +
- 'Content-Length: 119\r\n\r\n' +
- '{"seq":11,"type":"event","event":"scriptCollected","success":true,' +
- '"body":{"script":{"id":26}},"refs":[],"running":true}';
-p.execute(d);
-assert.equal(4, resCount);
-
-var expectedConnections = 0;
-var tests = [];
-function addTest(cb) {
- expectedConnections++;
- tests.push(cb);
-}
-
-addTest(function(client, done) {
- console.error('requesting version');
- client.reqVersion(function(err, v) {
- assert.ok(!err);
- console.log('version: %s', v);
- assert.equal(process.versions.v8, v);
- done();
- });
-});
-
-addTest(function(client, done) {
- console.error('requesting scripts');
- client.reqScripts(function(err) {
- assert.ok(!err);
- console.error('got %d scripts', Object.keys(client.scripts).length);
-
- var foundMainScript = false;
- for (var k in client.scripts) {
- var script = client.scripts[k];
- if (script && script.name === 'node.js') {
- foundMainScript = true;
- break;
- }
- }
- assert.ok(foundMainScript);
- done();
- });
-});
-
-addTest(function(client, done) {
- console.error('eval 2+2');
- client.reqEval('2+2', function(err, res) {
- console.error(res);
- assert.ok(!err);
- assert.equal('4', res.text);
- assert.equal(4, res.value);
- done();
- });
-});
-
-
-var connectCount = 0;
-var script = 'setTimeout(function () { console.log("blah"); });' +
- 'setInterval(function () {}, 1000000);';
-
-var nodeProcess;
-
-function doTest(cb, done) {
- var args = ['--debug=' + debugPort, '-e', script];
- nodeProcess = spawn(process.execPath, args);
-
- nodeProcess.stdout.once('data', function(c) {
- console.log('>>> new node process: %d', nodeProcess.pid);
- var failed = true;
- try {
- process._debugProcess(nodeProcess.pid);
- failed = false;
- } finally {
- // At least TRY not to leave zombie procs if this fails.
- if (failed)
- nodeProcess.kill('SIGTERM');
- }
- console.log('>>> starting debugger session');
- });
-
- var didTryConnect = false;
- nodeProcess.stderr.setEncoding('utf8');
- var b = '';
- nodeProcess.stderr.on('data', function(data) {
- console.error('got stderr data %j', data);
- nodeProcess.stderr.resume();
- b += data;
- if (didTryConnect === false && b.match(/Debugger listening on port/)) {
- didTryConnect = true;
-
- // The timeout is here to expose a race in the bootstrap process.
- // Without the early SIGUSR1 debug handler, it effectively results
- // in an infinite ECONNREFUSED loop.
- setTimeout(tryConnect, 100);
-
- function tryConnect() {
- // Wait for some data before trying to connect
- var c = new debug.Client();
- console.error('>>> connecting...');
- c.connect(debug.port);
- c.on('break', function(brk) {
- c.reqContinue(function() {});
- });
- c.on('ready', function() {
- connectCount++;
- console.log('ready!');
- cb(c, function() {
- console.error('>>> killing node process %d\n\n', nodeProcess.pid);
- nodeProcess.kill();
- done();
- });
- });
- c.on('error', function(err) {
- if (err.code !== 'ECONNREFUSED') throw err;
- setTimeout(tryConnect, 10);
- });
- }
- }
- });
-}
-
-
-function run() {
- var t = tests[0];
- if (!t) return;
-
- doTest(t, function() {
- tests.shift();
- run();
- });
-}
-
-run();
-
-process.on('exit', function(code) {
- if (!code)
- assert.equal(expectedConnections, connectCount);
-});
View
31 test/simple/test-debugger-repl-restart.js
@@ -1,31 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var repl = require('./helper-debugger-repl.js');
-
-repl.startDebugger('breakpoints.js');
-
-// Restart the debugged script
-repl.addTest('restart', [
- /terminated/,
-].concat(repl.initialLines));
-
-repl.addTest('quit', []);
View
63 test/simple/test-debugger-repl-term.js
@@ -1,63 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-process.env.NODE_FORCE_READLINE = 1;
-
-var repl = require('./helper-debugger-repl.js');
-
-repl.startDebugger('breakpoints.js');
-
-var addTest = repl.addTest;
-
-// next
-addTest('n', [
- /debug>.*n/,
- /break in .*:11/,
- /9/, /10/, /11/, /12/, /13/
-]);
-
-// should repeat next
-addTest('', [
- /debug>/,
- /break in .*:5/,
- /3/, /4/, /5/, /6/, /7/,
-]);
-
-// continue
-addTest('c', [
- /debug>.*c/,
- /break in .*:12/,
- /10/, /11/, /12/, /13/, /14/
-]);
-
-// should repeat continue
-addTest('', [
- /debug>/,
- /break in .*:5/,
- /3/, /4/, /5/, /6/, /7/,
-]);
-
-// should repeat continue
-addTest('', [
- /debug>/,
- /break in .*:23/,
- /21/, /22/, /23/, /24/, /25/,
-]);
View
27 test/simple/test-debugger-repl-utf8.js
@@ -1,27 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var common = require('../common');
-var script = common.fixturesDir + '/breakpoints_utf8.js';
-process.env.NODE_DEBUGGER_TEST_SCRIPT = script;
-
-require('./test-debugger-repl.js');
-
View
77 test/simple/test-debugger-repl.js
@@ -1,77 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var repl = require('./helper-debugger-repl.js');
-
-repl.startDebugger('breakpoints.js');
-
-var addTest = repl.addTest;
-
-// Next
-addTest('n', [
- /break in .*:11/,
- /9/, /10/, /11/, /12/, /13/
-]);
-
-// Watch
-addTest('watch("\'x\'")');
-
-// Continue
-addTest('c', [
- /break in .*:5/,
- /Watchers/,
- /0:\s+'x' = "x"/,
- /()/,
- /3/, /4/, /5/, /6/, /7/
-]);
-
-// Show watchers
-addTest('watchers', [
- /0:\s+'x' = "x"/
-]);
-
-// Unwatch
-addTest('unwatch("\'x\'")');
-
-// Step out
-addTest('o', [
- /break in .*:12/,
- /10/, /11/, /12/, /13/, /14/
-]);
-
-// Continue
-addTest('c', [
- /break in .*:5/,
- /3/, /4/, /5/, /6/, /7/
-]);
-
-// Set breakpoint by function name
-addTest('sb("setInterval()", "!(setInterval.flag++)")', [
- /1/, /2/, /3/, /4/, /5/, /6/, /7/, /8/, /9/, /10/
-]);
-
-// Continue
-addTest('c', [
- /break in node.js:\d+/,
- /\d/, /\d/, /\d/, /\d/, /\d/
-]);
-
-addTest('quit', []);
Something went wrong with that request. Please try again.