debugger: don't display node's internal scripts

pull/22966/head
Ryan Dahl 2010-12-30 11:53:55 -08:00
parent d4859a55bc
commit 074af67dd3
1 changed files with 12 additions and 4 deletions

View File

@ -135,8 +135,13 @@ Client.prototype._addHandle = function(desc) {
}; };
var natives = process.binding('natives');
Client.prototype._addScript = function(desc) { Client.prototype._addScript = function(desc) {
this.scripts[desc.id] = desc; this.scripts[desc.id] = desc;
desc.isNative = (desc.name.replace('.js', '') in natives) ||
desc.name == 'node.js';
}; };
@ -470,7 +475,7 @@ Interface.prototype.handleCommand = function(cmd) {
self.printNotConnected(); self.printNotConnected();
return; return;
} }
self.printScripts(); self.printScripts(cmd.indexOf('full') > 0);
term.prompt(); term.prompt();
} else if (/^c(ontinue)?/.test(cmd)) { } else if (/^c(ontinue)?/.test(cmd)) {
@ -610,16 +615,19 @@ Interface.prototype.printNotConnected = function() {
}; };
Interface.prototype.printScripts = function() { // argument full tells if it should display internal node scripts or not
Interface.prototype.printScripts = function(displayNatives) {
var client = this.client; var client = this.client;
var text = ''; var text = '';
for (var id in client.scripts) { for (var id in client.scripts) {
var script = client.scripts[id]; var script = client.scripts[id];
if (typeof script == 'object' && script.name) { if (typeof script == 'object' && script.name) {
if (displayNatives || script.name == client.currentScript || !script.isNative) {
text += script.name == client.currentScript ? '* ' : ' '; text += script.name == client.currentScript ? '* ' : ' ';
text += script.name + '\n'; text += script.name + '\n';
} }
} }
}
process.stdout.write(text); process.stdout.write(text);
}; };