Go, gdb, and 'green threads'

Graham King graham@gkgk.org
Sat Mar 1 18:44:00 GMT 2014

Hi gdb,

The Go language has it's own scheduler (http://morsmachine.dk/go-scheduler) which runs go-routines (sort of green threads, lightweight threads, etc). When a go-routine returns from a syscall, it can get added to a global runqueue, and picked up by the next available OS thread, which might not be the thread it was running on before the syscall.

If I single-step ('next') over a line that does a syscall, is there any way to get gdb to pick up from the thread where the go-routine moves to? Currently gdb loses the go-routine if that go-routine changes threads.

I'd like to follow the execution of a go-routine, not an OS thread. My guess is this would require some co-operation between the Go scheduler and gdb, but I have no idea where to start looking.

Thanks in advance,

More information about the Gdb mailing list