This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] symtab.c: Change skip_prologue_sal comparison to match main() too
On Wed, 14 Mar 2012 10:02:28 +0100
Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> On Wed, 14 Mar 2012 00:24:59 +0100, Pedro Alves wrote:
> > I'm going to guess this is fallback from physname. The code looked like
> > this when it was originally added:
> >
> > + /* On targets with executable formats that don't have a concept of
> > + constructors (ELF with .init has, PE doesn't), gcc emits a call
> > + to `__main' in `main' between the prologue and before user
> > + code. */
> > + if (funfirstline
> > + && gdbarch_skip_main_prologue_p (current_gdbarch)
> > + && SYMBOL_LINKAGE_NAME (sym)
> > + && strcmp (SYMBOL_LINKAGE_NAME (sym), "main") == 0)
> >
> > And SYMBOL_LINKAGE_NAME (sym) used to be "main" for C++ too.
>
> This is:
> regression by physname: PE32 prologue skip vs. static initializers
> http://sourceware.org/bugzilla/show_bug.cgi?id=12680
>
> I would welcome also a testcase, though.
While it wasn't really designed to test this case, gdb.cp/koenig.exp
does provide a test as the resulting failures are due to not executing
everything up to the first line in the body of main().
If you wanted a more direct test, all that's needed is to place a
breakpoint in main() in a C++ program and make sure that this
breakpoint ends up being placed on the first line of the function
body.
Kevin