This is the mail archive of the
mailing list for the GDB project.
Re: next/step after main() function's return
Joel Brobecker wrote:
I'm guessing this happens because libc_start_main is compiled with -g.
Otherwise, gdb would continue executing "in the woods" until exit.
Actually, off-by-one error :-). __libc_start_main is not compiled with
debugging info, but main is. When you do a "next" in main, GDB takes
the debugging info, and computes the address range that we need to
step out of. So, when main returns back to __libc_start_main, we're
done, and tell the user where we are. What you are describing, however,
happens once we land inside __libc_start_main, since there is no line
info to help us compute the next/step range.
Hmm, yes, and that's when I would expect us to keep stepping, looking
for a line range, until eventually we exit.