Commit e0005aa2 authored by yann300's avatar yann300

jump out

parent 4fb58291
......@@ -271,6 +271,10 @@ TraceManager.prototype.findNextCall = function (currentStep) {
return this.traceStepManager.findNextCall(currentStep)
}
TraceManager.prototype.findStepOut = function (currentStep) {
return this.traceStepManager.findStepOut(currentStep)
}
// util
TraceManager.prototype.checkRequestedStep = function (stepIndex) {
if (!this.trace) {
......
......@@ -43,4 +43,15 @@ TraceStepManager.prototype.findNextCall = function (currentStep) {
}
}
TraceStepManager.prototype.findStepOut = function (currentStep) {
var callChanges = this.traceAnalyser.traceCache.callChanges
var stepIndex = util.findLowerBound(currentStep, callChanges)
var call = this.traceAnalyser.traceCache.calls[callChanges[stepIndex]]
if (call && call.return) {
return call.return
} else {
return currentStep
}
}
module.exports = TraceStepManager
......@@ -11,6 +11,7 @@ function ButtonNavigator (_traceManager) {
this.intoForwardDisabled = true
this.overForwardDisabled = true
this.nextCallDisabled = true
this.jumpOutDisabled = true
this.traceManager = _traceManager
......@@ -29,9 +30,11 @@ ButtonNavigator.prototype.render = function () {
<button id='intoforward' title='step into forward' class='fa fa-angle-right' style=${ui.formatCss(style.button)} onclick=${function () { self.event.trigger('stepIntoForward') }} disabled=${this.intoForwardDisabled} >
</button>
<button id='overforward' title='step over forward' class='fa fa-angle-double-right' style=${ui.formatCss(style.button)} onclick=${function () { self.event.trigger('stepOverForward') }} disabled=${this.overForwardDisabled} >
</button>
</button>
<button id='nextcall' title='step next call' class='fa fa-chevron-right' style=${ui.formatCss(style.button)} onclick=${function () { self.event.trigger('jumpNextCall') }} disabled=${this.nextCallDisabled} >
</button>
<button id='jumpout' title='jump out' class='fa fa-share' style=${ui.formatCss(style.button)} onclick=${function () { self.event.trigger('jumpOut') }} disabled=${this.jumpOutDisabled} >
</button>
</div>`
if (!this.view) {
this.view = view
......@@ -45,11 +48,13 @@ ButtonNavigator.prototype.reset = function () {
this.intoForwardDisabled = true
this.overForwardDisabled = true
this.nextCallDisabled = true
this.jumpOutDisabled = true
}
ButtonNavigator.prototype.stepChanged = function (step) {
this.intoBackDisabled = step <= 0
this.overBackDisabled = step <= 0
this.jumpOutDisabled = step <= 0
if (!this.traceManager) {
this.intoForwardDisabled = true
this.overForwardDisabled = true
......@@ -77,6 +82,7 @@ ButtonNavigator.prototype.updateAll = function () {
this.updateDisabled('overforward', this.overForwardDisabled)
this.updateDisabled('intoforward', this.intoForwardDisabled)
this.updateDisabled('nextcall', this.nextCallDisabled)
this.updateDisabled('jumpout', this.jumpOutDisabled)
}
ButtonNavigator.prototype.updateDisabled = function (id, disabled) {
......
......@@ -42,6 +42,9 @@ function StepManager (_parent, _traceManager) {
this.buttonNavigator.event.register('jumpNextCall', this, function () {
self.jumpNextCall()
})
this.buttonNavigator.event.register('jumpOut', this, function () {
self.jumpOut()
})
}
StepManager.prototype.render = function () {
......@@ -126,6 +129,15 @@ StepManager.prototype.jumpNextCall = function () {
this.changeState(step)
}
StepManager.prototype.jumpOut = function () {
if (!this.traceManager.isLoaded()) {
return
}
var step = this.traceManager.findStepOut(this.currentStepIndex)
this.slider.setValue(step)
this.changeState(step)
}
StepManager.prototype.changeState = function (step) {
this.currentStepIndex = step
this.buttonNavigator.stepChanged(step)
......
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