Commit fe9a6076 authored by chriseth's avatar chriseth Committed by GitHub

Merge pull request #181 from ethereum/displaylocalvaronlyscope

Display local var only if in scope
parents c6b72a00 d12bf896
...@@ -10,10 +10,8 @@ function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory) { ...@@ -10,10 +10,8 @@ function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory) {
memory = formatMemory(memory) memory = formatMemory(memory)
for (var local in scope.locals) { for (var local in scope.locals) {
let variable = scope.locals[local] let variable = scope.locals[local]
if (variable.type.decodeFromStack) { if (variable.stackDepth < stack.length) {
locals[variable.name] = variable.type.decodeFromStack(variable.stackDepth, stack, memory) locals[variable.name] = variable.type.decodeFromStack(variable.stackDepth, stack, memory)
} else {
locals[variable.name] = ''
} }
} }
return locals return locals
......
...@@ -24,7 +24,8 @@ class DynamicByteArray extends RefType { ...@@ -24,7 +24,8 @@ class DynamicByteArray extends RefType {
} }
return { return {
value: '0x' + ret.replace(/(00)+$/, ''), value: '0x' + ret.replace(/(00)+$/, ''),
length: '0x' + length.toString(16) length: '0x' + length.toString(16),
type: this.typeName
} }
} else { } else {
var size = parseInt(value.substr(value.length - 2, 2), 16) / 2 var size = parseInt(value.substr(value.length - 2, 2), 16) / 2
......
...@@ -56,23 +56,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu ...@@ -56,23 +56,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
helper.decodeLocals(st, 7, traceManager, callTree, function (locals) { helper.decodeLocals(st, 7, traceManager, callTree, function (locals) {
try { try {
st.equals(locals['boolFalse'].value, false) st.equals(Object.keys(locals).length, 0)
st.equals(locals['boolTrue'].value, false)
st.equals(locals['testEnum'].value, 'one')
st.equals(locals['sender'].value, '0x0000000000000000000000000000000000000000')
st.equals(locals['_bytes1'].value, '0x')
st.equals(locals['__bytes1'].value, '0x')
st.equals(locals['__bytes2'].value, '0x')
st.equals(locals['__bytes4'].value, '0x')
st.equals(locals['__bytes6'].value, '0x')
st.equals(locals['__bytes7'].value, '0x')
st.equals(locals['__bytes8'].value, '0x')
st.equals(locals['__bytes9'].value, '0x')
st.equals(locals['__bytes13'].value, '0x')
st.equals(locals['__bytes16'].value, '0x')
st.equals(locals['__bytes24'].value, '0x')
st.equals(locals['__bytes32'].value, '0x')
st.equals(Object.keys(locals).length, 16)
} catch (e) { } catch (e) {
st.fail(e.message) st.fail(e.message)
} }
......
...@@ -42,7 +42,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu ...@@ -42,7 +42,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
helper.decodeLocals(st, 7, traceManager, callTree, function (locals) { helper.decodeLocals(st, 7, traceManager, callTree, function (locals) {
try { try {
st.equals(Object.keys(locals).length, 2) st.equals(Object.keys(locals).length, 0)
} catch (e) { } catch (e) {
st.fail(e.message) st.fail(e.message)
} }
......
...@@ -100,7 +100,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu ...@@ -100,7 +100,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
helper.decodeLocals(st, 7, traceManager, callTree, function (locals) { helper.decodeLocals(st, 7, traceManager, callTree, function (locals) {
try { try {
st.equals(Object.keys(locals).length, 8) st.equals(Object.keys(locals).length, 0)
} catch (e) { } catch (e) {
st.fail(e.message) st.fail(e.message)
} }
......
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