delve/_fixtures/issue573.go
dr2chase 218c2b953b proc: Fix stepping into runtime.duff* (#575)
Detect calls that do not target a function's entrypoint
(i.e, calls to runtime.duffzero and runtime.duffcopy) and
instead step into them directly.  StepInto sets a breakpoint
past the called function's prologue and expects that continue
will hit that breakpoint, but because the call is into the
interior of the function (well past the prologue) this fails.

Fixes #573
2016-07-21 13:10:35 -07:00

29 lines
607 B
Go

package main
// A debugger test.
// dlv debug
// b main.foo
// c
// s
// s
// Expect to be stopped in fmt.Printf or runtime.duffzero
// In bug, s #2 runs to the process exit because the call
// to duffzero enters duffzero well after the nominal entry
// and skips the temporary breakpoint placed by StepZero().
import "fmt"
var v int = 99
func foo(x, y int) (z int) { // c stops here
fmt.Printf("x=%d, y=%d, z=%d\n", x, y, z) // s #1 stops here; s #2 is supposed to stop in Printf or duffzero.
z = x + y
return
}
func main() {
x := v
y := x * x
z := foo(x, y)
fmt.Printf("z=%d\n", z)
}