Update behaviour of break-on-exception

Altered so that uncaught exceptions never have a filter applied.
Fixes #5
This commit is contained in:
adelphes
2017-01-26 11:09:50 +00:00
parent f56c2b085f
commit 53a368fc46

View File

@@ -1491,10 +1491,10 @@ Debugger.prototype = {
// when setting up the exceptions, we filter by packages containing public classes in the current session // when setting up the exceptions, we filter by packages containing public classes in the current session
// - each filter needs a separate call (I think), so we do this as an asynchronous list // - each filter needs a separate call (I think), so we do this as an asynchronous list
var pkgs = this.session.build.packages; var pkgs = this.session.build.packages;
var pkgs_to_monitor = Object.keys(pkgs).filter(pkgname => pkgs[pkgname].public_classes.length); var pkgs_to_monitor = c ? Object.keys(pkgs).filter(pkgname => pkgs[pkgname].public_classes.length) : [];
var o = { var o = {
dbgr: this, dbgr: this,
pkgs: pkgs_to_monitor, filters: pkgs_to_monitor.map(pkg=>pkg+'.*'),
caught: c, caught: c,
uncaught: u, uncaught: u,
onevent: onevent, onevent: onevent,
@@ -1502,13 +1502,20 @@ Debugger.prototype = {
def: $.Deferred(), def: $.Deferred(),
extra: extra, extra: extra,
next() { next() {
if (!this.pkgs.length) { var uncaught = false;
this.def.resolveWith(this.dbgr, [this.extra]); // done if (!this.filters.length) {
return; if (!this.uncaught) {
this.def.resolveWith(this.dbgr, [this.extra]); // done
return;
}
// setup the uncaught exception break - with no filter
uncaught = true;
this.filters.push(null);
this.caught = this.uncaught = false;
} }
// setup next pattern // setup next pattern
this.dbgr.session.adbclient.jdwp_command({ this.dbgr.session.adbclient.jdwp_command({
cmd: this.dbgr.JDWP.Commands.SetExceptionBreak(this.pkgs.shift() + '.*', this.caught, this.uncaught, this.onevent), cmd: this.dbgr.JDWP.Commands.SetExceptionBreak(this.filters.shift(), this.caught, uncaught, this.onevent),
}) })
.then(x => { .then(x => {
this.dbgr.exception_ids.push(x.id); this.dbgr.exception_ids.push(x.id);