Merge pull request #1190 from ethereum/debugerFix

Various Fix on Debugger
pull/7/head
yann300 6 years ago committed by GitHub
commit 1af0591b7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      remix-debug/src/debugger/VmDebugger.js
  2. 53
      remix-debug/src/debugger/debugger.js

@ -196,7 +196,7 @@ class VmDebuggerLogic {
self.event.trigger('newTrace', [])
})
self.debugger.event.register('callTreeReady', function () {
self.debugger.callTree.event.register('callTreeReady', function () {
if (self.debugger.callTree.reducedTrace.length) {
return self.event.trigger('newCallTree', [])
}

@ -69,34 +69,41 @@ Debugger.prototype.updateWeb3 = function (web3) {
}
Debugger.prototype.debug = function (blockNumber, txNumber, tx, loadingCb) {
const self = this
let web3 = this.debugger.web3
if (this.debugger.traceManager.isLoading) {
return
}
return new Promise((resolve, reject) => {
if (this.debugger.traceManager.isLoading) {
return resolve()
}
if (tx) {
if (!tx.to) {
tx.to = traceHelper.contractCreationToken('0')
if (tx) {
if (!tx.to) {
tx.to = traceHelper.contractCreationToken('0')
}
this.debugTx(tx, loadingCb)
return resolve()
}
return self.debugTx(tx, loadingCb)
}
try {
if (txNumber.indexOf('0x') !== -1) {
return web3.eth.getTransaction(txNumber, function (_error, result) {
let tx = result
self.debugTx(tx, loadingCb)
try {
if (txNumber.indexOf('0x') !== -1) {
return web3.eth.getTransaction(txNumber, (_error, tx) => {
if (_error) return reject(_error)
if (!tx) return reject('cannot find transaction ' + txNumber)
this.debugTx(tx, loadingCb)
return resolve()
})
}
web3.eth.getTransactionFromBlock(blockNumber, txNumber, (_error, tx) => {
if (_error) return reject(_error)
if (!tx) return reject('cannot find transaction ' + blockNumber + ' ' + txNumber)
this.debugTx(tx, loadingCb)
return resolve()
})
} catch (e) {
console.error(e.message)
return reject(e.message)
}
web3.eth.getTransactionFromBlock(blockNumber, txNumber, function (_error, result) {
let tx = result
self.debugTx(tx, loadingCb)
})
} catch (e) {
console.error(e.message)
}
})
}
Debugger.prototype.debugTx = function (tx, loadingCb) {
@ -115,7 +122,7 @@ Debugger.prototype.debugTx = function (tx, loadingCb) {
this.vmDebuggerLogic.start()
this.step_manager.event.register('stepChanged', this, function (stepIndex) {
if (!stepIndex) {
if (typeof stepIndex !== 'number' || stepIndex >= self.step_manager.traceLength) {
return self.event.trigger('endDebug')
}

Loading…
Cancel
Save