internal function call handling

pull/7/head
aniket-engg 5 years ago
parent 8fb07e0b55
commit 2ab6293f57
  1. 4
      remix-debug/src/solidity-decoder/internalCallTree.js
  2. 2
      remix-lib/src/trace/traceManager.js
  3. 6
      remix-lib/src/trace/traceStepManager.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 }

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

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

Loading…
Cancel
Save