aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.go/chan.go
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.go/chan.go')
-rw-r--r--gdb/testsuite/gdb.go/chan.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.go/chan.go b/gdb/testsuite/gdb.go/chan.go
new file mode 100644
index 0000000..f237288
--- /dev/null
+++ b/gdb/testsuite/gdb.go/chan.go
@@ -0,0 +1,20 @@
+package main
+
+import "fmt"
+
+func generate() chan int {
+ ch := make(chan int)
+ go func() {
+ for i := 0; ; i++ {
+ ch <- i // set breakpoint 1 here
+ }
+ }()
+ return ch
+}
+
+func main() {
+ integers := generate()
+ for i := 0; i < 100; i++ { // Print the first hundred integers.
+ fmt.Println(<-integers) // set breakpoint 2 here
+ }
+}