From da0c0c7ce35b6eaabddabbd6fc2a494003177ff0 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 14 Sep 2017 14:38:32 +0200 Subject: [PATCH] jump to the start of the fn call --- src/ui/StepManager.js | 3 +++ src/util/internalCallTree.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/ui/StepManager.js b/src/ui/StepManager.js index 39e3a47927..86ed76f69b 100644 --- a/src/ui/StepManager.js +++ b/src/ui/StepManager.js @@ -39,6 +39,9 @@ function StepManager (_parent, _traceManager) { this.parent.vmDebugger.asmCode.event.register('show', () => { this.solidityMode = false }) + if (this.parent.callTree.functionCallStack.length) { + this.jumpTo(this.parent.callTree.functionCallStack[0]) + } }) this.buttonNavigator = new ButtonNavigator(_parent, this.traceManager) diff --git a/src/util/internalCallTree.js b/src/util/internalCallTree.js index 0dfcfe4d5b..a34c8213b5 100644 --- a/src/util/internalCallTree.js +++ b/src/util/internalCallTree.js @@ -57,6 +57,7 @@ class InternalCallTree { /* scopeStart: represent start of a new scope. Keys are index in the vmtrace, values are scopeId */ + this.functionCallStack = [] this.scopeStarts = {} this.variableDeclarationByFile = {} this.functionDefinitionByFile = {} @@ -196,6 +197,7 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId, newLoc } var functionDefinition = resolveFunctionDefinition(tree, step, previousSourceLocation) if (functionDefinition && newLocation && traceHelper.isJumpDestInstruction(tree.traceManager.trace[step - 1])) { + tree.functionCallStack.push(step) // means: the previous location was a function definition && JUMPDEST // => we are at the beginning of the function and input/output are setup tree.solidityProxy.contractNameAt(step, (error, contractName) => { // cached