Commit 3101764e authored by Iuri Matias's avatar Iuri Matias

fix fixes for remix-debug integration

parent de30c58c
...@@ -36,7 +36,8 @@ function Ethdebugger (opts) { ...@@ -36,7 +36,8 @@ function Ethdebugger (opts) {
this.opts = opts || {} this.opts = opts || {}
if (!this.opts.compilationResult) this.opts.compilationResult = () => { return null } if (!this.opts.compilationResult) this.opts.compilationResult = () => { return null }
this.web3 = opts.web3 this.executionContext = opts.executionContext || executionContext;
this.web3 = opts.web3 || this.executionContext.web3;
this.event = new EventManager() this.event = new EventManager()
...@@ -55,6 +56,7 @@ function Ethdebugger (opts) { ...@@ -55,6 +56,7 @@ function Ethdebugger (opts) {
} }
Ethdebugger.prototype.setManagers = function () { Ethdebugger.prototype.setManagers = function () {
console.log("remix-debug: setManagers");
this.traceManager = new TraceManager({web3: this.web3}) this.traceManager = new TraceManager({web3: this.web3})
this.codeManager = new CodeManager(this.traceManager) this.codeManager = new CodeManager(this.traceManager)
this.solidityProxy = new SolidityProxy(this.traceManager, this.codeManager) this.solidityProxy = new SolidityProxy(this.traceManager, this.codeManager)
...@@ -181,7 +183,7 @@ Ethdebugger.prototype.switchProvider = function (type) { ...@@ -181,7 +183,7 @@ Ethdebugger.prototype.switchProvider = function (type) {
self.web3 = obj self.web3 = obj
self.setManagers() self.setManagers()
// self.traceManager.web3 = self.web3 // self.traceManager.web3 = self.web3
executionContext.detectNetwork((error, network) => { self.executionContext.detectNetwork((error, network) => {
if (error || !network) { if (error || !network) {
self.web3Debug = obj self.web3Debug = obj
self.web3 = obj self.web3 = obj
...@@ -198,6 +200,7 @@ Ethdebugger.prototype.switchProvider = function (type) { ...@@ -198,6 +200,7 @@ Ethdebugger.prototype.switchProvider = function (type) {
} }
Ethdebugger.prototype.debug = function (tx) { Ethdebugger.prototype.debug = function (tx) {
debugger;
this.setCompilationResult(this.opts.compilationResult()) this.setCompilationResult(this.opts.compilationResult())
if (tx instanceof Object) { if (tx instanceof Object) {
this.txBrowser.load(tx.hash) this.txBrowser.load(tx.hash)
...@@ -209,7 +212,6 @@ Ethdebugger.prototype.debug = function (tx) { ...@@ -209,7 +212,6 @@ Ethdebugger.prototype.debug = function (tx) {
Ethdebugger.prototype.unLoad = function () { Ethdebugger.prototype.unLoad = function () {
this.traceManager.init() this.traceManager.init()
this.codeManager.clear() this.codeManager.clear()
this.stepManager.reset()
this.event.trigger('traceUnloaded') this.event.trigger('traceUnloaded')
} }
...@@ -224,8 +226,10 @@ Ethdebugger.prototype.debug = function (tx) { ...@@ -224,8 +226,10 @@ Ethdebugger.prototype.debug = function (tx) {
console.log('loading trace...') console.log('loading trace...')
this.tx = tx this.tx = tx
var self = this var self = this
debugger;
this.traceManager.resolveTrace(tx, function (error, result) { this.traceManager.resolveTrace(tx, function (error, result) {
console.log('trace loaded ' + result) console.log('trace loaded ' + result)
console.dir(arguments);
if (result) { if (result) {
self.event.trigger('newTraceLoaded', [self.traceManager.trace]) self.event.trigger('newTraceLoaded', [self.traceManager.trace])
if (self.breakpointManager && self.breakpointManager.hasBreakpoint()) { if (self.breakpointManager && self.breakpointManager.hasBreakpoint()) {
......
...@@ -20,6 +20,8 @@ function TraceManager (options) { ...@@ -20,6 +20,8 @@ function TraceManager (options) {
// init section // init section
TraceManager.prototype.resolveTrace = function (tx, callback) { TraceManager.prototype.resolveTrace = function (tx, callback) {
console.dir("resolveTrace: ");
console.dir(arguments);
this.tx = tx this.tx = tx
this.init() this.init()
if (!this.web3) callback('web3 not loaded', false) if (!this.web3) callback('web3 not loaded', false)
...@@ -68,6 +70,8 @@ TraceManager.prototype.isLoaded = function () { ...@@ -68,6 +70,8 @@ TraceManager.prototype.isLoaded = function () {
} }
TraceManager.prototype.getLength = function (callback) { TraceManager.prototype.getLength = function (callback) {
console.dir(this.trace)
console.trace('getLength')
if (!this.trace) { if (!this.trace) {
callback('no trace available', null) callback('no trace available', null)
} else { } else {
......
...@@ -5,6 +5,8 @@ function TraceRetriever (options) { ...@@ -5,6 +5,8 @@ function TraceRetriever (options) {
} }
TraceRetriever.prototype.getTrace = function (txHash, callback) { TraceRetriever.prototype.getTrace = function (txHash, callback) {
console.dir("getTrace: ");
console.dir(arguments);
var options = { var options = {
disableStorage: true, disableStorage: true,
disableMemory: false, disableMemory: false,
......
...@@ -198,6 +198,9 @@ web3VmProvider.prototype.getCode = function (address, cb) { ...@@ -198,6 +198,9 @@ web3VmProvider.prototype.getCode = function (address, cb) {
web3VmProvider.prototype.setProvider = function (provider) {} web3VmProvider.prototype.setProvider = function (provider) {}
web3VmProvider.prototype.traceTransaction = function (txHash, options, cb) { web3VmProvider.prototype.traceTransaction = function (txHash, options, cb) {
console.dir("traceTransaction: ");
console.dir(arguments);
console.trace("here");
if (this.vmTraces[txHash]) { if (this.vmTraces[txHash]) {
if (cb) { if (cb) {
cb(null, this.vmTraces[txHash]) cb(null, this.vmTraces[txHash])
......
...@@ -55,6 +55,7 @@ function Compiler (handleImportCall) { ...@@ -55,6 +55,7 @@ function Compiler (handleImportCall) {
} }
var compile = function (files, target) { var compile = function (files, target) {
console.dir("compile");
self.event.trigger('compilationStarted', []) self.event.trigger('compilationStarted', [])
internalCompile(files, target) internalCompile(files, target)
} }
...@@ -210,6 +211,8 @@ function Compiler (handleImportCall) { ...@@ -210,6 +211,8 @@ function Compiler (handleImportCall) {
self.event.trigger('compilationFinished', [false, data, source]) self.event.trigger('compilationFinished', [false, data, source])
} else if (missingInputs !== undefined && missingInputs.length > 0) { } else if (missingInputs !== undefined && missingInputs.length > 0) {
// try compiling again with the new set of inputs // try compiling again with the new set of inputs
console.dir("compilationFinshed");
internalCompile(source.sources, source.target, missingInputs) internalCompile(source.sources, source.target, missingInputs)
} else { } else {
data = updateInterface(data) data = updateInterface(data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment