This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: next/step after main() function's return


On Wed, 29 Dec 2010 03:26:09 +0100, 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,

It can be, depending on the OS:

7	  return 0;
(gdb) next
8	}
(gdb) next
__libc_start_main (main=0x4004c4 <main>, argc=1, ubp_av=0x7fffffffdf08, init=<value optimized out>, fini=<value optimized out>, rtld_fini=<value optimized out>, stack_end=0x7fffffffdef8) at libc-start.c:258
258	  exit (result);
(gdb) list
253	#else
254	  /* Nothing fancy, just call the function.  */
255	  result = main (argc, argv, __environ MAIN_AUXVEC_PARAM);
256	#endif
257	
258	  exit (result);
259	}
(gdb) info source
Current source file is libc-start.c
Compilation directory is /usr/src/debug/glibc-2.12-232-gdbb0472/csu
Located in /usr/src/debug/glibc-2.12-232-gdbb0472/csu/libc-start.c
Contains 259 lines.
Source language is c.
Compiled with DWARF 2 debugging format.
Does not include preprocessor macro info.
(gdb) _

fedora-release-14-1.noarch
glibc-debuginfo-2.12.90-21.x86_64


Regards,
Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]