Skip to content

Instantly share code, notes, and snippets.

@remy
Forked from sidorares/gist:9181766
Last active August 29, 2015 13:56
Show Gist options
  • Save remy/9196863 to your computer and use it in GitHub Desktop.
Save remy/9196863 to your computer and use it in GitHub Desktop.
node --expose_debug_as=v8debug example.js
function bbb(x) {
var cc = x + 1;
var dd = cc + 2;
JSON.parse("remy"); // causes exception
return dd;
}
setInterval(function() {
var aa = 123;
try {
bbb(345);
} catch(e) {
console.log(e);
}
console.log('here');
}, 1000);
var d = global.v8debug.Debug;
d.setBreakOnException();
d.setListener(function(e,exec_state, event_data, data) {
var scopes = [];
for (var i=0; i < exec_state.frame(0).scopeCount(); ++i)
scopes.push(exec_state.frame(0).scope(i).details_.details_[1]);
console.log(scopes);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment