This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: next/step after main() function's return
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: Edjunior Barbosa Machado <emachado at linux dot vnet dot ibm dot com>, gdb at sourceware dot org
- Date: Tue, 28 Dec 2010 09:23:24 +0100
- Subject: Re: next/step after main() function's return
- References: <4D19144E.1030504@linux.vnet.ibm.com> <20101228052055.GY2618@adacore.com>
On Tue, 28 Dec 2010 06:20:55 +0100, Joel Brobecker wrote:
> > when issuing a next or step after main() function's return statement,
> > gdb drops to __libc_start_main() from libc on x86 (or
> > generic_start_main() on ppc and so on, depending on the arch if I'm
> > not mistaken). Is it considered a bug or it's just the expected
> > behavior?
>
> I'd say that this is expected behavior. `main' is called by
> __libc_start_main, so "next"-ing out of main will land in that function.
With default `set backtrace past-main off' the user may expect it to behave
differently. Still the atexit functions could be "next"ed so GDB would have
to identify somehow their calls.
Regards,
Jan