diff --git a/gnovm/pkg/gnolang/debugger.go b/gnovm/pkg/gnolang/debugger.go index 2a080da47a3..f9e93974937 100644 --- a/gnovm/pkg/gnolang/debugger.go +++ b/gnovm/pkg/gnolang/debugger.go @@ -146,6 +146,7 @@ loop: os.Exit(0) } } + m.Debugger.prevLoc = m.Debugger.loc debugUpdateLocation(m) // Keep track of exact locations when performing calls. diff --git a/gnovm/pkg/gnolang/debugger_test.go b/gnovm/pkg/gnolang/debugger_test.go index 95146bd48f6..ad78cb143ee 100644 --- a/gnovm/pkg/gnolang/debugger_test.go +++ b/gnovm/pkg/gnolang/debugger_test.go @@ -99,7 +99,7 @@ func TestDebug(t *testing.T) { {in: "help b\n", out: "Set a breakpoint."}, {in: "help zzz\n", out: "command not available"}, {in: "list " + debugTarget + ":1\n", out: "1: // This is a sample target"}, - {in: "l 55\n", out: "42: }"}, + {in: "l 55\n", out: "46: }"}, {in: "l xxx:0\n", out: "xxx: no such file or directory"}, {in: "l :xxx\n", out: `"xxx": invalid syntax`}, {in: brk, out: "Breakpoint 0 at main "}, @@ -147,6 +147,7 @@ func TestDebug(t *testing.T) { {in: "b 37\nc\np b\n", out: "(3 int)"}, {in: "b 27\nc\np b\n", out: `("!zero" string)`}, {in: "b 22\nc\np t.A[3]\n", out: "Command failed: slice index out of bounds: 3 (len=3)"}, + {in: "b 43\nc\nc\np i\nd\n", out: "(1 int)"}, }) runDebugTest(t, "../../tests/files/a1.gno", []dtest{ diff --git a/gnovm/tests/integ/debugger/sample.gno b/gnovm/tests/integ/debugger/sample.gno index ecd980acf05..354b00b547e 100644 --- a/gnovm/tests/integ/debugger/sample.gno +++ b/gnovm/tests/integ/debugger/sample.gno @@ -38,5 +38,9 @@ func main() { } t := T{A: []int{1, 2, 3} } println(t.get(1)) - println("bye") + x := 0 + for i := 0; i < 5; i++ { + x = i + } + println("bye", x) }