fix debugger

pull/1/head
yann300 6 years ago
parent 4f386daae0
commit 211ed05d72
  1. 38
      src/app/debugger/debuggerUI.js

@ -90,19 +90,10 @@ class DebuggerUI {
this.contextManager = new ContextManager() this.contextManager = new ContextManager()
// TODO debugging with source highlight is disabled. see line 98
this.debugger = new Debugger({
web3: this.contextManager.getWeb3(),
offsetToLineColumnConverter: this.registry.get('offsettolinecolumnconverter').api,
compiler: {
lastCompilationResult: null
}
})
this.contextManager.initProviders() this.contextManager.initProviders()
this.contextManager.event.register('providerChanged', () => { this.contextManager.event.register('providerChanged', () => {
this.debugger.updateWeb3(this.contextManager.getWeb3()) if (this.debugger) this.debugger.updateWeb3(this.contextManager.getWeb3())
}) })
this.isActive = false this.isActive = false
@ -119,7 +110,6 @@ class DebuggerUI {
container.appendChild(this.render()) container.appendChild(this.render())
this.setEditor() this.setEditor()
this.listenToEvents()
} }
setEditor () { setEditor () {
@ -127,20 +117,22 @@ class DebuggerUI {
this.editor = this.registry.get('editor').api this.editor = this.registry.get('editor').api
self.editor.event.register('breakpointCleared', (fileName, row) => { self.editor.event.register('breakpointCleared', (fileName, row) => {
self.debugger.breakPointManager.remove({fileName: fileName, row: row}) if (self.debugger) self.debugger.breakPointManager.remove({fileName: fileName, row: row})
}) })
self.editor.event.register('breakpointAdded', (fileName, row) => { self.editor.event.register('breakpointAdded', (fileName, row) => {
self.debugger.breakPointManager.add({fileName: fileName, row: row}) if (self.debugger) self.debugger.breakPointManager.add({fileName: fileName, row: row})
}) })
self.editor.event.register('contentChanged', function () { self.editor.event.register('contentChanged', function () {
self.debugger.unload() if (self.debugger) self.debugger.unload()
}) })
} }
listenToEvents () { listenToEvents () {
const self = this const self = this
if (!self.debugger) return
this.debugger.event.register('debuggerStatus', function (isActive) { this.debugger.event.register('debuggerStatus', function (isActive) {
self.sourceHighlighter.currentSourceLocation(null) self.sourceHighlighter.currentSourceLocation(null)
self.isActive = isActive self.isActive = isActive
@ -159,12 +151,12 @@ class DebuggerUI {
this.txBrowser = txBrowser this.txBrowser = txBrowser
txBrowser.event.register('requestDebug', function (blockNumber, txNumber, tx) { txBrowser.event.register('requestDebug', function (blockNumber, txNumber, tx) {
self.debugger.unload() if (self.debugger) self.debugger.unload()
self.startDebugging(blockNumber, txNumber, tx) self.startDebugging(blockNumber, txNumber, tx)
}) })
txBrowser.event.register('unloadRequested', this, function (blockNumber, txIndex, tx) { txBrowser.event.register('unloadRequested', this, function (blockNumber, txIndex, tx) {
self.debugger.unload() if (self.debugger) self.debugger.unload()
}) })
} }
@ -174,6 +166,20 @@ class DebuggerUI {
startDebugging (blockNumber, txNumber, tx) { startDebugging (blockNumber, txNumber, tx) {
const self = this const self = this
if (this.debugger) delete this.debugger
let compilers = this.registry.get('compilersartefacts').api
let lastCompilationResult
if (compilers['__last']) lastCompilationResult = compilers['__last']
// TODO debugging with source highlight is disabled. see line 98
this.debugger = new Debugger({
web3: this.contextManager.getWeb3(),
offsetToLineColumnConverter: this.registry.get('offsettolinecolumnconverter').api,
compiler: { lastCompilationResult }
})
this.listenToEvents()
this.debugger.debugger.updateWeb3(this.executionContext.web3()) this.debugger.debugger.updateWeb3(this.executionContext.web3())
this.debugger.debug(blockNumber, txNumber, tx, () => { this.debugger.debug(blockNumber, txNumber, tx, () => {

Loading…
Cancel
Save