Commit 2ab6293f authored by aniket-engg's avatar aniket-engg

internal function call handling

parent 8fb07e0b
......@@ -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
}
......
'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 {
......
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