|
|
@ -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 |
|
|
|
|
|
|
|