delve/_fixtures/databpeasy.go
Alessandro Arzilli 58762685e3
proc/native: low level support for watchpoints in linux/amd64 (#2301)
Adds the low-level support for watchpoints (aka data breakpoints) to
the native linux/amd64 backend.

Does not add user interface or functioning support for watchpoints
on stack variables.

Updates #279
2021-05-06 10:33:56 -07:00

35 lines
765 B
Go

package main
import (
"fmt"
"runtime"
)
var globalvar1 = 0
var globalvar2 = 0
func main() { // Position 0
runtime.LockOSThread()
globalvar2 = 1
fmt.Printf("%d %d\n", globalvar1, globalvar2)
globalvar2 = globalvar1 + 1
globalvar1 = globalvar2 + 1
fmt.Printf("%d %d\n", globalvar1, globalvar2) // Position 1
runtime.Breakpoint()
globalvar2 = globalvar2 + 1 // Position 2
globalvar2 = globalvar1 + globalvar2 // Position 3
fmt.Printf("%d %d\n", globalvar1, globalvar2)
globalvar1 = globalvar2 + 1
fmt.Printf("%d %d\n", globalvar1, globalvar2)
runtime.Breakpoint()
done := make(chan struct{}) // Position 4
go f(done)
<-done
}
func f(done chan struct{}) {
runtime.LockOSThread()
globalvar1 = globalvar2 + 1
close(done) // Position 5
}