delve/_fixtures/ebpf_trace2.go
Derek Parker 1d28ceccdc
pkg/proc: fix ebpf probe tracing backen uprobe handling (#3417)
Uprobes get automatically cleaned and removed when the reference to
the Link object is lost. Hold a reference to any active Uprobe Link
for duration of Delve execution and ensure they are cleaned up
at exit.

Fixes ebpf probes don't work after time.Sleep() #3227
2023-06-15 12:07:32 +02:00

23 lines
259 B
Go

package main
import (
"fmt"
"time"
)
func main() {
i := int64(0)
for i = 0; i < 5; i++ {
tracedFunction(i)
}
for i = 5; i < 10; i++ {
tracedFunction(i)
time.Sleep(time.Second)
}
}
//go:noinline
func tracedFunction(x int64) {
fmt.Println(x)
}