Commit 7f3f2621 authored by yann300's avatar yann300

check against the depth instead of the opcode name

parent 69ac0c80
...@@ -52,10 +52,15 @@ class BreakpointManager { ...@@ -52,10 +52,15 @@ class BreakpointManager {
return return
} }
function depthChange (step, trace) {
return trace[step].depth !== trace[step - 1].depth
}
function hitLine (currentStep, sourceLocation, self) { function hitLine (currentStep, sourceLocation, self) {
// isJumpDestInstruction -> returning from a internal function call
// depthChange -> returning from an external call
if (helper.isJumpDestInstruction(self.debugger.traceManager.trace[currentStep]) || if (helper.isJumpDestInstruction(self.debugger.traceManager.trace[currentStep]) ||
helper.isReturnInstruction(self.debugger.traceManager.trace[currentStep - 1]) || depthChange(currentStep, self.debugger.traceManager.trace)) {
helper.isStopInstruction(self.debugger.traceManager.trace[currentStep - 1])) {
return false return false
} else { } else {
self.debugger.stepManager.jumpTo(currentStep) self.debugger.stepManager.jumpTo(currentStep)
...@@ -79,10 +84,9 @@ class BreakpointManager { ...@@ -79,10 +84,9 @@ class BreakpointManager {
var lineColumn = this.locationToRowConverter(sourceLocation) var lineColumn = this.locationToRowConverter(sourceLocation)
if (this.previousLine !== lineColumn.start.line) { if (this.previousLine !== lineColumn.start.line) {
if (direction === -1 && lineHadBreakpoint) { // TODO : improve this when we will build the correct structure before hand 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, this)) {
return return
} else {
lineHadBreakpoint = false
} }
} }
this.previousLine = lineColumn.start.line this.previousLine = lineColumn.start.line
...@@ -91,8 +95,6 @@ class BreakpointManager { ...@@ -91,8 +95,6 @@ class BreakpointManager {
if (direction === 1) { if (direction === 1) {
if (hitLine(currentStep, sourceLocation, this)) { if (hitLine(currentStep, sourceLocation, this)) {
return return
} else {
lineHadBreakpoint = false
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment