From 16f98a74123a21e642ee075bffb215a1632f06c2 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 3 Oct 2018 12:06:43 -0400 Subject: [PATCH] move step manager into debugger --- src/app/debugger/debugger/debugger.js | 6 ++++++ src/app/debugger/debuggerUI.js | 14 ++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/app/debugger/debugger/debugger.js b/src/app/debugger/debugger/debugger.js index ca0acaf107..9ae6d385d4 100644 --- a/src/app/debugger/debugger/debugger.js +++ b/src/app/debugger/debugger/debugger.js @@ -3,6 +3,8 @@ var Ethdebugger = require('remix-debug').EthDebugger var remixLib = require('remix-lib') var EventManager = remixLib.EventManager +var StepManager = require('./stepManager') + function Debugger (options) { var self = this this.event = new EventManager() @@ -73,4 +75,8 @@ Debugger.prototype.registerAndHighlightCodeItem = function (index) { }) } +Debugger.prototype.debug = function (parent) { + this.step_manager = new StepManager(parent, this.debugger.traceManager) +} + module.exports = Debugger diff --git a/src/app/debugger/debuggerUI.js b/src/app/debugger/debuggerUI.js index 1765dc558c..f602ea7bda 100644 --- a/src/app/debugger/debuggerUI.js +++ b/src/app/debugger/debuggerUI.js @@ -3,7 +3,6 @@ var StepManagerUI = require('./debuggerUI/StepManager') var VmDebugger = require('./debuggerUI/VmDebugger') var Debugger = require('./debugger/debugger') -var StepManager = require('./debugger/stepManager') var VmDebuggerLogic = require('./VmDebugger') var SourceHighlighter = require('../editor/sourceHighlighter') @@ -166,6 +165,12 @@ class DebuggerUI { this.tx = tx + this.transactionDebugger.debug(this) + this.stepManager = new StepManagerUI(this.transactionDebugger.step_manager) + this.stepManager.event.register('stepChanged', this, function (stepIndex) { + self.stepChanged(stepIndex) + }) + this.debugger.codeManager.event.register('changed', this, (code, address, instIndex) => { self.debugger.callTree.sourceLocationTracker.getSourceLocationFromVMTraceIndex(address, this.currentStepIndex, this.debugger.solidityProxy.contracts, (error, sourceLocation) => { if (!error) { @@ -174,12 +179,6 @@ class DebuggerUI { }) }) - this.transactionDebugger.step_manager = new StepManager(this, this.transactionDebugger.debugger.traceManager) - this.stepManager = new StepManagerUI(this.transactionDebugger.step_manager) - this.stepManager.event.register('stepChanged', this, function (stepIndex) { - self.stepChanged(stepIndex) - }) - this.vmDebuggerLogic = new VmDebuggerLogic(this, this.transactionDebugger.debugger.traceManager, this.transactionDebugger.debugger.codeManager, this.transactionDebugger.debugger.solidityProxy, this.transactionDebugger.debugger.callTree) this.vmDebugger = new VmDebugger(this.vmDebuggerLogic) this.andAddVmDebugger() @@ -203,7 +202,6 @@ class DebuggerUI { self.txBrowser.load(tx) self.getTxAndDebug(null, tx) } - }) }