Commit 4eb1771e authored by obscuren's avatar obscuren

Hooks can now quit the vm

parent aba30666
...@@ -72,7 +72,7 @@ func (c *Closure) Address() []byte { ...@@ -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, stateObject *StateObject) type DebugHook func(step int, op OpCode, mem *Memory, stack *Stack, stateObject *StateObject) bool
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
......
...@@ -543,7 +543,9 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro ...@@ -543,7 +543,9 @@ 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, closure.Object()) if !hook(step-1, op, mem, stack, closure.Object()) {
return nil, nil
}
} }
} }
} }
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