When i debug go func() with dlv, use s to go into but not exec. Who is familiar with dlv debugging go source code? thanks!
package main import "fmt" func main() { a := make(chan int) go func() { a <- 1 }() for { select { case i, ok := <-a: fmt.Println("a:", i, "\tStatus:", ok) default: fmt.Println("a over") return } } } go build -o chan -gcflags="-N -l" chan.go dlv exec ./chan Type 'help' for list of commands. (dlv) b main.main:7 Command failed: could not find /data/app/go/src/go1.11.1/demo/type/chan/debug/chan.go:12 (dlv) b main.main Breakpoint 1 set at 0x1090fc8 for main.main() ./chan.go:5 (dlv) c > main.main() ./chan.go:5 (hits goroutine(1):1 total:1) (PC: 0x1090fc8) 1: package main 2: 3: import "fmt" 4: => 5: func main() { 6: a := make(chan int) 7: go func() { 8: a <- 1 9: }() 10: (dlv) s > main.main() ./chan.go:6 (PC: 0x1090fdf) 1: package main 2: 3: import "fmt" 4: 5: func main() { => 6: a := make(chan int) 7: go func() { 8: a <- 1 9: }() 10: 11: for { (dlv) s > main.main() ./chan.go:9 (PC: 0x1091002) 4: 5: func main() { 6: a := make(chan int) 7: go func() { 8: a <- 1 => 9: }() 10: 11: for { 12: select { 13: case i, ok := <-a: 14: fmt.Println("a:", i, "\tStatus:", ok) (dlv) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.