mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-04 19:19:44 +00:00
vm/cli: fix step command
It was setting a (wrong) breakpoint and couldn't then break out of it.
This commit is contained in:
parent
318ca55982
commit
328c6d7ce5
1 changed files with 17 additions and 2 deletions
|
@ -321,7 +321,13 @@ func runVMWithHandling(c *ishell.Context, v *vm.VM) {
|
|||
c.Err(err)
|
||||
return
|
||||
}
|
||||
checkAndPrintVMState(c, v)
|
||||
}
|
||||
|
||||
// checkAndPrintVMState checks VM state and outputs it to the user if it's
|
||||
// failed, halted or at breakpoint. No message is printed if VM is running
|
||||
// normally.
|
||||
func checkAndPrintVMState(c *ishell.Context, v *vm.VM) {
|
||||
var message string
|
||||
switch {
|
||||
case v.HasFailed():
|
||||
|
@ -364,8 +370,17 @@ func handleStep(c *ishell.Context) {
|
|||
return
|
||||
}
|
||||
}
|
||||
v.AddBreakPointRel(n)
|
||||
runVMWithHandling(c, v)
|
||||
for i := 0; i < n; i++ {
|
||||
err := v.Step()
|
||||
if err != nil {
|
||||
c.Err(err)
|
||||
return
|
||||
}
|
||||
checkAndPrintVMState(c, v)
|
||||
}
|
||||
ctx := v.Context()
|
||||
i, op := ctx.CurrInstr()
|
||||
c.Printf("at %d (%s)\n", i, op.String())
|
||||
changePrompt(c, v)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue