[debugger] fixed piping from stdout of child process, fixed eval in debug repl (when...
authorFedor Indutny <fedor.indutny@gmail.com>
Sat, 10 Sep 2011 16:55:38 +0000 (23:55 +0700)
committerFedor Indutny <fedor.indutny@gmail.com>
Sat, 10 Sep 2011 16:55:38 +0000 (23:55 +0700)
lib/_debugger.js

index 4575b17..7c054cf 100644 (file)
@@ -409,6 +409,7 @@ Client.prototype.reqScripts = function(cb) {
 
 
 Client.prototype.reqContinue = function(cb) {
+  this.currentFrame = NO_FRAME;
   this.req({ command: 'continue' }, function(res) {
     if (cb) cb(res);
   });
@@ -451,6 +452,7 @@ Client.prototype.step = function(action, count, cb) {
     arguments: { stepaction: action, stepcount: count }
   };
 
+  this.currentFrame = NO_FRAME;
   this.req(req, function(res) {
     if (cb) cb(res);
   });
@@ -519,7 +521,7 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
           name: prop.name,
           value: mirrorValue
         };
-        if (value.handle && depth > 0) {
+        if (value && value.handle && depth > 0) {
           waiting++;
           self.mirrorObject(value, depth - 1, function(result) {
             keyValues[i].value = result;
@@ -760,7 +762,8 @@ Interface.prototype.childPrint = function(text) {
     return chunk;
   }).map(function(chunk) {
     return '< ' + chunk;
-  }).join('\n') + '\n');
+  }).join('\n'));
+  this.repl.displayPrompt();
 };
 
 Interface.prototype.error = function(text) {
@@ -807,8 +810,14 @@ Interface.prototype.debugEval = function(code, context, filename, callback) {
     return;
   }
 
+  var frame;
+
+  if (client.currentFrame === NO_FRAME) {
+    frame = NO_FRAME;
+  };
+
   self.pause();
-  client.reqFrameEval(code, undefined, function(res) {
+  client.reqFrameEval(code, frame, function(res) {
     if (!res.success) {
       if (res.message) {
         callback(res.message);