Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
[debugger] separate history of control and debug, make scripts comman…
Browse files Browse the repository at this point in the history
…d getter
  • Loading branch information
indutny committed Sep 14, 2011
1 parent 19194f8 commit 1dd3b68
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions lib/_debugger.js
Expand Up @@ -735,6 +735,10 @@ function Interface() {
this.waiting = null;
this.paused = 0;
this.context = this.repl.context;
this.history = {
debug: [],
control: []
};
};


Expand Down Expand Up @@ -1015,11 +1019,12 @@ Interface.prototype.backtrace = function() {


// argument full tells if it should display internal node scripts or not
Interface.prototype.scripts = function(displayNatives) {
Interface.prototype.scripts = function() {
if (!this.requireConnection()) return;

var client = this.client;
var scripts = [];
var client = this.client,
displayNatives = arguments[0] || false,
scripts = [];

this.pause();
for (var id in client.scripts) {
Expand Down Expand Up @@ -1228,6 +1233,10 @@ Interface.prototype.repl = function() {
this.repl.eval = this.debugEval.bind(this);
this.repl.context = {};

// Swap history
this.history.control = this.repl.rli.history;
this.repl.rli.history = this.history.debug;

this.repl.prompt = '> ';
this.repl.rli.setPrompt('> ');
this.repl.displayPrompt();
Expand All @@ -1236,8 +1245,13 @@ Interface.prototype.repl = function() {

// Exit debug repl
Interface.prototype.exitRepl = function() {
// Restore eval
this.repl.eval = this.controlEval.bind(this);

// Swap history
this.history.debug = this.repl.rli.history;
this.repl.rli.history = this.history.control;

this.repl.context = this.context;
this.repl.prompt = 'debug> ';
this.repl.rli.setPrompt('debug> ');
Expand Down

0 comments on commit 1dd3b68

Please sign in to comment.