-
-
Save astaxie/4031691 to your computer and use it in GitHub Desktop.
(gdb) run | |
Starting program: /home/xiemengjun/gdbfile | |
Starting main | |
count: 0 | |
count: 1 | |
count: 2 | |
count: 3 | |
count: 4 | |
count: 5 | |
count: 6 | |
count: 7 | |
count: 8 | |
count: 9 | |
[LWP 2771 exited] | |
[Inferior 1 (process 2771) exited normally] | |
(gdb) b 23 | |
Breakpoint 1 at 0x400d8d: file /home/xiemengjun/gdbfile.go, line 23. | |
(gdb) run | |
Starting program: /home/xiemengjun/gdbfile | |
Starting main | |
[New LWP 3284] | |
[Switching to LWP 3284] | |
Breakpoint 1, main.main () at /home/xiemengjun/gdbfile.go:23 | |
23 fmt.Println("count:", count) | |
(gdb) list | |
18 fmt.Println(msg) | |
19 bus := make(chan int) | |
20 msg = "starting a gofunc" | |
21 go counting(bus) | |
22 for count := range bus { | |
23 fmt.Println("count:", count) | |
24 } | |
25 } |
(gdb) goroutine 1 bt
#0 0x000000000040e33b in runtime.gosched () at /home/xiemengjun/go/src/pkg/runtime/proc.c:927
#1 0x0000000000403091 in runtime.chanrecv (c=void, ep=void, selected=void, received=void)
at /home/xiemengjun/go/src/pkg/runtime/chan.c:327
#2 0x000000000040316f in runtime.chanrecv2 (t=void, c=void)
at /home/xiemengjun/go/src/pkg/runtime/chan.c:420
#3 0x0000000000400d6f in main.main () at /home/xiemengjun/gdbfile.go:22
#4 0x000000000040d0c7 in runtime.main () at /home/xiemengjun/go/src/pkg/runtime/proc.c:244
#5 0x000000000040d16a in schedunlock () at /home/xiemengjun/go/src/pkg/runtime/proc.c:267
#6 0x0000000000000000 in ?? ()
(gdb) goroutine 2 bt
#0 runtime.entersyscall () at /home/xiemengjun/go/src/pkg/runtime/proc.c:952
#1 0x000000000040bc59 in runtime.MHeap_Scavenger () at /home/xiemengjun/go/src/pkg/runtime/mheap.c:363
#2 0x000000000040d16a in schedunlock () at /home/xiemengjun/go/src/pkg/runtime/proc.c:267
#3 0x0000000000000000 in ?? ()
(gdb) goroutine 3 bt
#0 0x000000000040e33b in runtime.gosched () at /home/xiemengjun/go/src/pkg/runtime/proc.c:927
#1 0x0000000000415b3e in runtime.tsleep (ns=void) at /home/xiemengjun/go/src/pkg/runtime/time.goc:1718
#2 0x0000000000415aa8 in time.Sleep (ns=void) at /home/xiemengjun/go/src/pkg/runtime/time.goc:1674
#3 0x0000000000400c2f in main.counting (c=0xf840001a50) at /home/xiemengjun/gdbfile.go:10
#4 0x000000000040d16a in schedunlock () at /home/xiemengjun/go/src/pkg/runtime/proc.c:267
#5 0x000000f840001a50 in ?? ()
#6 0x0000000000000000 in ?? ()
(gdb) goroutine 4 bt
#0 0x000000000040e33b in runtime.gosched () at /home/xiemengjun/go/src/pkg/runtime/proc.c:927
#1 0x0000000000415d74 in timerproc () at /home/xiemengjun/go/src/pkg/runtime/time.goc:1840
#2 0x000000000040d16a in schedunlock () at /home/xiemengjun/go/src/pkg/runtime/proc.c:267
#3 0x0000000000000000 in ?? ()
(gdb) info goroutines
- 1 running runtime.gosched
- 2 syscall runtime.entersyscall
3 waiting runtime.gosched
4 runnable runtime.gosched
(gdb) info locals
count = 5
bus = 0xf840001a50
(gdb) set variable count=9
(gdb) info locals
count = 9
bus = 0xf840001a50
(gdb) c
Continuing.
count: 9
[Switching to LWP 3302]
Breakpoint 1, main.main () at /home/xiemengjun/gdbfile.go:23
23 fmt.Println("count:", count)