From 0b5be3020a915ddc5659a9979ebdd79c1a55240f Mon Sep 17 00:00:00 2001 From: adelphes Date: Thu, 2 Mar 2017 16:12:27 +0000 Subject: [PATCH] Fixed exception details not being displayed Make sure the exception scoperef is allocated before locals are retrieved. --- src/debugMain.js | 7 ++++--- src/threads.js | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/debugMain.js b/src/debugMain.js index 92d83d7..859d856 100644 --- a/src/debugMain.js +++ b/src/debugMain.js @@ -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); diff --git a/src/threads.js b/src/threads.js index 86059f9..a4306a6 100644 --- a/src/threads.js +++ b/src/threads.js @@ -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; }