move step detail logic into caller

pull/3094/head
Iuri Matias 6 years ago committed by yann300
parent b434d9e9c4
commit d6ddb83d05
  1. 32
      src/app/debugger/debuggerUI/VmDebugger.js
  2. 38
      src/app/debugger/debuggerUI/vmDebugger/StepDetail.js

@ -128,6 +128,38 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca
})
this.stepDetail = new StepDetail(_parentUI, _traceManager)
_parentUI.debugger.event.register('traceUnloaded', this, function () {
self.stepDetail.reset()
})
_parentUI.debugger.event.register('newTraceLoaded', this, function () {
self.stepDetail.reset()
})
_parentUI.event.register('indexChanged', this, function (index) {
if (index < 0) return
self.stepDetail.updateField('vm trace step', index)
_traceManager.getCurrentStep(index, function (error, step) {
self.stepDetail.updateField('execution step', (error ? '-' : step))
})
_traceManager.getMemExpand(index, function (error, addmem) {
self.stepDetail.updateField('add memory', (error ? '-' : addmem))
})
_traceManager.getStepCost(index, function (error, gas) {
self.stepDetail.updateField('gas', (error ? '-' : gas))
})
_traceManager.getCurrentCalledAddressAt(index, function (error, address) {
self.stepDetail.updateField('loaded address', (error ? '-' : address))
})
_traceManager.getRemainingGas(index, function (error, remaingas) {
self.stepDetail.updateField('remaining gas', (error ? '-' : remaingas))
})
})
this.solidityState = new SolidityState(_parentUI, _traceManager, _codeManager, _solidityProxy)
this.solidityLocals = new SolidityLocals(_parentUI, _traceManager, _callTree)

@ -13,7 +13,6 @@ function StepDetail (_parentUI, _traceManager) {
'vm trace step': '-', 'execution step': '-', 'add memory': '', 'gas': '', 'remaining gas': '-', 'loaded address': '-'
}
this.view
this.init()
}
StepDetail.prototype.reset = function () {
@ -32,41 +31,4 @@ StepDetail.prototype.render = function () {
return yo`<div id='stepdetail' >${this.basicPanel.render()}</div>`
}
StepDetail.prototype.init = function () {
var self = this
this.debugger.event.register('traceUnloaded', this, function () {
self.reset()
})
this.debugger.event.register('newTraceLoaded', this, function () {
self.reset()
})
this.parentUI.event.register('indexChanged', this, function (index) {
if (index < 0) return
self.updateField('vm trace step', index)
self.traceManager.getCurrentStep(index, function (error, step) {
self.updateField('execution step', (error ? '-' : step))
})
self.traceManager.getMemExpand(index, function (error, addmem) {
self.updateField('add memory', (error ? '-' : addmem))
})
self.traceManager.getStepCost(index, function (error, gas) {
self.updateField('gas', (error ? '-' : gas))
})
self.traceManager.getCurrentCalledAddressAt(index, function (error, address) {
self.updateField('loaded address', (error ? '-' : address))
})
self.traceManager.getRemainingGas(index, function (error, remaingas) {
self.updateField('remaining gas', (error ? '-' : remaingas))
})
})
}
module.exports = StepDetail

Loading…
Cancel
Save