Fixed exception details not being displayed

Make sure the exception scoperef is allocated before locals are retrieved.
This commit is contained in:
adelphes
2017-03-02 16:12:27 +00:00
parent 6451e38bca
commit 0b5be3020a
2 changed files with 6 additions and 3 deletions

View File

@@ -800,11 +800,11 @@ class AndroidDebugSession extends DebugSession {
var last_exception = thread.paused.last_exception;
if (last_exception && !last_exception.objvar) {
// retrieve the exception object
this.dbgr.getExceptionLocal(last_exception.exception, {response,scopes,last_exception,thread,args})
thread.allocateExceptionScopeReference(args.frameId);
this.dbgr.getExceptionLocal(last_exception.exception, {response,scopes,last_exception})
.then((ex_local,x) => {
var {response,scopes,last_exception,thread,args} = x;
var {response,scopes,last_exception} = x;
last_exception.objvar = ex_local;
thread.allocateExceptionScopeReference(args.frameId);
// put the exception first - otherwise it can get lost if there's a lot of locals
scopes.unshift(new Scope("Exception: "+ex_local.type.typename, last_exception.scopeRef, false));
this.sendResponse(response);
@@ -956,6 +956,7 @@ class AndroidDebugSession extends DebugSession {
var last_exception = {
exception: e.event.exception,
threadid: e.throwlocation.threadid,
frameId: null, // allocated during scopesRequest
scopeRef: null, // allocated during scopesRequest
};
this.reportStoppedEvent("exception", e.throwlocation, last_exception);

View File

@@ -39,6 +39,8 @@ class AndroidThread {
}
allocateExceptionScopeReference(frameId) {
if (!this.paused) return;
if (!this.paused.last_exception) return;
this.paused.last_exception.frameId = frameId;
this.paused.last_exception.scopeRef = frameId + 1;
}