On Wed, Sep 9, 2020 at 11:58 PM Yonatan Gizachew <emeg...@gmail.com> wrote: > > Also, is there a way to print the values of runtime.g?
In what sense? Code running the runtime package can just print it. Or if you run the program under gdb, you should be able to "print 'runtime.g'" (you need the quotes because otherwise gdb will think it is a structure field reference). At least, gdb works that way on GNU/Linux, not sure about your operating system. Ian > On Thursday, September 10, 2020 at 12:15:04 PM UTC+9 Ian Lance Taylor wrote: >> >> On Wed, Sep 9, 2020 at 7:39 PM Yonatan Gizachew <eme...@gmail.com> wrote: >> > >> > This might be trivial, but could you explain me the relationship between >> > the following? >> > 1. value returned by __tls_get_addr >> >> This is the address of the TLS control block. The exact definition >> depends on the architecture. All TLS variables are at some offset >> from this value. >> >> > 2. runtime.g >> >> A TLS variable that holds the current goroutine, a pointer to a g struct. >> >> > 3. runtime.g0 >> >> A global variable that holds the g struct used for the initial goroutine. >> >> > 4. runtime.m0 >> >> A global variable that holds the m struct used for the initial thread. >> >> > 5. runtime.m >> >> gccgo no longer uses this. In earlier releases it was a TLS variable >> that holds the current thread, a pointer to an m struct. In current >> releases gccgo uses g->m for this. >> >> Ian > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/0935d7c3-d2de-49cd-8d25-196b276c5ca9n%40googlegroups.com. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcW1KzAdxYxfv4Ge5zFoioO3XTmDwVLeCxaC5dxobavkDw%40mail.gmail.com.