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

[debugger] shorten break message

  • Loading branch information...
indutny authored and ry committed Sep 21, 2011
1 parent 79fd1f7 commit 8efe7a8304e33fce36a8b7add9ed2ba63b647e3d
Showing with 15 additions and 16 deletions.
  1. +15 −16 lib/_debugger.js
@@ -19,10 +19,11 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

var net = require('net'),
repl = require('repl'),
var util = require('util'),
path = require('path'),
net = require('net'),
vm = require('vm'),
util = require('util'),
repl = require('repl'),
inherits = util.inherits,
spawn = require('child_process').spawn;

@@ -671,24 +672,22 @@ function SourceUnderline(sourceText, position) {
}


function SourceInvocation(body) {
return body.invocationText.replace(/\n/g, '')
.replace(/^([^(]*)\(.*\)([^)]*)$/, '$1(...)$2');
}


function SourceInfo(body) {
var result = 'break in ' + SourceInvocation(body);
var result = 'break in ';

if (body.script) {
if (body.script.name) {
var name = body.script.name;
var name = body.script.name,
dir = path.resolve() + '/';

// TODO Change path to relative, if possible
// Change path to relative, if possible
if (name.indexOf(dir) === 0) {
name = name.slice(dir.length);
}

result += ', ' + name;
result += name;
} else {
result += ', [unnamed]';
result += '[unnamed]';
}
}
result += ':';
@@ -1096,7 +1095,7 @@ Interface.prototype.backtrace = function() {
if (frame.func.inferredName && frame.func.inferredName.length > 0) {
text += frame.func.inferredName + ' ';
}
text += require('path').basename(frame.script.name) + ':';
text += path.basename(frame.script.name) + ':';
text += (frame.line + 1) + ':' + (frame.column + 1);

trace.push(text);
@@ -1128,7 +1127,7 @@ Interface.prototype.scripts = function() {
scripts.push(
(script.name == client.currentScript ? '* ' : ' ') +
id + ': ' +
require('path').basename(script.name)
path.basename(script.name)
);
}
}

0 comments on commit 8efe7a8

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