Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
[debugger] shorten break message
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny authored and ry committed Sep 21, 2011
1 parent 79fd1f7 commit 8efe7a8
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions lib/_debugger.js
Expand Up @@ -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;

Expand Down Expand Up @@ -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 += ':';
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1128,7 +1127,7 @@ Interface.prototype.scripts = function() {
scripts.push(
(script.name == client.currentScript ? '* ' : ' ') +
id + ': ' +
require('path').basename(script.name)
path.basename(script.name)
);
}
}
Expand Down

0 comments on commit 8efe7a8

Please sign in to comment.