|
|
@ -1,5 +1,6 @@ |
|
|
|
var remixLib = require('remix-lib') |
|
|
|
var remixLib = require('remix-lib') |
|
|
|
var EventManager = remixLib.EventManager |
|
|
|
var EventManager = remixLib.EventManager |
|
|
|
|
|
|
|
var util = remixLib.util |
|
|
|
|
|
|
|
|
|
|
|
class DebuggerStepManager { |
|
|
|
class DebuggerStepManager { |
|
|
|
|
|
|
|
|
|
|
@ -81,43 +82,58 @@ class DebuggerStepManager { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
stepIntoBack () { |
|
|
|
stepIntoBack (solidityMode) { |
|
|
|
if (!this.traceManager.isLoaded()) return |
|
|
|
if (!this.traceManager.isLoaded()) return |
|
|
|
var step = this.currentStepIndex - 1 |
|
|
|
var step = this.currentStepIndex - 1 |
|
|
|
this.currentStepIndex = step |
|
|
|
this.currentStepIndex = step |
|
|
|
|
|
|
|
if (solidityMode) { |
|
|
|
|
|
|
|
step = this.resolveToReducedTrace(step, -1) |
|
|
|
|
|
|
|
} |
|
|
|
if (!this.traceManager.inRange(step)) { |
|
|
|
if (!this.traceManager.inRange(step)) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
this.event.trigger('stepChanged', [step]) |
|
|
|
this.event.trigger('stepChanged', [step]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
stepIntoForward () { |
|
|
|
stepIntoForward (solidityMode) { |
|
|
|
if (!this.traceManager.isLoaded()) return |
|
|
|
if (!this.traceManager.isLoaded()) return |
|
|
|
var step = this.currentStepIndex + 1 |
|
|
|
var step = this.currentStepIndex + 1 |
|
|
|
this.currentStepIndex = step |
|
|
|
this.currentStepIndex = step |
|
|
|
|
|
|
|
if (solidityMode) { |
|
|
|
|
|
|
|
step = this.resolveToReducedTrace(step, 1) |
|
|
|
|
|
|
|
} |
|
|
|
if (!this.traceManager.inRange(step)) { |
|
|
|
if (!this.traceManager.inRange(step)) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
this.event.trigger('stepChanged', [step]) |
|
|
|
this.event.trigger('stepChanged', [step]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
stepOverBack () { |
|
|
|
stepOverBack (solidityMode) { |
|
|
|
if (!this.traceManager.isLoaded()) return |
|
|
|
if (!this.traceManager.isLoaded()) return |
|
|
|
var step = this.traceManager.findStepOverBack(this.currentStepIndex) |
|
|
|
var step = this.traceManager.findStepOverBack(this.currentStepIndex) |
|
|
|
|
|
|
|
if (solidityMode) { |
|
|
|
|
|
|
|
step = this.resolveToReducedTrace(step, -1) |
|
|
|
|
|
|
|
} |
|
|
|
this.currentStepIndex = step |
|
|
|
this.currentStepIndex = step |
|
|
|
this.event.trigger('stepChanged', [step]) |
|
|
|
this.event.trigger('stepChanged', [step]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
stepOverForward () { |
|
|
|
stepOverForward (solidityMode) { |
|
|
|
if (!this.traceManager.isLoaded()) return |
|
|
|
if (!this.traceManager.isLoaded()) return |
|
|
|
var step = this.traceManager.findStepOverForward(this.currentStepIndex) |
|
|
|
var step = this.traceManager.findStepOverForward(this.currentStepIndex) |
|
|
|
|
|
|
|
if (solidityMode) { |
|
|
|
|
|
|
|
step = this.resolveToReducedTrace(step, 1) |
|
|
|
|
|
|
|
} |
|
|
|
this.currentStepIndex = step |
|
|
|
this.currentStepIndex = step |
|
|
|
this.event.trigger('stepChanged', [step]) |
|
|
|
this.event.trigger('stepChanged', [step]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
jumpOut () { |
|
|
|
jumpOut (solidityMode) { |
|
|
|
if (!this.traceManager.isLoaded()) return |
|
|
|
if (!this.traceManager.isLoaded()) return |
|
|
|
var step = this.traceManager.findStepOut(this.currentStepIndex) |
|
|
|
var step = this.traceManager.findStepOut(this.currentStepIndex) |
|
|
|
|
|
|
|
if (solidityMode) { |
|
|
|
|
|
|
|
step = this.resolveToReducedTrace(step, 0) |
|
|
|
|
|
|
|
} |
|
|
|
this.currentStepIndex = step |
|
|
|
this.currentStepIndex = step |
|
|
|
this.event.trigger('stepChanged', [step]) |
|
|
|
this.event.trigger('stepChanged', [step]) |
|
|
|
} |
|
|
|
} |
|
|
@ -140,6 +156,20 @@ class DebuggerStepManager { |
|
|
|
this.debugger.breakpointManager.jumpPreviousBreakpoint(this.currentStepIndex, true) |
|
|
|
this.debugger.breakpointManager.jumpPreviousBreakpoint(this.currentStepIndex, true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resolveToReducedTrace (value, incr) { |
|
|
|
|
|
|
|
if (this.debugger.callTree.reducedTrace.length) { |
|
|
|
|
|
|
|
var nextSource = util.findClosestIndex(value, this.debugger.callTree.reducedTrace) |
|
|
|
|
|
|
|
nextSource = nextSource + incr |
|
|
|
|
|
|
|
if (nextSource <= 0) { |
|
|
|
|
|
|
|
nextSource = 0 |
|
|
|
|
|
|
|
} else if (nextSource > this.debugger.callTree.reducedTrace.length) { |
|
|
|
|
|
|
|
nextSource = this.debugger.callTree.reducedTrace.length - 1 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return this.debugger.callTree.reducedTrace[nextSource] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return value |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = DebuggerStepManager |
|
|
|
module.exports = DebuggerStepManager |
|
|
|