Commit 06574702 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #570 from ethereum/improveDebuggerStart

Improve debugger start
parents 89a70efb da0c0c7c
...@@ -39,6 +39,9 @@ function StepManager (_parent, _traceManager) { ...@@ -39,6 +39,9 @@ function StepManager (_parent, _traceManager) {
this.parent.vmDebugger.asmCode.event.register('show', () => { this.parent.vmDebugger.asmCode.event.register('show', () => {
this.solidityMode = false this.solidityMode = false
}) })
if (this.parent.callTree.functionCallStack.length) {
this.jumpTo(this.parent.callTree.functionCallStack[0])
}
}) })
this.buttonNavigator = new ButtonNavigator(_parent, this.traceManager) this.buttonNavigator = new ButtonNavigator(_parent, this.traceManager)
......
...@@ -54,6 +54,14 @@ function VmDebugger (_parent, _traceManager, _codeManager, _solidityProxy, _call ...@@ -54,6 +54,14 @@ function VmDebugger (_parent, _traceManager, _codeManager, _solidityProxy, _call
_parent.event.register('traceUnloaded', this, function () { _parent.event.register('traceUnloaded', this, function () {
self.view.style.display = 'none' self.view.style.display = 'none'
}) })
_parent.callTree.event.register('callTreeReady', () => {
if (_parent.callTree.reducedTrace.length) {
self.solidityLocals.basicPanel.show()
self.solidityState.basicPanel.show()
} else {
self.asmCode.basicPanel.show()
}
})
} }
VmDebugger.prototype.render = function () { VmDebugger.prototype.render = function () {
......
...@@ -57,6 +57,7 @@ class InternalCallTree { ...@@ -57,6 +57,7 @@ class InternalCallTree {
/* /*
scopeStart: represent start of a new scope. Keys are index in the vmtrace, values are scopeId scopeStart: represent start of a new scope. Keys are index in the vmtrace, values are scopeId
*/ */
this.functionCallStack = []
this.scopeStarts = {} this.scopeStarts = {}
this.variableDeclarationByFile = {} this.variableDeclarationByFile = {}
this.functionDefinitionByFile = {} this.functionDefinitionByFile = {}
...@@ -196,6 +197,7 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId, newLoc ...@@ -196,6 +197,7 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId, newLoc
} }
var functionDefinition = resolveFunctionDefinition(tree, step, previousSourceLocation) var functionDefinition = resolveFunctionDefinition(tree, step, previousSourceLocation)
if (functionDefinition && newLocation && traceHelper.isJumpDestInstruction(tree.traceManager.trace[step - 1])) { if (functionDefinition && newLocation && traceHelper.isJumpDestInstruction(tree.traceManager.trace[step - 1])) {
tree.functionCallStack.push(step)
// means: the previous location was a function definition && JUMPDEST // means: the previous location was a function definition && JUMPDEST
// => we are at the beginning of the function and input/output are setup // => we are at the beginning of the function and input/output are setup
tree.solidityProxy.contractNameAt(step, (error, contractName) => { // cached tree.solidityProxy.contractNameAt(step, (error, contractName) => { // cached
......
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