Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
runtime: stack growth during execution of "next" confuses gdb #25505
This is not necessarily a "Go" bug, but this needs to be recorded.
If, in gdb, you attempt a "next" across a call to a function f, and if execution of f causes stack growth, then gdb does not recognize the return from f as the actual return from f (because it does not match the call stack, as might be the case if there is recursion, or multiple threads executing the same function), and will appear to "run ahead" to the next breakpoint or the end of the program, whichever comes first.
This is the root cause of #25497.
This is a problem for Go versions between 1.5 and 1.11, at least, and gdb versions between 7.9 and 8.1, at least.
@bcmills I'm not sure that I want to imply that any of us is required to act on this, I just wanted to have a thing to point to for "that problem". Ideally gdb would learn that goroutines are identified by their "g" "registers" and use that. I.e., the runtime already ties the call and return together with the g register.
I don't think there is. GDB's "next" creates a temporary internal breakpoint that's predicated on both the stack pointer and the thread . This seems pretty fundamentally incompatible with both stack copying (though would work with segmented stacks, which cause other problems for debugging) and N:M scheduling. The only potential wedge I see is that there's special handling for
 This starts at