diff --git a/remix-debug/src/solidity-decoder/internalCallTree.js b/remix-debug/src/solidity-decoder/internalCallTree.js index 854813e80f..d8c59a86f1 100644 --- a/remix-debug/src/solidity-decoder/internalCallTree.js +++ b/remix-debug/src/solidity-decoder/internalCallTree.js @@ -29,6 +29,7 @@ class InternalCallTree { this.solidityProxy = solidityProxy this.traceManager = traceManager this.sourceLocationTracker = new SourceLocationTracker(codeManager) + this.internalFunctionCalls = [] debuggerEvent.register('newTraceLoaded', (trace) => { this.reset() if (!this.solidityProxy.loaded()) { @@ -157,6 +158,9 @@ async function buildTree (tree, step, scopeId, isExternalCall) { // we are checking if we are jumping in a new CALL or in an internal function if (isCallInstruction || sourceLocation.jump === 'i') { try { + if (sourceLocation.jump === 'i') { + this.internalFunctionCalls.push(step) + } var externalCallResult = await buildTree(tree, step + 1, scopeId === '' ? subScope.toString() : scopeId + '.' + subScope, isCallInstruction) if (externalCallResult.error) { return { outStep: step, error: 'InternalCallTree - ' + externalCallResult.error } diff --git a/remix-lib/src/trace/traceManager.js b/remix-lib/src/trace/traceManager.js index c0c6d31379..e4af6d2945 100644 --- a/remix-lib/src/trace/traceManager.js +++ b/remix-lib/src/trace/traceManager.js @@ -14,7 +14,7 @@ function TraceManager (options) { this.traceCache = new TraceCache() this.traceAnalyser = new TraceAnalyser(this.traceCache) this.traceRetriever = new TraceRetriever({web3: this.web3}) - this.traceStepManager = new TraceStepManager(this.traceAnalyser) + this.traceStepManager = new TraceStepManager(this.traceAnalyser, {web3: this.web3}) this.tx } diff --git a/remix-lib/src/trace/traceStepManager.js b/remix-lib/src/trace/traceStepManager.js index e402224ec5..9a3c8a5b3d 100644 --- a/remix-lib/src/trace/traceStepManager.js +++ b/remix-lib/src/trace/traceStepManager.js @@ -1,10 +1,12 @@ 'use strict' var traceHelper = require('../helpers/traceHelper') +var Debugger = require('../../../remix-debug').EthDebugger var util = require('../util') -function TraceStepManager (_traceAnalyser) { +function TraceStepManager (_traceAnalyser, opts) { this.traceAnalyser = _traceAnalyser + this.debugger = new Debugger({web3: opts.web3}) } TraceStepManager.prototype.isCallInstruction = function (index) { @@ -27,7 +29,7 @@ TraceStepManager.prototype.findStepOverBack = function (currentStep) { } TraceStepManager.prototype.findStepOverForward = function (currentStep) { - if (this.isCallInstruction(currentStep)) { + if (this.isCallInstruction(currentStep) || this.debugger.callTree.internalFunctionCalls.includes(currentStep)) { var call = util.findCall(currentStep + 1, this.traceAnalyser.traceCache.callsTree.call) return call.return + 1 < this.traceAnalyser.trace.length ? call.return + 1 : this.traceAnalyser.trace.length - 1 } else {