move all references to currentStepIndex to the stepManager

pull/3094/head
Iuri Matias 6 years ago committed by yann300
parent 3e2a2e97ab
commit 93ca953143
  1. 9
      src/app/debugger/debugger/SolidityLocals.js
  2. 27
      src/app/debugger/debugger/VmDebugger.js
  3. 2
      src/app/debugger/debugger/debugger.js
  4. 9
      src/app/debugger/debugger/solidityState.js
  5. 3
      src/app/debugger/debuggerUI.js

@ -6,9 +6,10 @@ var StorageViewer = remixDebug.storage.StorageViewer
class DebuggerSolidityLocals {
constructor (_parent, _traceManager, _internalTreeCall) {
constructor (_parent, _stepManager, _traceManager, _internalTreeCall) {
this.event = new EventManager()
this.parent = _parent
this.stepManager = _stepManager
this.internalTreeCall = _internalTreeCall
this.storageResolver = null
this.traceManager = _traceManager
@ -38,7 +39,7 @@ class DebuggerSolidityLocals {
self.traceManager.getStackAt,
self.traceManager.getMemoryAt,
self.traceManager.getCurrentCalledAddressAt],
self.parent.currentStepIndex,
self.stepManager.currentStepIndex,
(error, result) => {
if (error) {
return console.log(error)
@ -46,8 +47,8 @@ class DebuggerSolidityLocals {
var stack = result[0].value
var memory = result[1].value
try {
var storageViewer = new StorageViewer({ stepIndex: self.parent.currentStepIndex, tx: self.parent.tx, address: result[2].value }, self.storageResolver, self.traceManager)
localDecoder.solidityLocals(self.parent.currentStepIndex, self.internalTreeCall, stack, memory, storageViewer, sourceLocation).then((locals) => {
var storageViewer = new StorageViewer({ stepIndex: self.stepManager.currentStepIndex, tx: self.parent.tx, address: result[2].value }, self.storageResolver, self.traceManager)
localDecoder.solidityLocals(self.stepManager.currentStepIndex, self.internalTreeCall, stack, memory, storageViewer, sourceLocation).then((locals) => {
if (!locals.error) {
self.event.trigger('solidityLocals', [locals])
}

@ -10,18 +10,19 @@ var DebuggerSolidityLocals = require('./solidityLocals')
class VmDebuggerLogic {
constructor (_parentUI, _traceManager, _codeManager, _solidityProxy, _callTree) {
constructor (_parentUI, _stepManager, _traceManager, _codeManager, _solidityProxy, _callTree) {
this.event = new EventManager()
this._parentUI = _parentUI
this._parent = this._parentUI.debugger
this.stepManager = _stepManager
this._traceManager = _traceManager
this._codeManager = _codeManager
this._solidityProxy = _solidityProxy
this._callTree = _callTree
this.storageResolver = null
this.debuggerSolidityState = new DebuggerSolidityState(_parentUI, _traceManager, _codeManager, _solidityProxy)
this.debuggerSolidityLocals = new DebuggerSolidityLocals(_parentUI, _traceManager, _callTree)
this.debuggerSolidityState = new DebuggerSolidityState(_parentUI, _stepManager, _traceManager, _codeManager, _solidityProxy)
this.debuggerSolidityLocals = new DebuggerSolidityLocals(_parentUI, _stepManager, _traceManager, _callTree)
}
start () {
@ -66,7 +67,7 @@ class VmDebuggerLogic {
this._parentUI.event.register('indexChanged', this, function (index) {
if (index < 0) return
if (self._parentUI.currentStepIndex !== index) return
if (self.stepManager.currentStepIndex !== index) return
self.event.trigger('indexUpdate', [index])
@ -74,7 +75,7 @@ class VmDebuggerLogic {
if (error) {
console.log(error)
self.event.trigger('traceManagerCallDataUpdate', [{}])
} else if (self._parentUI.currentStepIndex === index) {
} else if (self.stepManager.currentStepIndex === index) {
self.event.trigger('traceManagerCallDataUpdate', [calldata])
}
})
@ -83,7 +84,7 @@ class VmDebuggerLogic {
if (error) {
console.log(error)
self.event.trigger('traceManagerMemoryUpdate', [{}])
} else if (self._parentUI.currentStepIndex === index) {
} else if (self.stepManager.currentStepIndex === index) {
self.event.trigger('traceManagerMemoryUpdate', [ui.formatMemory(memory, 16)])
}
})
@ -92,7 +93,7 @@ class VmDebuggerLogic {
if (error) {
console.log(error)
self.event.trigger('traceManagerCallStackUpdate', [{}])
} else if (self._parentUI.currentStepIndex === index) {
} else if (self.stepManager.currentStepIndex === index) {
self.event.trigger('traceManagerCallStackUpdate', [callstack])
}
})
@ -101,7 +102,7 @@ class VmDebuggerLogic {
if (error) {
console.log(error)
self.event.trigger('traceManagerStackUpdate', [{}])
} else if (self._parentUI.currentStepIndex === index) {
} else if (self.stepManager.currentStepIndex === index) {
self.event.trigger('traceManagerStackUpdate', [callstack])
}
})
@ -110,13 +111,13 @@ class VmDebuggerLogic {
if (error) return
if (!self.storageResolver) return
var storageViewer = new StorageViewer({ stepIndex: self._parentUI.currentStepIndex, tx: self._parentUI.tx, address: address }, self.storageResolver, self._traceManager)
var storageViewer = new StorageViewer({ stepIndex: self.stepManager.currentStepIndex, tx: self._parentUI.tx, address: address }, self.storageResolver, self._traceManager)
storageViewer.storageRange((error, storage) => {
if (error) {
console.log(error)
self.event.trigger('traceManagerStorageUpdate', [{}])
} else if (self._parentUI.currentStepIndex === index) {
} else if (self.stepManager.currentStepIndex === index) {
var header = storageViewer.isComplete(address) ? 'completely loaded' : 'partially loaded...'
self.event.trigger('traceManagerStorageUpdate', [storage, header])
}
@ -146,7 +147,7 @@ class VmDebuggerLogic {
self._traceManager.getReturnValue(index, function (error, returnValue) {
if (error) {
self.event.trigger('traceReturnValueUpdate', [[error]])
} else if (self._parentUI.currentStepIndex === index) {
} else if (self.stepManager.currentStepIndex === index) {
self.event.trigger('traceReturnValueUpdate', [[returnValue]])
}
})
@ -175,7 +176,7 @@ class VmDebuggerLogic {
self._parentUI.debugger.event.register('indexChanged', this, function (index) {
if (index < 0) return
if (self._parent.currentStepIndex !== index) return
if (self.stepManager.currentStepIndex !== index) return
if (!self.storageResolver) return
if (index !== self.traceLength - 1) {
@ -184,7 +185,7 @@ class VmDebuggerLogic {
var storageJSON = {}
for (var k in self.addresses) {
var address = self.addresses[k]
var storageViewer = new StorageViewer({ stepIndex: self._parent.currentStepIndex, tx: self._parent.tx, address: address }, self.storageResolver, self._traceManager)
var storageViewer = new StorageViewer({ stepIndex: self.stepManager.currentStepIndex, tx: self._parent.tx, address: address }, self.storageResolver, self._traceManager)
storageViewer.storageRange(function (error, result) {
if (!error) {
storageJSON[address] = result

@ -91,7 +91,7 @@ Debugger.prototype.debug = function (parent, tx, loadingCb) {
})
})
this.vmDebuggerLogic = new VmDebuggerLogic(parent, this.debugger.traceManager, this.debugger.codeManager, this.debugger.solidityProxy, this.debugger.callTree)
this.vmDebuggerLogic = new VmDebuggerLogic(parent, this.step_manager, this.debugger.traceManager, this.debugger.codeManager, this.debugger.solidityProxy, this.debugger.callTree)
loadingCb()
this.debugger.debug(tx)

@ -6,10 +6,11 @@ var StorageViewer = remixDebug.storage.StorageViewer
class DebuggerSolidityState {
constructor (_parent, _traceManager, _codeManager, _solidityProxy) {
constructor (_parent, _stepManager, _traceManager, _codeManager, _solidityProxy) {
this.event = new EventManager()
this.storageResolver = null
this.parent = _parent
this.stepManager = _stepManager
this.traceManager = _traceManager
this.codeManager = _codeManager
this.solidityProxy = _solidityProxy
@ -26,7 +27,7 @@ class DebuggerSolidityState {
return self.event.trigger('solidityStateMessage', ['invalid step index'])
}
if (self.parent.currentStepIndex !== index) return
if (self.stepManager.currentStepIndex !== index) return
if (!self.solidityProxy.loaded()) {
return self.event.trigger('solidityStateMessage', ['invalid step index'])
}
@ -46,7 +47,7 @@ class DebuggerSolidityState {
decode (index) {
const self = this
self.traceManager.getCurrentCalledAddressAt(self.parent.currentStepIndex, function (error, address) {
self.traceManager.getCurrentCalledAddressAt(self.stepManager.currentStepIndex, function (error, address) {
if (error) {
return self.event.trigger('solidityState', [{}])
}
@ -65,7 +66,7 @@ class DebuggerSolidityState {
extractStateVariables (stateVars, address) {
const self = this
var storageViewer = new StorageViewer({ stepIndex: self.parent.currentStepIndex, tx: self.parent.tx, address: address }, self.storageResolver, self.traceManager)
var storageViewer = new StorageViewer({ stepIndex: self.stepManager.currentStepIndex, tx: self.parent.tx, address: address }, self.storageResolver, self.traceManager)
stateDecoder.decodeState(stateVars, storageViewer).then((result) => {
self.event.trigger('solidityStateMessage', [''])
if (result.error) {

@ -49,7 +49,6 @@ class DebuggerUI {
// this.startStepManager()
this.stepManager = null
this.currentStepIndex = -1
this.tx
this.statusMessage = ''
@ -167,7 +166,7 @@ class DebuggerUI {
this.transactionDebugger.debug(this, tx, () => {
self.stepManager = new StepManagerUI(this.transactionDebugger.step_manager)
self.stepManager.event.register('stepChanged', this, function (stepIndex) {
self.currentStepIndex = stepIndex
self.stepManager.currentStepIndex = stepIndex
self.event.trigger('indexChanged', [stepIndex])
})

Loading…
Cancel
Save