diff --git a/_fixtures/issue1374.go b/_fixtures/issue1374.go new file mode 100644 index 00000000..ba4501ad --- /dev/null +++ b/_fixtures/issue1374.go @@ -0,0 +1,12 @@ +package main + +import "fmt" + +func main() { + i := getNum() + fmt.Println(i) +} + +func getNum() int { + return 0 +} diff --git a/pkg/proc/proc.go b/pkg/proc/proc.go index d633e853..7d2abfbd 100644 --- a/pkg/proc/proc.go +++ b/pkg/proc/proc.go @@ -281,7 +281,7 @@ func stepInstructionOut(dbp Process, curthread Thread, fnname1, fnname2 string) if g := dbp.SelectedGoroutine(); g != nil { g.CurrentLoc = *loc } - return nil + return curthread.SetCurrentBreakpoint() } } } diff --git a/pkg/proc/proc_test.go b/pkg/proc/proc_test.go index 12bdfdaa..5865b7b1 100644 --- a/pkg/proc/proc_test.go +++ b/pkg/proc/proc_test.go @@ -4084,3 +4084,20 @@ func TestReadDeferArgs(t *testing.T) { } }) } + +func TestIssue1374(t *testing.T) { + // Continue did not work when stopped at a breakpoint immediately after calling CallFunction. + protest.MustSupportFunctionCalls(t, testBackend) + withTestProcess("issue1374", t, func(p proc.Process, fixture protest.Fixture) { + setFileBreakpoint(p, t, fixture, 7) + assertNoError(proc.Continue(p), t, "First Continue") + assertLineNumber(p, t, 7, "Did not continue to correct location (first continue),") + assertNoError(proc.CallFunction(p, "getNum()", &normalLoadConfig, true), t, "Call") + err := proc.Continue(p) + if _, isexited := err.(proc.ErrProcessExited); !isexited { + regs, _ := p.CurrentThread().Registers(false) + f, l, _ := p.BinInfo().PCToLine(regs.PC()) + t.Fatalf("expected process exited error got %v at %s:%d", err, f, l) + } + }) +}