debugger ans solidityLocals updated

pull/697/head
aniket-engg 4 years ago committed by Aniket
parent f57be84d46
commit d077a047fe
  1. 35
      libs/remix-debug/src/debugger/debugger.ts
  2. 16
      libs/remix-debug/src/debugger/solidityLocals.ts

@ -7,7 +7,17 @@ const BreakpointManager = require('../code/breakpointManager')
const StepManager = require('./stepManager') const StepManager = require('./stepManager')
const VmDebuggerLogic = require('./VmDebugger') const VmDebuggerLogic = require('./VmDebugger')
function Debugger (options) { export class Debugger {
event
offsetToLineColumnConverter
compilationResult
debugger
breakPointManager
step_manager
vmDebuggerLogic
constructor (options) {
this.event = new EventManager() this.event = new EventManager()
this.offsetToLineColumnConverter = options.offsetToLineColumnConverter this.offsetToLineColumnConverter = options.offsetToLineColumnConverter
@ -47,9 +57,9 @@ function Debugger (options) {
this.debugger.event.register('traceUnloaded', this, () => { this.debugger.event.register('traceUnloaded', this, () => {
this.event.trigger('debuggerStatus', [false]) this.event.trigger('debuggerStatus', [false])
}) })
} }
Debugger.prototype.registerAndHighlightCodeItem = async function (index) { async registerAndHighlightCodeItem (index) {
// register selected code item, highlight the corresponding source location // register selected code item, highlight the corresponding source location
// this.debugger.traceManager.getCurrentCalledAddressAt(index, async (error, address) => { // this.debugger.traceManager.getCurrentCalledAddressAt(index, async (error, address) => {
@ -81,13 +91,13 @@ Debugger.prototype.registerAndHighlightCodeItem = async function (index) {
} catch (error) { } catch (error) {
return console.log(error) return console.log(error)
} }
} }
Debugger.prototype.updateWeb3 = function (web3) { updateWeb3 (web3) {
this.debugger.web3 = web3 this.debugger.web3 = web3
} }
Debugger.prototype.debug = function (blockNumber, txNumber, tx, loadingCb) { debug (blockNumber, txNumber, tx, loadingCb) {
const web3 = this.debugger.web3 const web3 = this.debugger.web3
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -122,9 +132,9 @@ Debugger.prototype.debug = function (blockNumber, txNumber, tx, loadingCb) {
return reject(e.message) return reject(e.message)
} }
}) })
} }
Debugger.prototype.debugTx = function (tx, loadingCb) { debugTx (tx, loadingCb) {
this.step_manager = new StepManager(this.debugger, this.debugger.traceManager) this.step_manager = new StepManager(this.debugger, this.debugger.traceManager)
this.debugger.codeManager.event.register('changed', this, (code, address, instIndex) => { this.debugger.codeManager.event.register('changed', this, (code, address, instIndex) => {
@ -150,11 +160,10 @@ Debugger.prototype.debugTx = function (tx, loadingCb) {
loadingCb() loadingCb()
this.debugger.debug(tx) this.debugger.debug(tx)
} }
Debugger.prototype.unload = function () { unload () {
this.debugger.unLoad() this.debugger.unLoad()
this.event.trigger('debuggerUnloaded') this.event.trigger('debuggerUnloaded')
}
} }
module.exports = Debugger

@ -1,9 +1,17 @@
const EventManager = require('../eventManager') const EventManager = require('../eventManager')
const localDecoder = require('../solidity-decoder/localDecoder') const localDecoder = require('../solidity-decoder/localDecoder')
const StorageViewer = require('../storage/storageViewer') const StorageViewer = require('../storage/storageViewer')
class DebuggerSolidityLocals { export class DebuggerSolidityLocals {
event
stepManager
internalTreeCall
storageResolver
traceManager
tx
_sourceLocation
constructor (tx, _stepManager, _traceManager, _internalTreeCall) { constructor (tx, _stepManager, _traceManager, _internalTreeCall) {
this.event = new EventManager() this.event = new EventManager()
this.stepManager = _stepManager this.stepManager = _stepManager
@ -28,7 +36,7 @@ class DebuggerSolidityLocals {
}, 500) }, 500)
} }
decode (sourceLocation, cursor) { decode (sourceLocation, cursor?) {
const self = this const self = this
this.event.trigger('solidityLocalsMessage', ['']) this.event.trigger('solidityLocalsMessage', [''])
this.traceManager.waterfall([ this.traceManager.waterfall([
@ -94,5 +102,3 @@ class DebuggerSolidityLocals {
}, 500) }, 500)
} }
} }
module.exports = DebuggerSolidityLocals

Loading…
Cancel
Save