From d9d73b079fa5596ce01f9e07a653a93a3fe46470 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 18 Jul 2018 17:08:07 +0300 Subject: [PATCH 01/34] update requires to new remix libs --- src/app/debugger/debugger.js | 3 +-- .../debugger/remix-debugger/src/ui/Ethdebugger.js | 13 ++++++------- .../remix-debugger/src/ui/FullStoragesChanges.js | 4 ++-- .../remix-debugger/src/ui/SolidityLocals.js | 8 ++++---- .../debugger/remix-debugger/src/ui/SolidityState.js | 8 ++++---- .../debugger/remix-debugger/src/ui/StoragePanel.js | 4 ++-- .../debugger/remix-debugger/src/ui/VmDebugger.js | 4 ++-- src/app/staticanalysis/staticAnalysisView.js | 2 +- team-best-practices.md | 1 - 9 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/app/debugger/debugger.js b/src/app/debugger/debugger.js index f0bcfd25c0..7b6890c985 100644 --- a/src/app/debugger/debugger.js +++ b/src/app/debugger/debugger.js @@ -2,7 +2,6 @@ var Ethdebugger = require('./remix-debugger/src/ui/Ethdebugger') var remixLib = require('remix-lib') -var remixCore = require('remix-core') var executionContext = require('../../execution-context') var globlalRegistry = require('../../global/registry') @@ -34,7 +33,7 @@ function Debugger (container, sourceHighlighter, localRegistry) { container.appendChild(this.debugger.render()) this.isActive = false - this.breakPointManager = new remixCore.code.BreakpointManager(this.debugger, (sourceLocation) => { + this.breakPointManager = new remixLib.code.BreakpointManager(this.debugger, (sourceLocation) => { return self._deps.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, this._deps.compiler.lastCompilationResult.source.sources) }) diff --git a/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js b/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js index 3323551d06..8ff491fa49 100644 --- a/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js +++ b/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js @@ -1,10 +1,9 @@ 'use strict' var TxBrowser = require('./TxBrowser') var StepManager = require('./StepManager') -var remixCore = require('remix-core') -var TraceManager = remixCore.trace.TraceManager -var VmDebugger = require('./VmDebugger') var remixLib = require('remix-lib') +var TraceManager = remixLib.trace.TraceManager +var VmDebugger = require('./VmDebugger') var global = remixLib.global var init = remixLib.init var executionContext = remixLib.execution.executionContext @@ -13,10 +12,10 @@ var yo = require('yo-yo') var csjs = require('csjs-inject') var Web3Providers = remixLib.vm.Web3Providers var DummyProvider = remixLib.vm.DummyProvider -var CodeManager = remixCore.code.CodeManager -var remixSolidity = require('remix-solidity') -var SolidityProxy = remixSolidity.SolidityProxy -var InternalCallTree = remixSolidity.InternalCallTree +var CodeManager = remixLib.code.CodeManager +var remixDebug = require('remix-debug') +var SolidityProxy = remixDebug.SolidityDecoder.SolidityProxy +var InternalCallTree = remixDebug.SolidityDecoder.InternalCallTree var css = csjs` .statusMessage { diff --git a/src/app/debugger/remix-debugger/src/ui/FullStoragesChanges.js b/src/app/debugger/remix-debugger/src/ui/FullStoragesChanges.js index ef454851c2..0c2dabd7ce 100644 --- a/src/app/debugger/remix-debugger/src/ui/FullStoragesChanges.js +++ b/src/app/debugger/remix-debugger/src/ui/FullStoragesChanges.js @@ -1,7 +1,7 @@ 'use strict' var DropdownPanel = require('./DropdownPanel') -var remixCore = require('remix-core') -var StorageViewer = remixCore.storage.StorageViewer +var remixDebug = require('remix-debug') +var StorageViewer = remixDebug.storage.StorageViewer var yo = require('yo-yo') function FullStoragesChanges (_parent, _traceManager) { diff --git a/src/app/debugger/remix-debugger/src/ui/SolidityLocals.js b/src/app/debugger/remix-debugger/src/ui/SolidityLocals.js index aaa5334c20..e7b19d0517 100644 --- a/src/app/debugger/remix-debugger/src/ui/SolidityLocals.js +++ b/src/app/debugger/remix-debugger/src/ui/SolidityLocals.js @@ -1,10 +1,10 @@ 'use strict' var DropdownPanel = require('./DropdownPanel') -var remixSolidity = require('remix-solidity') -var localDecoder = remixSolidity.localDecoder +// TODO: update this +var remixDebug = require('remix-debug') +var localDecoder = remixDebug.SoliditySecoder.localDecoder var solidityTypeFormatter = require('./SolidityTypeFormatter') -var remixCore = require('remix-core') -var StorageViewer = remixCore.storage.StorageViewer +var StorageViewer = remixDebug.storage.StorageViewer var yo = require('yo-yo') class SolidityLocals { diff --git a/src/app/debugger/remix-debugger/src/ui/SolidityState.js b/src/app/debugger/remix-debugger/src/ui/SolidityState.js index f69fc045f4..f735def0d1 100644 --- a/src/app/debugger/remix-debugger/src/ui/SolidityState.js +++ b/src/app/debugger/remix-debugger/src/ui/SolidityState.js @@ -1,10 +1,10 @@ 'use strict' var DropdownPanel = require('./DropdownPanel') -var remixSolidity = require('remix-solidity') -var stateDecoder = remixSolidity.stateDecoder +var remixDebug = require('remix-debug') +var stateDecoder = remixDebug.SolidityDecoder.stateDecoder var solidityTypeFormatter = require('./SolidityTypeFormatter') -var remixCore = require('remix-core') -var StorageViewer = remixCore.storage.StorageViewer +var remixLib = require('remix-lib') +var StorageViewer = remixLib.storage.StorageViewer var yo = require('yo-yo') function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) { diff --git a/src/app/debugger/remix-debugger/src/ui/StoragePanel.js b/src/app/debugger/remix-debugger/src/ui/StoragePanel.js index cd4573e4f7..d4386a2644 100644 --- a/src/app/debugger/remix-debugger/src/ui/StoragePanel.js +++ b/src/app/debugger/remix-debugger/src/ui/StoragePanel.js @@ -1,7 +1,7 @@ 'use strict' var DropdownPanel = require('./DropdownPanel') -var remixCore = require('remix-core') -var StorageViewer = remixCore.storage.StorageViewer +var remixLib = require('remix-lib') +var StorageViewer = remixLib.storage.StorageViewer var yo = require('yo-yo') function StoragePanel (_parent, _traceManager) { diff --git a/src/app/debugger/remix-debugger/src/ui/VmDebugger.js b/src/app/debugger/remix-debugger/src/ui/VmDebugger.js index 9e8be588b7..f42d77802e 100644 --- a/src/app/debugger/remix-debugger/src/ui/VmDebugger.js +++ b/src/app/debugger/remix-debugger/src/ui/VmDebugger.js @@ -11,8 +11,8 @@ var StepDetail = require('./StepDetail') var DropdownPanel = require('./DropdownPanel') var SolidityState = require('./SolidityState') var SolidityLocals = require('./SolidityLocals') -var remixCore = require('remix-core') -var StorageResolver = remixCore.storage.StorageResolver +var remixLib = require('remix-lib') +var StorageResolver = remixLib.storage.StorageResolver var yo = require('yo-yo') var css = csjs` diff --git a/src/app/staticanalysis/staticAnalysisView.js b/src/app/staticanalysis/staticAnalysisView.js index ae68a79e73..6bb5b56398 100644 --- a/src/app/staticanalysis/staticAnalysisView.js +++ b/src/app/staticanalysis/staticAnalysisView.js @@ -1,5 +1,5 @@ 'use strict' -var StaticAnalysisRunner = require('remix-solidity').CodeAnalysis +var StaticAnalysisRunner = require('remix-analyzer').CodeAnalysis var yo = require('yo-yo') var $ = require('jquery') var remixLib = require('remix-lib') diff --git a/team-best-practices.md b/team-best-practices.md index 3a5047cd98..beca23356e 100644 --- a/team-best-practices.md +++ b/team-best-practices.md @@ -16,7 +16,6 @@ Related links: - Remix live: remix.ethereum.org - Remix alpha live: remix-alpha.ethereum.org - Remix-ide NPM module: https://www.npmjs.com/package/remix-ide - - Remix-core NPM module: https://www.npmjs.com/package/remix-core - Remix-lib NPM module: https://www.npmjs.com/package/remix-lib - Remix-solidity NPM module: https://www.npmjs.com/package/remix-solidity - Remix-debug NPM module: https://www.npmjs.com/package/remix-debug From dd36c4157fb0ad572e505dca611b46c0a7f3fb95 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 25 Jul 2018 05:57:09 -0400 Subject: [PATCH 02/34] point to local libs to test --- package.json | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 66e4a1d6ab..e55ed8a341 100644 --- a/package.json +++ b/package.json @@ -37,9 +37,9 @@ "npm-link-local": "^1.1.0", "npm-run-all": "^4.0.2", "onchange": "^3.2.1", - "remix-core": "0.0.15", - "remix-lib": "0.2.9", - "remix-solidity": "0.1.11", + "remix-analyzer": "latest", + "remix-lib": "latest", + "remix-solidity": "latest", "remix-tests": "latest", "remixd": "git+https://github.com/ethereum/remixd.git", "request": "^2.83.0", @@ -145,14 +145,12 @@ "scripts": { "setupremix": "npm run pullremix && npm run linkremixcore && npm run linkremixlib && npm run linkremixsolidity;", "pullremix": "git clone https://github.com/ethereum/remix", - "linkremixcore": "cd node_modules && rm -rf remix-core && ln -s ../remix/remix-core remix-core && cd ..", "linkremixlib": "cd node_modules && rm -rf remix-lib && ln -s ../remix/remix-lib remix-lib && cd ..", "linkremixsolidity": "cd node_modules && rm -rf remix-solidity && ln -s ../remix/remix-solidity remix-solidity && cd ..", "build": "browserify src/index.js -o build/app.js --exclude solc", "build_debugger": "browserify src/app/debugger/remix-debugger/index.js -o src/app/debugger/remix-debugger/build/app.js", "browsertest": "sleep 5 && npm run nightwatch_local", "csslint": "csslint --ignore=order-alphabetical --errors='errors,duplicate-properties,empty-rules' --exclude-list='assets/css/font-awesome.min.css' assets/css/", - "downloadsolc": "rimraf soljson.js && cd node_modules/solc && wget --no-check-certificate https://solc-bin.ethereum.org/soljson.js && cd ../../", "downloadsolc_root": "wget --no-check-certificate https://solc-bin.ethereum.org/soljson.js", "lint": "standard | notify-error", "make-mock-compiler": "node ci/makeMockCompiler.js", From baa87b479ca5679ad020b5355576b219193c184a Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 26 Jul 2018 04:29:56 -0400 Subject: [PATCH 03/34] use lastest package versions --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index e55ed8a341..ba814dae9e 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ }, "dependencies": { "http-server": "0.9.0", + "remix-debug": "latest", "remixd": "git+https://github.com/ethereum/remixd.git" }, "repository": { From c0bfb112d684f6e8a31bb561c3e45920fff6fcf8 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 26 Jul 2018 08:33:53 -0400 Subject: [PATCH 04/34] fix reference to storage --- src/app/debugger/remix-debugger/src/ui/SolidityState.js | 2 +- src/app/debugger/remix-debugger/src/ui/StoragePanel.js | 2 +- src/app/debugger/remix-debugger/src/ui/VmDebugger.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/debugger/remix-debugger/src/ui/SolidityState.js b/src/app/debugger/remix-debugger/src/ui/SolidityState.js index f735def0d1..282d553bee 100644 --- a/src/app/debugger/remix-debugger/src/ui/SolidityState.js +++ b/src/app/debugger/remix-debugger/src/ui/SolidityState.js @@ -4,7 +4,7 @@ var remixDebug = require('remix-debug') var stateDecoder = remixDebug.SolidityDecoder.stateDecoder var solidityTypeFormatter = require('./SolidityTypeFormatter') var remixLib = require('remix-lib') -var StorageViewer = remixLib.storage.StorageViewer +var StorageViewer = remixLib.Storage.StorageViewer var yo = require('yo-yo') function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) { diff --git a/src/app/debugger/remix-debugger/src/ui/StoragePanel.js b/src/app/debugger/remix-debugger/src/ui/StoragePanel.js index d4386a2644..fca196aee6 100644 --- a/src/app/debugger/remix-debugger/src/ui/StoragePanel.js +++ b/src/app/debugger/remix-debugger/src/ui/StoragePanel.js @@ -1,7 +1,7 @@ 'use strict' var DropdownPanel = require('./DropdownPanel') var remixLib = require('remix-lib') -var StorageViewer = remixLib.storage.StorageViewer +var StorageViewer = remixLib.Storage.StorageViewer var yo = require('yo-yo') function StoragePanel (_parent, _traceManager) { diff --git a/src/app/debugger/remix-debugger/src/ui/VmDebugger.js b/src/app/debugger/remix-debugger/src/ui/VmDebugger.js index f42d77802e..b15219a076 100644 --- a/src/app/debugger/remix-debugger/src/ui/VmDebugger.js +++ b/src/app/debugger/remix-debugger/src/ui/VmDebugger.js @@ -12,7 +12,7 @@ var DropdownPanel = require('./DropdownPanel') var SolidityState = require('./SolidityState') var SolidityLocals = require('./SolidityLocals') var remixLib = require('remix-lib') -var StorageResolver = remixLib.storage.StorageResolver +var StorageResolver = remixLib.Storage.StorageResolver var yo = require('yo-yo') var css = csjs` From 3a21e1c70b3aaf6d12f118315b160d719ce262eb Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 27 Jul 2018 04:56:59 -0400 Subject: [PATCH 05/34] fix typo --- src/app/debugger/remix-debugger/src/ui/SolidityLocals.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/debugger/remix-debugger/src/ui/SolidityLocals.js b/src/app/debugger/remix-debugger/src/ui/SolidityLocals.js index e7b19d0517..a3bc7fecf6 100644 --- a/src/app/debugger/remix-debugger/src/ui/SolidityLocals.js +++ b/src/app/debugger/remix-debugger/src/ui/SolidityLocals.js @@ -2,7 +2,7 @@ var DropdownPanel = require('./DropdownPanel') // TODO: update this var remixDebug = require('remix-debug') -var localDecoder = remixDebug.SoliditySecoder.localDecoder +var localDecoder = remixDebug.SolidityDecoder.localDecoder var solidityTypeFormatter = require('./SolidityTypeFormatter') var StorageViewer = remixDebug.storage.StorageViewer var yo = require('yo-yo') From 5b97c656612b61ac6bcb857a8f8cadec36337dae Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 30 Jul 2018 17:23:16 -0400 Subject: [PATCH 06/34] cleanup --- src/app/debugger/remix-debugger/src/ui/Ethdebugger.js | 1 - src/app/debugger/remix-debugger/src/ui/SolidityLocals.js | 1 - src/app/debugger/remix-debugger/src/ui/TxBrowser.js | 1 - 3 files changed, 3 deletions(-) diff --git a/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js b/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js index 8ff491fa49..a5713f102d 100644 --- a/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js +++ b/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js @@ -4,7 +4,6 @@ var StepManager = require('./StepManager') var remixLib = require('remix-lib') var TraceManager = remixLib.trace.TraceManager var VmDebugger = require('./VmDebugger') -var global = remixLib.global var init = remixLib.init var executionContext = remixLib.execution.executionContext var EventManager = remixLib.EventManager diff --git a/src/app/debugger/remix-debugger/src/ui/SolidityLocals.js b/src/app/debugger/remix-debugger/src/ui/SolidityLocals.js index a3bc7fecf6..2fc5861a42 100644 --- a/src/app/debugger/remix-debugger/src/ui/SolidityLocals.js +++ b/src/app/debugger/remix-debugger/src/ui/SolidityLocals.js @@ -1,6 +1,5 @@ 'use strict' var DropdownPanel = require('./DropdownPanel') -// TODO: update this var remixDebug = require('remix-debug') var localDecoder = remixDebug.SolidityDecoder.localDecoder var solidityTypeFormatter = require('./SolidityTypeFormatter') diff --git a/src/app/debugger/remix-debugger/src/ui/TxBrowser.js b/src/app/debugger/remix-debugger/src/ui/TxBrowser.js index f2d6a00aa1..0ea2aa1aa1 100644 --- a/src/app/debugger/remix-debugger/src/ui/TxBrowser.js +++ b/src/app/debugger/remix-debugger/src/ui/TxBrowser.js @@ -1,5 +1,4 @@ var remixLib = require('remix-lib') -var global = remixLib.global var EventManager = remixLib.EventManager var traceHelper = remixLib.helpers.trace var yo = require('yo-yo') From 20859383b16050665e0ca730afa3447df253d099 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 31 Jul 2018 13:54:25 -0400 Subject: [PATCH 07/34] fix web3 obj --- src/app/debugger/debugger.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/debugger/debugger.js b/src/app/debugger/debugger.js index 7b6890c985..96f6d06ec0 100644 --- a/src/app/debugger/debugger.js +++ b/src/app/debugger/debugger.js @@ -1,5 +1,4 @@ 'use strict' - var Ethdebugger = require('./remix-debugger/src/ui/Ethdebugger') var remixLib = require('remix-lib') var executionContext = require('../../execution-context') @@ -90,7 +89,7 @@ function Debugger (container, sourceHighlighter, localRegistry) { */ Debugger.prototype.debug = function (txHash) { var self = this - this.debugger.web3().eth.getTransaction(txHash, function (error, tx) { + this.debugger.web3.eth.getTransaction(txHash, function (error, tx) { if (!error) { self.debugger.debug(tx) } @@ -120,7 +119,7 @@ Debugger.prototype.switchProvider = function (type) { * get the current provider */ Debugger.prototype.web3 = function (type) { - return this.debugger.web3() + return this.debugger.web3 } module.exports = Debugger From 5c30948fc3d2a0f6f092e3876e037357dec8c853 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 1 Aug 2018 07:38:30 -0400 Subject: [PATCH 08/34] update txbrowser web3 reference --- .../remix-debugger/src/ui/Ethdebugger.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js b/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js index a5713f102d..b506863239 100644 --- a/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js +++ b/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js @@ -57,6 +57,8 @@ function Ethdebugger (opts) { self.unLoad() }) this.txBrowser.event.register('newTraceRequested', this, function (blockNumber, txIndex, tx) { + console.dir('newTraceRequestd') + console.dir(arguments) self.startDebugging(blockNumber, txIndex, tx) }) this.txBrowser.event.register('unloadRequested', this, function (blockNumber, txIndex, tx) { @@ -90,13 +92,20 @@ Ethdebugger.prototype.addProvider = function (type, obj) { this.event.trigger('providerAdded', [type]) } +Ethdebugger.prototype.updateWeb3Reference = function () { + if (!this.txBrowser) return + this.txBrowser.web3 = this.web3 +} + Ethdebugger.prototype.switchProvider = function (type) { var self = this this.web3Providers.get(type, function (error, obj) { if (error) { console.log('provider ' + type + ' not defined') } else { - global.web3 = obj + self.web3 = obj + self.setManagers() + self.updateWeb3Reference() executionContext.detectNetwork((error, network) => { if (error || !network) { global.web3Debug = obj @@ -104,6 +113,7 @@ Ethdebugger.prototype.switchProvider = function (type) { var webDebugNode = init.web3DebugNode(network.name) global.web3Debug = !webDebugNode ? obj : webDebugNode } + self.updateWeb3Reference() }) self.event.trigger('providerChanged', [type]) } @@ -156,6 +166,8 @@ Ethdebugger.prototype.stepChanged = function (stepIndex) { } Ethdebugger.prototype.startDebugging = function (blockNumber, txIndex, tx) { + console.dir('startDebugging') + console.dir(arguments) if (this.traceManager.isLoading) { return } @@ -165,6 +177,8 @@ Ethdebugger.prototype.startDebugging = function (blockNumber, txIndex, tx) { console.log('loading trace...') this.tx = tx var self = this + console.dir('resolving a trace with tx: ') + console.dir(tx) this.traceManager.resolveTrace(tx, function (error, result) { console.log('trace loaded ' + result) if (result) { From 17721ffde32c4968c45a5708941ed840059ee2ea Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 1 Aug 2018 08:29:43 -0400 Subject: [PATCH 09/34] reinit vmdebugger; tolerate view not existing --- .../debugger/remix-debugger/src/ui/Ethdebugger.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js b/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js index b506863239..6a0ee8a152 100644 --- a/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js +++ b/src/app/debugger/remix-debugger/src/ui/Ethdebugger.js @@ -79,6 +79,18 @@ function Ethdebugger (opts) { }) } +Ethdebugger.prototype.setManagers = function () { + this.traceManager = new TraceManager({web3: this.web3}) + this.codeManager = new CodeManager(this.traceManager) + this.solidityProxy = new SolidityProxy(this.traceManager, this.codeManager) + this.storageResolver = null + var callTree = new InternalCallTree(this.event, this.traceManager, this.solidityProxy, this.codeManager, { includeLocalVariables: true }) + this.callTree = callTree // TODO: currently used by browser solidity, we should improve the API + this.vmDebugger = new VmDebugger(this, this.traceManager, this.codeManager, this.solidityProxy, callTree) + + this.callTree = new InternalCallTree(this.event, this.traceManager, this.solidityProxy, this.codeManager, { includeLocalVariables: true }) +} + Ethdebugger.prototype.setBreakpointManager = function (breakpointManager) { this.breakpointManager = breakpointManager } From a252ab7800786f7656417057f3cbd4d602e8828f Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 13 Aug 2018 07:46:50 -0400 Subject: [PATCH 10/34] fix fixes for remix-debug integration --- package.json | 4 +- src/app/debugger/debugger.js | 13 +- src/app/debugger/remix-debugger/index.html | 2 +- .../remix-debugger/src/ui/EthdebuggerUI.js | 266 ++++++++++++++++++ .../src/ui/FullStoragesChanges.js | 5 +- .../remix-debugger/src/ui/StepManager.js | 2 +- .../remix-debugger/src/ui/TxBrowser.js | 1 + .../remix-debugger/src/ui/VmDebugger.js | 16 +- 8 files changed, 294 insertions(+), 15 deletions(-) create mode 100644 src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js diff --git a/package.json b/package.json index ba814dae9e..cc38bf6842 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "npm-run-all": "^4.0.2", "onchange": "^3.2.1", "remix-analyzer": "latest", - "remix-lib": "latest", + "remix-lib": "../remix/remix-lib", "remix-solidity": "latest", "remix-tests": "latest", "remixd": "git+https://github.com/ethereum/remixd.git", @@ -58,7 +58,7 @@ }, "dependencies": { "http-server": "0.9.0", - "remix-debug": "latest", + "remix-debug": "../remix/remix-debug", "remixd": "git+https://github.com/ethereum/remixd.git" }, "repository": { diff --git a/src/app/debugger/debugger.js b/src/app/debugger/debugger.js index 96f6d06ec0..296fc0c9f3 100644 --- a/src/app/debugger/debugger.js +++ b/src/app/debugger/debugger.js @@ -1,5 +1,6 @@ 'use strict' -var Ethdebugger = require('./remix-debugger/src/ui/Ethdebugger') +var EthdebuggerUI = require('./remix-debugger/src/ui/EthdebuggerUI') +var Ethdebugger = require('remix-debug').EthDebugger var remixLib = require('remix-lib') var executionContext = require('../../execution-context') var globlalRegistry = require('../../global/registry') @@ -20,6 +21,7 @@ function Debugger (container, sourceHighlighter, localRegistry) { } this.debugger = new Ethdebugger( { + executionContext: executionContext, compilationResult: () => { var compilationResult = this._deps.compiler.lastCompilationResult if (compilationResult) { @@ -28,8 +30,12 @@ function Debugger (container, sourceHighlighter, localRegistry) { return null } }) + this.debugger_ui = new EthdebuggerUI({debugger: this.debugger}) this.sourceMappingDecoder = new remixLib.SourceMappingDecoder() - container.appendChild(this.debugger.render()) + // + // TODO: render doesn't exist anymore + container.appendChild(this.debugger_ui.render()) + // this.isActive = false this.breakPointManager = new remixLib.code.BreakpointManager(this.debugger, (sourceLocation) => { @@ -50,6 +56,7 @@ function Debugger (container, sourceHighlighter, localRegistry) { }) executionContext.event.register('contextChanged', this, function (context) { + debugger; self.switchProvider(context) }) @@ -103,6 +110,7 @@ Debugger.prototype.debug = function (txHash) { * @param {Object} obj - provider */ Debugger.prototype.addProvider = function (type, obj) { + debugger; this.debugger.addProvider(type, obj) } @@ -112,6 +120,7 @@ Debugger.prototype.addProvider = function (type, obj) { * @param {String} type - type/name of the provider to use */ Debugger.prototype.switchProvider = function (type) { + debugger; this.debugger.switchProvider(type) } diff --git a/src/app/debugger/remix-debugger/index.html b/src/app/debugger/remix-debugger/index.html index 4c6c33cf4c..5e3f491a5d 100644 --- a/src/app/debugger/remix-debugger/index.html +++ b/src/app/debugger/remix-debugger/index.html @@ -10,7 +10,7 @@ container.debugger = new window.remix.ui.Debugger() container.debugger.addProvider('INTERNAL') container.debugger.switchProvider('INTERNAL') - container.appendChild(container.debugger.render()) + container.appendChild(container.debugger_ui.render()) }
diff --git a/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js b/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js new file mode 100644 index 0000000000..f6461b03f6 --- /dev/null +++ b/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js @@ -0,0 +1,266 @@ +'use strict' +var TxBrowser = require('./TxBrowser') +var StepManager = require('./StepManager') +var VmDebugger = require('./VmDebugger') + +var yo = require('yo-yo') +var csjs = require('csjs-inject') + +var remixLib = require('remix-lib') +// var TraceManager = remixLib.trace.TraceManager +var init = remixLib.init +var executionContext = remixLib.execution.executionContext +var EventManager = remixLib.EventManager +// var Web3Providers = remixLib.vm.Web3Providers +// var DummyProvider = remixLib.vm.DummyProvider +// var CodeManager = remixLib.code.CodeManager + +// var remixDebug = require('remix-debug') +// var SolidityProxy = remixDebug.SolidityDecoder.SolidityProxy +// var InternalCallTree = remixDebug.SolidityDecoder.InternalCallTree + +var css = csjs` + .statusMessage { + margin-left: 15px; + } + .innerShift { + padding: 2px; + margin-left: 10px; + } +` + +function EthdebuggerUI (opts) { + this.opts = opts || {} + this.debugger = opts.debugger + + if (!this.opts.compilationResult) this.opts.compilationResult = () => { return null } + + var self = this + this.event = new EventManager() + + this.currentStepIndex = -1 + this.tx + this.statusMessage = '' + + this.view + + this.event.register('indexChanged', this, function (index) { + self.debugger.codeManager.resolveStep(index, self.tx) + }) + + executionContext.event.register('contextChanged', this, function() { + console.dir("== contextChanged!!"); + self.updateWeb3Reference() + }); + + setTimeout(function() { + self.updateWeb3Reference() + }, 10000); + + this.txBrowser = new TxBrowser(this) + this.txBrowser.event.register('newTxLoading', this, function () { + self.unLoad() + }) + this.txBrowser.event.register('newTraceRequested', this, function (blockNumber, txIndex, tx) { + console.dir('newTraceRequestd') + console.dir(arguments) + self.startDebugging(blockNumber, txIndex, tx) + }) + this.txBrowser.event.register('unloadRequested', this, function (blockNumber, txIndex, tx) { + self.unLoad() + }) + this.stepManager = new StepManager(this, this.debugger.traceManager) + 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) { + self.event.trigger('sourceLocationChanged', [sourceLocation]) + } + }) + }) +} + +EthdebuggerUI.prototype.setManagers = function () { + // const self = this + // this.traceManager = new TraceManager({web3: this.web3}) + // this.codeManager = new CodeManager(this.traceManager) + // this.solidityProxy = new SolidityProxy(this.traceManager, this.codeManager) + // this.storageResolver = null + // var callTree = new InternalCallTree(this.event, this.traceManager, this.solidityProxy, this.codeManager, { includeLocalVariables: true }) + // this.callTree = callTree // TODO: currently used by browser solidity, we should improve the API + // this.vmDebugger = new VmDebugger(this, this.traceManager, this.codeManager, this.solidityProxy, callTree) + + // this.callTree = new InternalCallTree(this.event, this.traceManager, this.solidityProxy, this.codeManager, { includeLocalVariables: true }) + // this.txBrowser = new TxBrowser(this) + // this.txBrowser.event.register('newTxLoading', this, function () { + // self.unLoad() + // }) + // this.txBrowser.event.register('newTraceRequested', this, function (blockNumber, txIndex, tx) { + // console.dir('newTraceRequestd') + // console.dir(arguments) + // self.startDebugging(blockNumber, txIndex, tx) + // }) + // this.txBrowser.event.register('unloadRequested', this, function (blockNumber, txIndex, tx) { + // self.unLoad() + // }) + // this.stepManager = new StepManager(this, this.traceManager) + // this.stepManager.event.register('stepChanged', this, function (stepIndex) { + // self.stepChanged(stepIndex) + // }) + // this.vmDebugger = new VmDebugger(this, this.traceManager, this.codeManager, this.solidityProxy, callTree) + + // this.codeManager.event.register('changed', this, (code, address, instIndex) => { + // this.callTree.sourceLocationTracker.getSourceLocationFromVMTraceIndex(address, this.currentStepIndex, this.solidityProxy.contracts, (error, sourceLocation) => { + // if (!error) { + // this.event.trigger('sourceLocationChanged', [sourceLocation]) + // } + // }) + // }) +} + +EthdebuggerUI.prototype.setBreakpointManager = function (breakpointManager) { + this.breakpointManager = breakpointManager +} + +EthdebuggerUI.prototype.get_web3 = function () { + return this.web3 +} + +EthdebuggerUI.prototype.addProvider = function (type, obj) { + this.web3Providers.addProvider(type, obj) + this.event.trigger('providerAdded', [type]) +} + +EthdebuggerUI.prototype.updateWeb3Reference = function () { + debugger; + if (!this.txBrowser) return + this.txBrowser.web3 = this.debugger.web3 +} + +EthdebuggerUI.prototype.switchProvider = function (type) { + debugger; + var self = this + this.web3Providers.get(type, function (error, obj) { + debugger; + if (error) { + console.log('provider ' + type + ' not defined') + } else { + self.web3 = obj + //self.setManagers() + self.updateWeb3Reference() + executionContext.detectNetwork((error, network) => { + debugger; + if (error || !network) { + self.web3Debug = obj + self.web3 = obj + } else { + var webDebugNode = init.web3DebugNode(network.name) + self.web3Debug = !webDebugNode ? obj : webDebugNode + self.web3 = !webDebugNode ? obj : webDebugNode + } + self.updateWeb3Reference() + }) + self.event.trigger('providerChanged', [type]) + } + }) +} + +EthdebuggerUI.prototype.setCompilationResult = function (compilationResult) { + if (compilationResult && compilationResult.sources && compilationResult.contracts) { + this.debugger.solidityProxy.reset(compilationResult) + } else { + this.debugger.solidityProxy.reset({}) + } +} + +EthdebuggerUI.prototype.debug = function (tx) { + this.setCompilationResult(this.opts.compilationResult()) + if (tx instanceof Object) { + this.txBrowser.load(tx.hash) + } else if (tx instanceof String) { + this.txBrowser.load(tx) + } +} + +EthdebuggerUI.prototype.render = function () { + var view = yo`
+
+ ${this.txBrowser.render()} + ${this.stepManager.render()} +
+
${this.statusMessage}
+
` + if (!this.view) { + this.view = view + } + return view +} + +EthdebuggerUI.prototype.unLoad = function () { + // this.debugger.traceManager.init() + // this.debugger.codeManager.clear() + // this.debugger.stepManager.reset() + this.debugger.unLoad() + this.event.trigger('traceUnloaded') +} + +EthdebuggerUI.prototype.stepChanged = function (stepIndex) { + this.currentStepIndex = stepIndex + this.event.trigger('indexChanged', [stepIndex]) +} + +EthdebuggerUI.prototype.startDebugging = function (blockNumber, txIndex, tx) { + const self = this; + console.dir('startDebugging') + console.dir(arguments) + if (this.debugger.traceManager.isLoading) { + return + } + + this.statusMessage = 'Loading trace...' + yo.update(this.view, this.render()) + console.log('loading trace...') + this.tx = tx + //this.tx.hash = txIndex + + // this.debugger.setCompilationResult(this.opts.compilationResult()) + // this.setCompilationResult(this.opts.compilationResult()) + + //this.debugger.addProvider('web3', executionContext.web3()) + //this.debugger.switchProvider('web3') + + this.vmDebugger = new VmDebugger(this, this.debugger.traceManager, this.debugger.codeManager, this.debugger.solidityProxy, this.debugger.callTree) + + this.view.appendChild(this.vmDebugger.render()) + + this.debugger.debug(tx) + + //console.dir(this.vmDebugger.render()) + //console.dir(this.view) + + self.debugger.event.register('newTraceLoaded', function () { + // self. + }) + + console.dir('resolving a trace with tx: ') + console.dir(tx) + //this.debugger.traceManager.resolveTrace(tx, function (error, result) { + // console.log('trace loaded ' + result) + // if (result) { + // self.statusMessage = '' + // yo.update(self.view, self.render()) + // self.debugger.event.trigger('newTraceLoaded', [self.debugger.traceManager.trace]) + // // if (self.breakpointManager && self.breakpointManager.hasBreakpoint()) { + // // self.breakpointManager.jumpNextBreakpoint(0, false) + // // } + // } else { + // self.statusMessage = error ? error.message : 'Trace not loaded' + // yo.update(self.view, self.render()) + // } + //}) +} + +module.exports = EthdebuggerUI diff --git a/src/app/debugger/remix-debugger/src/ui/FullStoragesChanges.js b/src/app/debugger/remix-debugger/src/ui/FullStoragesChanges.js index 0c2dabd7ce..7051efac05 100644 --- a/src/app/debugger/remix-debugger/src/ui/FullStoragesChanges.js +++ b/src/app/debugger/remix-debugger/src/ui/FullStoragesChanges.js @@ -7,6 +7,7 @@ var yo = require('yo-yo') function FullStoragesChanges (_parent, _traceManager) { this.storageResolver = null this.parent = _parent + this.debugger = _parent.debugger this.traceManager = _traceManager this.addresses = [] this.view @@ -25,7 +26,7 @@ FullStoragesChanges.prototype.render = function () { FullStoragesChanges.prototype.init = function () { var self = this - this.parent.event.register('newTraceLoaded', this, function (length) { + this.debugger.event.register('newTraceLoaded', this, function (length) { self.panels = [] self.traceManager.getAddresses(function (error, addresses) { if (!error) { @@ -41,7 +42,7 @@ FullStoragesChanges.prototype.init = function () { }) }) - this.parent.event.register('indexChanged', this, function (index) { + this.debugger.event.register('indexChanged', this, function (index) { if (index < 0) return if (self.parent.currentStepIndex !== index) return if (!self.storageResolver) return diff --git a/src/app/debugger/remix-debugger/src/ui/StepManager.js b/src/app/debugger/remix-debugger/src/ui/StepManager.js index 2dc218986d..9f65feade2 100644 --- a/src/app/debugger/remix-debugger/src/ui/StepManager.js +++ b/src/app/debugger/remix-debugger/src/ui/StepManager.js @@ -8,7 +8,7 @@ var util = remixLib.util function StepManager (_parent, _traceManager) { this.event = new EventManager() - this.parent = _parent + this.parent = _parent.debugger this.traceManager = _traceManager this.sourceMapByAddress = {} this.solidityMode = false diff --git a/src/app/debugger/remix-debugger/src/ui/TxBrowser.js b/src/app/debugger/remix-debugger/src/ui/TxBrowser.js index 0ea2aa1aa1..f2ec323364 100644 --- a/src/app/debugger/remix-debugger/src/ui/TxBrowser.js +++ b/src/app/debugger/remix-debugger/src/ui/TxBrowser.js @@ -49,6 +49,7 @@ function TxBrowser (_parent) { this.txNumber this.view this.displayConnectionSetting = true + this.web3 = _parent.debugger.web3 var self = this _parent.event.register('providerChanged', this, function (provider) { self.displayConnectionSetting = provider === 'INTERNAL' diff --git a/src/app/debugger/remix-debugger/src/ui/VmDebugger.js b/src/app/debugger/remix-debugger/src/ui/VmDebugger.js index b15219a076..1e73e5ea92 100644 --- a/src/app/debugger/remix-debugger/src/ui/VmDebugger.js +++ b/src/app/debugger/remix-debugger/src/ui/VmDebugger.js @@ -11,8 +11,8 @@ var StepDetail = require('./StepDetail') var DropdownPanel = require('./DropdownPanel') var SolidityState = require('./SolidityState') var SolidityLocals = require('./SolidityLocals') -var remixLib = require('remix-lib') -var StorageResolver = remixLib.Storage.StorageResolver +var remixDebug = require('remix-debug') +var StorageResolver = remixDebug.storage.StorageResolver var yo = require('yo-yo') var css = csjs` @@ -25,7 +25,9 @@ var css = csjs` } ` -function VmDebugger (_parent, _traceManager, _codeManager, _solidityProxy, _callTree) { +function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _callTree) { + let _parent = _parentUI.debugger + this.asmCode = new CodeListView(_parent, _codeManager) this.stackPanel = new StackPanel(_parent, _traceManager) this.storagePanel = new StoragePanel(_parent, _traceManager) @@ -39,24 +41,24 @@ function VmDebugger (_parent, _traceManager, _codeManager, _solidityProxy, _call /* Return values - */ this.returnValuesPanel = new DropdownPanel('Return Value', {json: true}) this.returnValuesPanel.data = {} - _parent.event.register('indexChanged', this.returnValuesPanel, function (index) { + _parentUI.event.register('indexChanged', this.returnValuesPanel, function (index) { var self = this _traceManager.getReturnValue(index, function (error, returnValue) { if (error) { self.update([error]) - } else if (_parent.currentStepIndex === index) { + } else if (_parentUI.currentStepIndex === index) { self.update([returnValue]) } }) }) /* Return values - */ - this.fullStoragesChangesPanel = new FullStoragesChangesPanel(_parent, _traceManager) + this.fullStoragesChangesPanel = new FullStoragesChangesPanel(_parentUI, _traceManager) this.view var self = this _parent.event.register('newTraceLoaded', this, function () { - var storageResolver = new StorageResolver() + var storageResolver = new StorageResolver({web3: _parent.web3}) self.storagePanel.storageResolver = storageResolver self.solidityState.storageResolver = storageResolver self.solidityLocals.storageResolver = storageResolver From ca47914d6ac45a1c4cfa6020cf78c6db8d9d17f9 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 14 Aug 2018 10:29:36 +0200 Subject: [PATCH 11/34] fix debugging --- package.json | 4 +-- src/app/debugger/debugger.js | 19 +++++----- .../remix-debugger/src/ui/CalldataPanel.js | 10 +++--- .../remix-debugger/src/ui/EthdebuggerUI.js | 36 +++++++++---------- .../remix-debugger/src/ui/SolidityState.js | 3 +- .../remix-debugger/src/ui/StepDetail.js | 11 +++--- .../remix-debugger/src/ui/StepManager.js | 4 +-- .../remix-debugger/src/ui/StoragePanel.js | 4 +-- .../remix-debugger/src/ui/VmDebugger.js | 16 ++++----- 9 files changed, 54 insertions(+), 53 deletions(-) diff --git a/package.json b/package.json index cc38bf6842..00a453a088 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "npm-run-all": "^4.0.2", "onchange": "^3.2.1", "remix-analyzer": "latest", - "remix-lib": "../remix/remix-lib", + "remix-lib": "./remix/remix-lib", "remix-solidity": "latest", "remix-tests": "latest", "remixd": "git+https://github.com/ethereum/remixd.git", @@ -58,7 +58,7 @@ }, "dependencies": { "http-server": "0.9.0", - "remix-debug": "../remix/remix-debug", + "remix-debug": "./remix/remix-debug", "remixd": "git+https://github.com/ethereum/remixd.git" }, "repository": { diff --git a/src/app/debugger/debugger.js b/src/app/debugger/debugger.js index 296fc0c9f3..ea1d0d9727 100644 --- a/src/app/debugger/debugger.js +++ b/src/app/debugger/debugger.js @@ -75,15 +75,18 @@ function Debugger (container, sourceHighlighter, localRegistry) { }) // register selected code item, highlight the corresponding source location - this.debugger.codeManager.event.register('changed', this, function (code, address, index) { + this.debugger_ui.event.register('indexChanged', function (index) { if (self._deps.compiler.lastCompilationResult) { - self.debugger.callTree.sourceLocationTracker.getSourceLocationFromInstructionIndex(address, index, self._deps.compiler.lastCompilationResult.data.contracts, function (error, rawLocation) { - if (!error && self._deps.compiler.lastCompilationResult && self._deps.compiler.lastCompilationResult.data) { - var lineColumnPos = self._deps.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, self._deps.compiler.lastCompilationResult.source.sources) - self._components.sourceHighlighter.currentSourceLocation(lineColumnPos, rawLocation) - } else { - self._components.sourceHighlighter.currentSourceLocation(null) - } + self.debugger.traceManager.getCurrentCalledAddressAt(index, (error, address) => { + if (error) return console.log(error) + self.debugger.callTree.sourceLocationTracker.getSourceLocationFromInstructionIndex(address, index, self._deps.compiler.lastCompilationResult.data.contracts, function (error, rawLocation) { + if (!error && self._deps.compiler.lastCompilationResult && self._deps.compiler.lastCompilationResult.data) { + var lineColumnPos = self._deps.offsetToLineColumnConverter.offsetToLineColumn(rawLocation, rawLocation.file, self._deps.compiler.lastCompilationResult.source.sources) + self._components.sourceHighlighter.currentSourceLocation(lineColumnPos, rawLocation) + } else { + self._components.sourceHighlighter.currentSourceLocation(null) + } + }) }) } }) diff --git a/src/app/debugger/remix-debugger/src/ui/CalldataPanel.js b/src/app/debugger/remix-debugger/src/ui/CalldataPanel.js index e2fef57b74..6207b078cb 100644 --- a/src/app/debugger/remix-debugger/src/ui/CalldataPanel.js +++ b/src/app/debugger/remix-debugger/src/ui/CalldataPanel.js @@ -2,8 +2,8 @@ var DropdownPanel = require('./DropdownPanel') var yo = require('yo-yo') -function CalldataPanel (_parent, _traceManager) { - this.parent = _parent +function CalldataPanel (_parentUI, _traceManager) { + this._parentUI = _parentUI this.traceManager = _traceManager this.basicPanel = new DropdownPanel('Call Data', {json: true}) this.init() @@ -15,15 +15,15 @@ CalldataPanel.prototype.render = function () { CalldataPanel.prototype.init = function () { var self = this - this.parent.event.register('indexChanged', this, function (index) { + this._parentUI.event.register('indexChanged', this, function (index) { if (index < 0) return - if (self.parent.currentStepIndex !== index) return + if (self._parentUI.currentStepIndex !== index) return self.traceManager.getCallDataAt(index, function (error, calldata) { if (error) { self.basicPanel.update({}) console.log(error) - } else if (self.parent.currentStepIndex === index) { + } else if (self._parentUI.currentStepIndex === index) { self.basicPanel.update(calldata) } }) diff --git a/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js b/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js index f6461b03f6..f4e448aee6 100644 --- a/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js +++ b/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js @@ -69,18 +69,7 @@ function EthdebuggerUI (opts) { this.txBrowser.event.register('unloadRequested', this, function (blockNumber, txIndex, tx) { self.unLoad() }) - this.stepManager = new StepManager(this, this.debugger.traceManager) - 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) { - self.event.trigger('sourceLocationChanged', [sourceLocation]) - } - }) - }) } EthdebuggerUI.prototype.setManagers = function () { @@ -186,11 +175,11 @@ EthdebuggerUI.prototype.debug = function (tx) { } EthdebuggerUI.prototype.render = function () { - var view = yo`
-
+ this.browserView = yo`
${this.txBrowser.render()} - ${this.stepManager.render()} -
+
` + var view = yo`
+ ${this.browserView}
${this.statusMessage}
` if (!this.view) { @@ -220,8 +209,6 @@ EthdebuggerUI.prototype.startDebugging = function (blockNumber, txIndex, tx) { return } - this.statusMessage = 'Loading trace...' - yo.update(this.view, this.render()) console.log('loading trace...') this.tx = tx //this.tx.hash = txIndex @@ -232,8 +219,21 @@ EthdebuggerUI.prototype.startDebugging = function (blockNumber, txIndex, tx) { //this.debugger.addProvider('web3', executionContext.web3()) //this.debugger.switchProvider('web3') - this.vmDebugger = new VmDebugger(this, this.debugger.traceManager, this.debugger.codeManager, this.debugger.solidityProxy, this.debugger.callTree) + this.stepManager = new StepManager(this, this.debugger.traceManager) + 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) { + self.event.trigger('sourceLocationChanged', [sourceLocation]) + } + }) + }) + + this.vmDebugger = new VmDebugger(this, this.debugger.traceManager, this.debugger.codeManager, this.debugger.solidityProxy, this.debugger.callTree) + this.browserView.appendChild(this.stepManager.render()) this.view.appendChild(this.vmDebugger.render()) this.debugger.debug(tx) diff --git a/src/app/debugger/remix-debugger/src/ui/SolidityState.js b/src/app/debugger/remix-debugger/src/ui/SolidityState.js index 282d553bee..2f9ec08d6c 100644 --- a/src/app/debugger/remix-debugger/src/ui/SolidityState.js +++ b/src/app/debugger/remix-debugger/src/ui/SolidityState.js @@ -3,8 +3,7 @@ var DropdownPanel = require('./DropdownPanel') var remixDebug = require('remix-debug') var stateDecoder = remixDebug.SolidityDecoder.stateDecoder var solidityTypeFormatter = require('./SolidityTypeFormatter') -var remixLib = require('remix-lib') -var StorageViewer = remixLib.Storage.StorageViewer +var StorageViewer = remixDebug.storage.StorageViewer var yo = require('yo-yo') function SolidityState (_parent, _traceManager, _codeManager, _solidityProxy) { diff --git a/src/app/debugger/remix-debugger/src/ui/StepDetail.js b/src/app/debugger/remix-debugger/src/ui/StepDetail.js index 7e19f0d941..a14b9e192d 100644 --- a/src/app/debugger/remix-debugger/src/ui/StepDetail.js +++ b/src/app/debugger/remix-debugger/src/ui/StepDetail.js @@ -2,8 +2,9 @@ var yo = require('yo-yo') var DropdownPanel = require('./DropdownPanel') -function StepDetail (_parent, _traceManager) { - this.parent = _parent +function StepDetail (_parentUI, _traceManager) { + this.debugger = _parentUI.debugger + this.parentUI = _parentUI this.traceManager = _traceManager this.basicPanel = new DropdownPanel('Step detail', {json: true, displayContentOnly: true}) @@ -19,17 +20,17 @@ StepDetail.prototype.render = function () { StepDetail.prototype.init = function () { var self = this - this.parent.event.register('traceUnloaded', this, function () { + this.debugger.event.register('traceUnloaded', this, function () { self.detail = initDetail() self.basicPanel.update(self.detail) }) - this.parent.event.register('newTraceLoaded', this, function () { + this.debugger.event.register('newTraceLoaded', this, function () { self.detail = initDetail() self.basicPanel.update(self.detail) }) - this.parent.event.register('indexChanged', this, function (index) { + this.parentUI.event.register('indexChanged', this, function (index) { if (index < 0) return self.detail['vm trace step'] = index diff --git a/src/app/debugger/remix-debugger/src/ui/StepManager.js b/src/app/debugger/remix-debugger/src/ui/StepManager.js index 9f65feade2..da2ec20b2a 100644 --- a/src/app/debugger/remix-debugger/src/ui/StepManager.js +++ b/src/app/debugger/remix-debugger/src/ui/StepManager.js @@ -80,12 +80,10 @@ StepManager.prototype.resolveToReducedTrace = function (value, incr) { } StepManager.prototype.render = function () { - return ( - yo`
+ return yo`
${this.slider.render()} ${this.buttonNavigator.render()}
` - ) } StepManager.prototype.reset = function () { diff --git a/src/app/debugger/remix-debugger/src/ui/StoragePanel.js b/src/app/debugger/remix-debugger/src/ui/StoragePanel.js index fca196aee6..3fdb8218c5 100644 --- a/src/app/debugger/remix-debugger/src/ui/StoragePanel.js +++ b/src/app/debugger/remix-debugger/src/ui/StoragePanel.js @@ -1,7 +1,7 @@ 'use strict' var DropdownPanel = require('./DropdownPanel') -var remixLib = require('remix-lib') -var StorageViewer = remixLib.Storage.StorageViewer +var remixDebug = require('remix-debug') +var StorageViewer = remixDebug.storage.StorageViewer var yo = require('yo-yo') function StoragePanel (_parent, _traceManager) { diff --git a/src/app/debugger/remix-debugger/src/ui/VmDebugger.js b/src/app/debugger/remix-debugger/src/ui/VmDebugger.js index 1e73e5ea92..9b7e233f1e 100644 --- a/src/app/debugger/remix-debugger/src/ui/VmDebugger.js +++ b/src/app/debugger/remix-debugger/src/ui/VmDebugger.js @@ -29,14 +29,14 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca let _parent = _parentUI.debugger this.asmCode = new CodeListView(_parent, _codeManager) - this.stackPanel = new StackPanel(_parent, _traceManager) - this.storagePanel = new StoragePanel(_parent, _traceManager) - this.memoryPanel = new MemoryPanel(_parent, _traceManager) - this.calldataPanel = new CalldataPanel(_parent, _traceManager) - this.callstackPanel = new CallstackPanel(_parent, _traceManager) - this.stepDetail = new StepDetail(_parent, _traceManager) - this.solidityState = new SolidityState(_parent, _traceManager, _codeManager, _solidityProxy) - this.solidityLocals = new SolidityLocals(_parent, _traceManager, _callTree) + this.stackPanel = new StackPanel(_parentUI, _traceManager) + this.storagePanel = new StoragePanel(_parentUI, _traceManager) + this.memoryPanel = new MemoryPanel(_parentUI, _traceManager) + this.calldataPanel = new CalldataPanel(_parentUI, _traceManager) + this.callstackPanel = new CallstackPanel(_parentUI, _traceManager) + this.stepDetail = new StepDetail(_parentUI, _traceManager) + this.solidityState = new SolidityState(_parentUI, _traceManager, _codeManager, _solidityProxy) + this.solidityLocals = new SolidityLocals(_parentUI, _traceManager, _callTree) /* Return values - */ this.returnValuesPanel = new DropdownPanel('Return Value', {json: true}) From 93a3e8a9d36b221513b75d4a76116aa33c8a0d8c Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 15 Aug 2018 09:27:23 -0400 Subject: [PATCH 12/34] make linter happy --- src/app/debugger/debugger.js | 3 - .../remix-debugger/src/ui/EthdebuggerUI.js | 55 +++++++++---------- .../remix-debugger/src/ui/TxBrowser.js | 4 +- 3 files changed, 27 insertions(+), 35 deletions(-) diff --git a/src/app/debugger/debugger.js b/src/app/debugger/debugger.js index ea1d0d9727..1420bc43bd 100644 --- a/src/app/debugger/debugger.js +++ b/src/app/debugger/debugger.js @@ -56,7 +56,6 @@ function Debugger (container, sourceHighlighter, localRegistry) { }) executionContext.event.register('contextChanged', this, function (context) { - debugger; self.switchProvider(context) }) @@ -113,7 +112,6 @@ Debugger.prototype.debug = function (txHash) { * @param {Object} obj - provider */ Debugger.prototype.addProvider = function (type, obj) { - debugger; this.debugger.addProvider(type, obj) } @@ -123,7 +121,6 @@ Debugger.prototype.addProvider = function (type, obj) { * @param {String} type - type/name of the provider to use */ Debugger.prototype.switchProvider = function (type) { - debugger; this.debugger.switchProvider(type) } diff --git a/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js b/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js index f4e448aee6..3e00d2d640 100644 --- a/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js +++ b/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js @@ -48,14 +48,13 @@ function EthdebuggerUI (opts) { self.debugger.codeManager.resolveStep(index, self.tx) }) - executionContext.event.register('contextChanged', this, function() { - console.dir("== contextChanged!!"); + executionContext.event.register('contextChanged', this, function () { self.updateWeb3Reference() - }); + }) - setTimeout(function() { + setTimeout(function () { self.updateWeb3Reference() - }, 10000); + }, 10000) this.txBrowser = new TxBrowser(this) this.txBrowser.event.register('newTxLoading', this, function () { @@ -124,24 +123,20 @@ EthdebuggerUI.prototype.addProvider = function (type, obj) { } EthdebuggerUI.prototype.updateWeb3Reference = function () { - debugger; if (!this.txBrowser) return this.txBrowser.web3 = this.debugger.web3 } EthdebuggerUI.prototype.switchProvider = function (type) { - debugger; var self = this this.web3Providers.get(type, function (error, obj) { - debugger; if (error) { console.log('provider ' + type + ' not defined') } else { self.web3 = obj - //self.setManagers() + // self.setManagers() self.updateWeb3Reference() executionContext.detectNetwork((error, network) => { - debugger; if (error || !network) { self.web3Debug = obj self.web3 = obj @@ -202,7 +197,7 @@ EthdebuggerUI.prototype.stepChanged = function (stepIndex) { } EthdebuggerUI.prototype.startDebugging = function (blockNumber, txIndex, tx) { - const self = this; + const self = this console.dir('startDebugging') console.dir(arguments) if (this.debugger.traceManager.isLoading) { @@ -211,13 +206,13 @@ EthdebuggerUI.prototype.startDebugging = function (blockNumber, txIndex, tx) { console.log('loading trace...') this.tx = tx - //this.tx.hash = txIndex + // this.tx.hash = txIndex // this.debugger.setCompilationResult(this.opts.compilationResult()) // this.setCompilationResult(this.opts.compilationResult()) - //this.debugger.addProvider('web3', executionContext.web3()) - //this.debugger.switchProvider('web3') + // this.debugger.addProvider('web3', executionContext.web3()) + // this.debugger.switchProvider('web3') this.stepManager = new StepManager(this, this.debugger.traceManager) this.stepManager.event.register('stepChanged', this, function (stepIndex) { @@ -238,8 +233,8 @@ EthdebuggerUI.prototype.startDebugging = function (blockNumber, txIndex, tx) { this.debugger.debug(tx) - //console.dir(this.vmDebugger.render()) - //console.dir(this.view) + // console.dir(this.vmDebugger.render()) + // console.dir(this.view) self.debugger.event.register('newTraceLoaded', function () { // self. @@ -247,20 +242,20 @@ EthdebuggerUI.prototype.startDebugging = function (blockNumber, txIndex, tx) { console.dir('resolving a trace with tx: ') console.dir(tx) - //this.debugger.traceManager.resolveTrace(tx, function (error, result) { - // console.log('trace loaded ' + result) - // if (result) { - // self.statusMessage = '' - // yo.update(self.view, self.render()) - // self.debugger.event.trigger('newTraceLoaded', [self.debugger.traceManager.trace]) - // // if (self.breakpointManager && self.breakpointManager.hasBreakpoint()) { - // // self.breakpointManager.jumpNextBreakpoint(0, false) - // // } - // } else { - // self.statusMessage = error ? error.message : 'Trace not loaded' - // yo.update(self.view, self.render()) - // } - //}) + // this.debugger.traceManager.resolveTrace(tx, function (error, result) { + // console.log('trace loaded ' + result) + // if (result) { + // self.statusMessage = '' + // yo.update(self.view, self.render()) + // self.debugger.event.trigger('newTraceLoaded', [self.debugger.traceManager.trace]) + // // if (self.breakpointManager && self.breakpointManager.hasBreakpoint()) { + // // self.breakpointManager.jumpNextBreakpoint(0, false) + // // } + // } else { + // self.statusMessage = error ? error.message : 'Trace not loaded' + // yo.update(self.view, self.render()) + // } + // }) } module.exports = EthdebuggerUI diff --git a/src/app/debugger/remix-debugger/src/ui/TxBrowser.js b/src/app/debugger/remix-debugger/src/ui/TxBrowser.js index f2ec323364..c587850e6b 100644 --- a/src/app/debugger/remix-debugger/src/ui/TxBrowser.js +++ b/src/app/debugger/remix-debugger/src/ui/TxBrowser.js @@ -81,11 +81,11 @@ TxBrowser.prototype.submit = function () { try { var self = this if (this.txNumber.indexOf('0x') !== -1) { - global.web3.eth.getTransaction(this.txNumber, function (error, result) { + self.web3.eth.getTransaction(this.txNumber, function (error, result) { self.update(error, result) }) } else { - global.web3.eth.getTransactionFromBlock(this.blockNumber, this.txNumber, function (error, result) { + self.web3.eth.getTransactionFromBlock(this.blockNumber, this.txNumber, function (error, result) { self.update(error, result) }) } From df3e3340dd205364aa40735c9e96f60f27b64649 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 17 Aug 2018 08:23:34 -0400 Subject: [PATCH 13/34] fix debug button --- src/app/debugger/debugger.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/debugger/debugger.js b/src/app/debugger/debugger.js index 1420bc43bd..e4db3cab5b 100644 --- a/src/app/debugger/debugger.js +++ b/src/app/debugger/debugger.js @@ -98,8 +98,10 @@ function Debugger (container, sourceHighlighter, localRegistry) { */ Debugger.prototype.debug = function (txHash) { var self = this + this.debugger.web3.eth.getTransaction(txHash, function (error, tx) { if (!error) { + self.debugger_ui.txBrowser.event.trigger('newTraceRequested', [undefined, undefined, tx]) self.debugger.debug(tx) } }) From 88af44035e1280a26732025653e00c8231ae4578 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 20 Aug 2018 16:02:16 +0200 Subject: [PATCH 14/34] fix loading trace --- src/app/debugger/debugger.js | 3 +-- .../debugger/remix-debugger/src/ui/TxBrowser.js | 14 +++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/app/debugger/debugger.js b/src/app/debugger/debugger.js index e4db3cab5b..f15ddeabc8 100644 --- a/src/app/debugger/debugger.js +++ b/src/app/debugger/debugger.js @@ -101,8 +101,7 @@ Debugger.prototype.debug = function (txHash) { this.debugger.web3.eth.getTransaction(txHash, function (error, tx) { if (!error) { - self.debugger_ui.txBrowser.event.trigger('newTraceRequested', [undefined, undefined, tx]) - self.debugger.debug(tx) + self.debugger_ui.debug(tx) } }) } diff --git a/src/app/debugger/remix-debugger/src/ui/TxBrowser.js b/src/app/debugger/remix-debugger/src/ui/TxBrowser.js index c587850e6b..58c315eaee 100644 --- a/src/app/debugger/remix-debugger/src/ui/TxBrowser.js +++ b/src/app/debugger/remix-debugger/src/ui/TxBrowser.js @@ -73,13 +73,17 @@ TxBrowser.prototype.setDefaultValues = function () { } } -TxBrowser.prototype.submit = function () { +TxBrowser.prototype.submit = function (tx) { + var self = this + self.event.trigger('newTxLoading', [this.blockNumber, this.txNumber]) + if (tx) { + return self.update(null, tx) + } if (!this.txNumber) { + self.update('no tx index or tx hash to look for') return } - this.event.trigger('newTxLoading', [this.blockNumber, this.txNumber]) try { - var self = this if (this.txNumber.indexOf('0x') !== -1) { self.web3.eth.getTransaction(this.txNumber, function (error, result) { self.update(error, result) @@ -150,9 +154,9 @@ TxBrowser.prototype.updateTxN = function (ev) { this.txNumber = ev.target.value } -TxBrowser.prototype.load = function (txHash) { +TxBrowser.prototype.load = function (txHash, tx) { this.txNumber = txHash - this.submit() + this.submit(tx) } TxBrowser.prototype.unload = function (txHash) { From d44857ae8ec9e4c9aa45eb31742712406e7458d0 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 20 Aug 2018 16:03:03 +0200 Subject: [PATCH 15/34] don't display provider url --- src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js | 2 +- src/app/debugger/remix-debugger/src/ui/TxBrowser.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js b/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js index 3e00d2d640..2d705774b7 100644 --- a/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js +++ b/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js @@ -56,7 +56,7 @@ function EthdebuggerUI (opts) { self.updateWeb3Reference() }, 10000) - this.txBrowser = new TxBrowser(this) + this.txBrowser = new TxBrowser(this, {displayConnectionSetting: false}) this.txBrowser.event.register('newTxLoading', this, function () { self.unLoad() }) diff --git a/src/app/debugger/remix-debugger/src/ui/TxBrowser.js b/src/app/debugger/remix-debugger/src/ui/TxBrowser.js index 58c315eaee..14f43101ce 100644 --- a/src/app/debugger/remix-debugger/src/ui/TxBrowser.js +++ b/src/app/debugger/remix-debugger/src/ui/TxBrowser.js @@ -42,17 +42,16 @@ var css = csjs` margin-bottom: 10px; } ` -function TxBrowser (_parent) { +function TxBrowser (_parent, opts) { this.event = new EventManager() this.blockNumber this.txNumber this.view - this.displayConnectionSetting = true + this.displayConnectionSetting = opts.displayConnectionSetting this.web3 = _parent.debugger.web3 var self = this _parent.event.register('providerChanged', this, function (provider) { - self.displayConnectionSetting = provider === 'INTERNAL' self.setDefaultValues() if (self.view) { yo.update(self.view, self.render()) From 74a8625f5fef71c135feefbf02f116f677a155e4 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 20 Aug 2018 16:04:27 +0200 Subject: [PATCH 16/34] remove reference when unloading --- .../remix-debugger/src/ui/ButtonNavigator.js | 1 + .../remix-debugger/src/ui/EthdebuggerUI.js | 13 ++++++------ .../remix-debugger/src/ui/StepManager.js | 10 +++++++++ .../remix-debugger/src/ui/VmDebugger.js | 21 ++++++++++++------- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/app/debugger/remix-debugger/src/ui/ButtonNavigator.js b/src/app/debugger/remix-debugger/src/ui/ButtonNavigator.js index 079faf635e..ef0aca9aef 100644 --- a/src/app/debugger/remix-debugger/src/ui/ButtonNavigator.js +++ b/src/app/debugger/remix-debugger/src/ui/ButtonNavigator.js @@ -51,6 +51,7 @@ function ButtonNavigator (_parent, _traceManager) { this.revertionPoint = null _parent.event.register('indexChanged', this, (index) => { + if (!this.view) return if (index < 0) return if (_parent.currentStepIndex !== index) return diff --git a/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js b/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js index 2d705774b7..edb50a72b7 100644 --- a/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js +++ b/src/app/debugger/remix-debugger/src/ui/EthdebuggerUI.js @@ -68,7 +68,6 @@ function EthdebuggerUI (opts) { this.txBrowser.event.register('unloadRequested', this, function (blockNumber, txIndex, tx) { self.unLoad() }) - } EthdebuggerUI.prototype.setManagers = function () { @@ -163,7 +162,7 @@ EthdebuggerUI.prototype.setCompilationResult = function (compilationResult) { EthdebuggerUI.prototype.debug = function (tx) { this.setCompilationResult(this.opts.compilationResult()) if (tx instanceof Object) { - this.txBrowser.load(tx.hash) + this.txBrowser.load(tx.hash, tx) } else if (tx instanceof String) { this.txBrowser.load(tx) } @@ -188,6 +187,12 @@ EthdebuggerUI.prototype.unLoad = function () { // this.debugger.codeManager.clear() // this.debugger.stepManager.reset() this.debugger.unLoad() + yo.update(this.debuggerPanelsView, yo`
`) + yo.update(this.stepManagerView, yo`
`) + if (this.vmDebugger) this.vmDebugger.remove() + if (this.stepManager) this.stepManager.remove() + this.vmDebugger = null + this.stepManager = null this.event.trigger('traceUnloaded') } @@ -236,10 +241,6 @@ EthdebuggerUI.prototype.startDebugging = function (blockNumber, txIndex, tx) { // console.dir(this.vmDebugger.render()) // console.dir(this.view) - self.debugger.event.register('newTraceLoaded', function () { - // self. - }) - console.dir('resolving a trace with tx: ') console.dir(tx) // this.debugger.traceManager.resolveTrace(tx, function (error, result) { diff --git a/src/app/debugger/remix-debugger/src/ui/StepManager.js b/src/app/debugger/remix-debugger/src/ui/StepManager.js index da2ec20b2a..86443c5284 100644 --- a/src/app/debugger/remix-debugger/src/ui/StepManager.js +++ b/src/app/debugger/remix-debugger/src/ui/StepManager.js @@ -15,6 +15,7 @@ function StepManager (_parent, _traceManager) { var self = this this.parent.event.register('newTraceLoaded', this, function () { + if (!this.slider) return self.traceManager.getLength(function (error, length) { if (error) { console.log(error) @@ -33,6 +34,7 @@ function StepManager (_parent, _traceManager) { }) this.parent.callTree.event.register('callTreeReady', () => { + if (!this.slider) return if (this.parent.callTree.functionCallStack.length) { this.jumpTo(this.parent.callTree.functionCallStack[0]) } @@ -65,6 +67,14 @@ function StepManager (_parent, _traceManager) { }) } +StepManager.prototype.remove = function () { + // used to stop listenning on event. bad and should be "refactored" + this.slider.view = null + this.slider = null + this.buttonNavigator.view = null + this.buttonNavigator = null +} + StepManager.prototype.resolveToReducedTrace = function (value, incr) { if (this.parent.callTree.reducedTrace.length) { var nextSource = util.findClosestIndex(value, this.parent.callTree.reducedTrace) diff --git a/src/app/debugger/remix-debugger/src/ui/VmDebugger.js b/src/app/debugger/remix-debugger/src/ui/VmDebugger.js index 9b7e233f1e..608e8ba746 100644 --- a/src/app/debugger/remix-debugger/src/ui/VmDebugger.js +++ b/src/app/debugger/remix-debugger/src/ui/VmDebugger.js @@ -27,7 +27,8 @@ var css = csjs` function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _callTree) { let _parent = _parentUI.debugger - + var self = this + this.view this.asmCode = new CodeListView(_parent, _codeManager) this.stackPanel = new StackPanel(_parentUI, _traceManager) this.storagePanel = new StoragePanel(_parentUI, _traceManager) @@ -42,12 +43,13 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca this.returnValuesPanel = new DropdownPanel('Return Value', {json: true}) this.returnValuesPanel.data = {} _parentUI.event.register('indexChanged', this.returnValuesPanel, function (index) { - var self = this + if (!self.view) return + var innerself = this _traceManager.getReturnValue(index, function (error, returnValue) { if (error) { - self.update([error]) + innerself.update([error]) } else if (_parentUI.currentStepIndex === index) { - self.update([returnValue]) + innerself.update([returnValue]) } }) }) @@ -55,9 +57,8 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca this.fullStoragesChangesPanel = new FullStoragesChangesPanel(_parentUI, _traceManager) - this.view - var self = this _parent.event.register('newTraceLoaded', this, function () { + if (!self.view) return var storageResolver = new StorageResolver({web3: _parent.web3}) self.storagePanel.storageResolver = storageResolver self.solidityState.storageResolver = storageResolver @@ -71,11 +72,12 @@ function VmDebugger (_parentUI, _traceManager, _codeManager, _solidityProxy, _ca self.view.style.display = 'none' }) _parent.callTree.event.register('callTreeReady', () => { - self.asmCode.basicPanel.show() + if (!self.view) return if (_parent.callTree.reducedTrace.length) { self.solidityLocals.basicPanel.show() self.solidityState.basicPanel.show() } + self.asmCode.basicPanel.show() self.stackPanel.basicPanel.show() self.storagePanel.basicPanel.show() self.memoryPanel.basicPanel.show() @@ -97,6 +99,11 @@ VmDebugger.prototype.renderHead = function () { return headView } +VmDebugger.prototype.remove = function () { + // used to stop listenning on event. bad and should be "refactored" + this.view = null +} + VmDebugger.prototype.render = function () { var view = yo`