delve/_fixtures/databpstack.go
Alessandro Arzilli 4264bf00f2
proc,terminal,service: support stack watchpoints (#2521)
* terminal,service: add way to see internal breakpoints

Now that Delve has internal breakpoints that survive for long periods
of time it will be useful to have an option to display them.

* proc,terminal,service: support stack watchpoints

Adds support for watchpoints on stack allocated variables.

When a stack variable is watched, in addition to the normal watchpoint
some support breakpoints are created:

- one breakpoint inside runtime.copystack, used to adjust the address
  of the watchpoint when the stack is resized
- one or more breakpoints used to detect when the stack variable goes
  out of scope, those are similar to the breakpoints set by StepOut.

Implements #279
2021-08-09 10:41:25 -07:00

26 lines
265 B
Go

package main
import (
"fmt"
"runtime"
)
func f() {
w := 0
runtime.Breakpoint()
g(1000, &w) // Position 0
}
func g(cnt int, p *int) {
if cnt == 0 {
*p = 10
return // Position 1
}
g(cnt-1, p)
}
func main() {
f()
fmt.Printf("done\n") // Position 2
}