|
@ -415,6 +415,7 @@ function restartQuestion (cb) { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function printScripts () { |
|
|
function printScripts () { |
|
|
var text = ''; |
|
|
var text = ''; |
|
|
for (var id in c.scripts) { |
|
|
for (var id in c.scripts) { |
|
@ -428,6 +429,12 @@ function printScripts () { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function printNotConnected () { |
|
|
|
|
|
console.log("Program not running. Try 'run'."); |
|
|
|
|
|
term.prompt(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function startInterface() { |
|
|
function startInterface() { |
|
|
|
|
|
|
|
|
term = readline.createInterface(process.stdout); |
|
|
term = readline.createInterface(process.stdout); |
|
@ -485,18 +492,30 @@ function startInterface() { |
|
|
term.prompt(); |
|
|
term.prompt(); |
|
|
|
|
|
|
|
|
} else if ('version' == cmd) { |
|
|
} else if ('version' == cmd) { |
|
|
|
|
|
if (!c) { |
|
|
|
|
|
printNotConnected(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
c.reqVersion(function (v) { |
|
|
c.reqVersion(function (v) { |
|
|
console.log(v); |
|
|
console.log(v); |
|
|
term.prompt(); |
|
|
term.prompt(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} else if (/info +breakpoints/.test(cmd)) { |
|
|
} else if (/info +breakpoints/.test(cmd)) { |
|
|
|
|
|
if (!c) { |
|
|
|
|
|
printNotConnected(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
c.listbreakpoints(function (res) { |
|
|
c.listbreakpoints(function (res) { |
|
|
console.log(res); |
|
|
console.log(res); |
|
|
term.prompt(); |
|
|
term.prompt(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} else if (/^backtrace/.test(cmd) || /^bt/.test(cmd)) { |
|
|
} else if (/^backtrace/.test(cmd) || /^bt/.test(cmd)) { |
|
|
|
|
|
if (!c) { |
|
|
|
|
|
printNotConnected(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
c.reqBacktrace(function (bt) { |
|
|
c.reqBacktrace(function (bt) { |
|
|
if (/full/.test(cmd)) { |
|
|
if (/full/.test(cmd)) { |
|
|
console.log(bt); |
|
|
console.log(bt); |
|
@ -514,25 +533,45 @@ function startInterface() { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} else if (cmd == 'scripts' || cmd == 'scripts full') { |
|
|
} else if (cmd == 'scripts' || cmd == 'scripts full') { |
|
|
|
|
|
if (!c) { |
|
|
|
|
|
printNotConnected(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
printScripts(); |
|
|
printScripts(); |
|
|
term.prompt(); |
|
|
term.prompt(); |
|
|
|
|
|
|
|
|
} else if (/^continue/.test(cmd) || /^c/.test(cmd)) { |
|
|
} else if (/^continue/.test(cmd) || /^c/.test(cmd)) { |
|
|
|
|
|
if (!c) { |
|
|
|
|
|
printNotConnected(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
c.reqContinue(function (res) { |
|
|
c.reqContinue(function (res) { |
|
|
// Wait for break point. (disable raw mode?)
|
|
|
// Wait for break point. (disable raw mode?)
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} else if (/^next/.test(cmd) || /^n/.test(cmd)) { |
|
|
} else if (/^next/.test(cmd) || /^n/.test(cmd)) { |
|
|
|
|
|
if (!c) { |
|
|
|
|
|
printNotConnected(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
c.step('next', 1, function (res) { |
|
|
c.step('next', 1, function (res) { |
|
|
// Wait for break point. (disable raw mode?)
|
|
|
// Wait for break point. (disable raw mode?)
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} else if (/^step/.test(cmd) || /^s/.test(cmd)) { |
|
|
} else if (/^step/.test(cmd) || /^s/.test(cmd)) { |
|
|
|
|
|
if (!c) { |
|
|
|
|
|
printNotConnected(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
c.step('in', 1, function (res) { |
|
|
c.step('in', 1, function (res) { |
|
|
// Wait for break point. (disable raw mode?)
|
|
|
// Wait for break point. (disable raw mode?)
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} else if (/^print/.test(cmd) || /^p/.test(cmd)) { |
|
|
} else if (/^print/.test(cmd) || /^p/.test(cmd)) { |
|
|
|
|
|
if (!c) { |
|
|
|
|
|
printNotConnected(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
var i = cmd.indexOf(' '); |
|
|
var i = cmd.indexOf(' '); |
|
|
if (i < 0) { |
|
|
if (i < 0) { |
|
|
console.log("print [expression]"); |
|
|
console.log("print [expression]"); |
|
|