You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When stepping through code with a command line debugger, it's really helpful to repeat the last command by hitting enter.
Steps to reproduce:
$ node debug script.js
< Debugger listening on port 5858
connecting to 127.0.0.1:5858 ... ok
break in script.js:1
> 1 var a = 1;
2 var b = 2;
3 console.log(a);
debug> next
break in script.js:2
1 var a = 1;
> 2 var b = 2;
3 console.log(a);
4 console.log(b);
debug>
debug>
The _debugger module seems to implement this in commandEval:
// Used for debugger's commands evaluation and executionInterface.prototype.controlEval=function(code,context,filename,callback){try{// Repeat last command if empty line are going to be evaluatedif(this.repl.rli.history&&this.repl.rli.history.length>0){if(code==='\n'){code=this.repl.rli.history[0]+'\n';}}
Unfortunately it seems that the repl's self.eval is no longer called for empty commands:
if(!skipCatchall&&(cmd||(!cmd&&self.bufferedCommand))){varevalCmd=self.bufferedCommand+cmd;if(/^\s*\{/.test(evalCmd)&&/\}\s*$/.test(evalCmd)){// It's confusing for `{ a : 1 }` to be interpreted as a block// statement rather than an object literal. So, we first try// to wrap it in parentheses, so that it will be interpreted as// an expression.evalCmd='('+evalCmd+')\n';}else{// otherwise we just append a \n so that it will be either// terminated, or continued onto the next expression if it's an// unexpected end of input.evalCmd=evalCmd+'\n';}debug('eval %j',evalCmd);self.eval(evalCmd,self.context,'repl',finish);}else{finish(null);}
Tweak the better empty line handling introduced in nodejs#2163 so that empty
lines are still passed to the eval function. This is required for the
debugger to repeat the last command on an empty line.
Fixes: nodejs#6010
When stepping through code with a command line debugger, it's really helpful to repeat the last command by hitting enter.
Steps to reproduce:
The _debugger module seems to implement this in commandEval:
https://github.com/nodejs/node/blob/v5.9.1/lib/_debugger.js#L943-L951
Unfortunately it seems that the repl's
self.eval
is no longer called for empty commands:https://github.com/nodejs/node/blob/v5.9.1/lib/repl.js#L413-L432
_debugger
The text was updated successfully, but these errors were encountered: