Changed debug hook and added state iterator
This commit is contained in:
parent
6e24d603a1
commit
aba3066658
|
@ -72,7 +72,7 @@ func (c *Closure) Address() []byte {
|
||||||
return c.object.Address()
|
return c.object.Address()
|
||||||
}
|
}
|
||||||
|
|
||||||
type DebugHook func(step int, op OpCode, mem *Memory, stack *Stack)
|
type DebugHook func(step int, op OpCode, mem *Memory, stack *Stack, stateObject *StateObject)
|
||||||
|
|
||||||
func (c *Closure) Call(vm *Vm, args []byte, hook DebugHook) ([]byte, error) {
|
func (c *Closure) Call(vm *Vm, args []byte, hook DebugHook) ([]byte, error) {
|
||||||
c.Args = args
|
c.Args = args
|
||||||
|
|
|
@ -49,6 +49,11 @@ func (s *State) Purge() int {
|
||||||
return s.trie.NewIterator().Purge()
|
return s.trie.NewIterator().Purge()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *State) EachStorage(cb ethutil.EachCallback) {
|
||||||
|
it := s.trie.NewIterator()
|
||||||
|
it.Each(cb)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *State) GetStateObject(addr []byte) *StateObject {
|
func (s *State) GetStateObject(addr []byte) *StateObject {
|
||||||
data := s.trie.Get(string(addr))
|
data := s.trie.Get(string(addr))
|
||||||
if data == "" {
|
if data == "" {
|
||||||
|
|
|
@ -543,7 +543,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
|
||||||
pc.Add(pc, ethutil.Big1)
|
pc.Add(pc, ethutil.Big1)
|
||||||
|
|
||||||
if hook != nil {
|
if hook != nil {
|
||||||
hook(step-1, op, mem, stack)
|
hook(step-1, op, mem, stack, closure.Object())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue