On Tue, Apr 9, 2019 at 7:43 AM <vaastav.anan...@gmail.com> wrote: > > I have been working on a research project where I have been modifying the > runtime such that I can control the goroutines that are scheduled as well as > get access to the values of program variables. > I know I can access the stack through the g struct for a goroutine but I was > wondering if someone could tell me how to get the symbol/object table so that > I can figure out the names of the local variables on the stack for the > goroutine as well as the variables on the heap. > Any help would be greatly appreciated.
The names of local variables on the stack are recorded only the debug information, which is not loaded into memory. You would need to locate the binary, open it, and look at the debug info. Getting a local variable name from the debug info is complex, but Delve and gdb manage to do it. That is, getting the names of local variables is technically possible but quite hard. I wouldn't recommend this approach. 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. For more options, visit https://groups.google.com/d/optout.