From 710ded61eef4209a13887f5090a8a9880768f85f Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 27 Feb 2017 14:06:59 +0100 Subject: [PATCH 1/3] don't stop if previous is jump out and current jump dest --- src/code/breakpointManager.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/code/breakpointManager.js b/src/code/breakpointManager.js index 5201e7708f..50ad4d6510 100644 --- a/src/code/breakpointManager.js +++ b/src/code/breakpointManager.js @@ -56,10 +56,11 @@ class BreakpointManager { return trace[step].depth !== trace[step - 1].depth } - function hitLine (currentStep, sourceLocation, self) { + function hitLine (currentStep, sourceLocation, previousSourceLocation, self) { // isJumpDestInstruction -> returning from a internal function call // depthChange -> returning from an external call - if (helper.isJumpDestInstruction(self.debugger.traceManager.trace[currentStep]) || + // sourceLocation.start <= previousSourceLocation.start && ... -> previous src is contained in the current one + if (helper.isJumpDestInstruction(self.debugger.traceManager.trace[currentStep]) && previousSourceLocation.jump === 'o' || depthChange(currentStep, self.debugger.traceManager.trace)) { return false } else { @@ -85,7 +86,7 @@ class BreakpointManager { if (this.previousLine !== lineColumn.start.line) { if (direction === -1 && lineHadBreakpoint) { // TODO : improve this when we will build the correct structure before hand lineHadBreakpoint = false - if (hitLine(currentStep + 1, previousSourceLocation, this)) { + if (hitLine(currentStep + 1, previousSourceLocation, sourceLocation, this)) { return } } @@ -93,7 +94,7 @@ class BreakpointManager { if (this.hasBreakpointAtLine(sourceLocation.file, lineColumn.start.line)) { lineHadBreakpoint = true if (direction === 1) { - if (hitLine(currentStep, sourceLocation, this)) { + if (hitLine(currentStep, sourceLocation, previousSourceLocation, this)) { return } } From ed0d6b999fe90f65cc6a57d6c25085ee072626b7 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 27 Feb 2017 14:07:46 +0100 Subject: [PATCH 2/3] Don't stop If the current source location contains the previous one. --- src/code/breakpointManager.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/code/breakpointManager.js b/src/code/breakpointManager.js index 50ad4d6510..30e2900090 100644 --- a/src/code/breakpointManager.js +++ b/src/code/breakpointManager.js @@ -61,7 +61,9 @@ class BreakpointManager { // depthChange -> returning from an external call // sourceLocation.start <= previousSourceLocation.start && ... -> previous src is contained in the current one if (helper.isJumpDestInstruction(self.debugger.traceManager.trace[currentStep]) && previousSourceLocation.jump === 'o' || - depthChange(currentStep, self.debugger.traceManager.trace)) { + depthChange(currentStep, self.debugger.traceManager.trace) || + (sourceLocation.start <= previousSourceLocation.start && + sourceLocation.start + sourceLocation.length >= previousSourceLocation.start + previousSourceLocation.length)) { return false } else { self.debugger.stepManager.jumpTo(currentStep) From c24ee2f63f4387b9c4afedba9c19908ec564b769 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 27 Feb 2017 15:45:00 +0100 Subject: [PATCH 3/3] use () if multiple && || --- src/code/breakpointManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/code/breakpointManager.js b/src/code/breakpointManager.js index 30e2900090..77526fbc5d 100644 --- a/src/code/breakpointManager.js +++ b/src/code/breakpointManager.js @@ -60,7 +60,7 @@ class BreakpointManager { // isJumpDestInstruction -> returning from a internal function call // depthChange -> returning from an external call // sourceLocation.start <= previousSourceLocation.start && ... -> previous src is contained in the current one - if (helper.isJumpDestInstruction(self.debugger.traceManager.trace[currentStep]) && previousSourceLocation.jump === 'o' || + if ((helper.isJumpDestInstruction(self.debugger.traceManager.trace[currentStep]) && previousSourceLocation.jump === 'o') || depthChange(currentStep, self.debugger.traceManager.trace) || (sourceLocation.start <= previousSourceLocation.start && sourceLocation.start + sourceLocation.length >= previousSourceLocation.start + previousSourceLocation.length)) {