From 074af67dd36b0e29d801c39cf7bd2b1170880df9 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 30 Dec 2010 11:53:55 -0800 Subject: [PATCH] debugger: don't display node's internal scripts --- lib/_debugger.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/_debugger.js b/lib/_debugger.js index e0bd3e1..fb7b31a 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -135,8 +135,13 @@ Client.prototype._addHandle = function(desc) { }; +var natives = process.binding('natives'); + + Client.prototype._addScript = function(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(); return; } - self.printScripts(); + self.printScripts(cmd.indexOf('full') > 0); term.prompt(); } else if (/^c(ontinue)?/.test(cmd)) { @@ -610,14 +615,17 @@ 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 text = ''; for (var id in client.scripts) { var script = client.scripts[id]; if (typeof script == 'object' && script.name) { - text += script.name == client.currentScript ? '* ' : ' '; - text += script.name + '\n'; + if (displayNatives || script.name == client.currentScript || !script.isNative) { + text += script.name == client.currentScript ? '* ' : ' '; + text += script.name + '\n'; + } } } process.stdout.write(text); -- 2.7.4