Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-12-23 01:31:57 +0300
committerRyan Dahl <ry@tinyclouds.org>2010-12-30 12:35:11 +0300
commita8417c128e0c871c6af03236fa42209dc1977caa (patch)
treeee2c4f52884c4684a5067d3ec3815b0975d8dcf8 /lib
parent8e96b8ab9bd559914c18b0bdf3b291862c961f94 (diff)
Add more debugger tests
Diffstat (limited to 'lib')
-rw-r--r--lib/_debugger.js32
1 files changed, 31 insertions, 1 deletions
diff --git a/lib/_debugger.js b/lib/_debugger.js
index 0232f312baa..72af3a5cbc4 100644
--- a/lib/_debugger.js
+++ b/lib/_debugger.js
@@ -187,7 +187,30 @@ Client.prototype.reqBacktrace = function(cb) {
};
-var helpMessage = "Commands: backtrace, version, eval, help, quit";
+// Returns an array of objects like this:
+//
+// { handle: 11,
+// type: 'script',
+// name: 'node.js',
+// id: 14,
+// lineOffset: 0,
+// columnOffset: 0,
+// lineCount: 562,
+// sourceStart: '(function(process) {\n\n ',
+// sourceLength: 15939,
+// scriptType: 2,
+// compilationType: 0,
+// context: { ref: 10 },
+// text: 'node.js (lines: 562)' }
+//
+Client.prototype.reqScripts = function(cb) {
+ this.req({ command: 'scripts' } , function (res) {
+ if (cb) cb(res.body);
+ });
+};
+
+
+var helpMessage = "Commands: scripts, backtrace, version, eval, help, quit";
function startInterface() {
@@ -226,6 +249,13 @@ function startInterface() {
i.prompt();
});
+ } else if (/^scripts/.test(cmd)) {
+ c.reqScripts(function (res) {
+ var text = res.map(function (x) { return x.text; });
+ console.log(text.join('\n'));
+ i.prompt();
+ });
+
} else if (/^eval/.test(cmd)) {
c.reqEval(cmd.slice(5), function (res) {
console.log(res);