Not possible from js level. You can get all frame and closure scope variables from debugger (and it's very easy to automate - require('_debugger')
. If this is something you ready to try I can explain details of V8 debugger protocol and built in node.js client for it.
Update:
Basic usage of debugger client from node core:
var DebuggerClient = require('_debugger').Client;
var dc = new DebuggerClient();
dc.connect(5858); // you need to start your script with "node --debug-brk=5858 script-to-debug.js"
// listen breakpoint:
dc.on('break', function(res) {
// sctipt id, line, location here
dc.reqBacktrace(function(err, res) {
// res.frames array
});
dc.reqScopes(function(scopes) {
// SCOPES! TADAM!
});
});
Try first using "debugger" keyword, inspect results, then continue with setting/changing breakpoints from your script.
See how it's used in node, in node-vim-debugger and if something missing refer to V8 debugger protocol documentation
Note that you have access to similar API from the script being debugged itself, see how it is used to set breakpoint at the beginning of the script
// script is a reference to Script object, see "vm" module
global.v8debug.Debug.setBreakPoint(script, 0, 0);