From 8cc31476b3e489f06b39b51893f49d3fc747fab3 Mon Sep 17 00:00:00 2001 From: Dave Holoway Date: Sun, 11 Nov 2018 15:20:28 +0000 Subject: [PATCH] fix breakpoints don't trigger when hit (#37) * add errorcode to empty jdwp results * use an empty line table if the command request fails --- src/debugger.js | 9 +++++++++ src/jdwp.js | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/debugger.js b/src/debugger.js index f34f897..585bbbd 100644 --- a/src/debugger.js +++ b/src/debugger.js @@ -1425,6 +1425,15 @@ Debugger.prototype = { cmd: this.JDWP.Commands.lineTable(methodinfo.owningclass, methodinfo), }) .then(function (linetable, methodinfo) { + // if the request failed, just return a blank table + if (linetable.errorcode) { + linetable = { + errorcode: linetable.errorcode, + start: '00000000000000000000000000000000', + end: '00000000000000000000000000000000', + lines:[], + } + } // the linetable does not correlate code indexes with line numbers // - location searching relies on the table being ordered by code indexes linetable.lines.sort(function (a, b) { diff --git a/src/jdwp.js b/src/jdwp.js index 0413706..d9cb0dd 100644 --- a/src/jdwp.js +++ b/src/jdwp.js @@ -109,7 +109,10 @@ function _JDWP() { return; } - this.decoded = {empty:true}; + this.decoded = { + empty: true, + errorcode: this.errorcode, + }; } this.decodereply = function(ths,s) {