This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PING2] : [RFC/RFA] PING: skip __main
> From: "Pierre Muller" <muller@ics.u-strasbg.fr>
> Date: Fri, 30 May 2008 15:06:51 +0200
>
> > I'm afraid I think that skip_main_constructor_call is too long as a name.
>
> I am perfectly willing to use something shorter,
> the only problem is to find something that would still be
> of clear meaning.
>
> maybe
> skip_main_prologue
> would be better?
Actually, I think it is. The functionality can be used for other
prologue skipping that's not really related to constructors as well.
> > I'd also appreciate it if you could seperate local variable
> > declarations from the stations that follow by a blank line. Otherwise
> > this looks ok to me.
>
> Does this apply to both uninitialized and initialized variables?
>
> Would the code hereafter be correct, or did I add too many empty lines?
Please remove the blank line before the "struct minimal_symbol *s"
declaration.
> +/* Check that the code pointed to by PC corresponds to a call to
> + __main, skip it if so. Return PC otherwise. */
> +
> +CORE_ADDR
> +i386_skip_main_constructor_call (struct gdbarch *gdbarch, CORE_ADDR pc)
> +{
> + gdb_byte op;
> +
> + target_read_memory (pc, &op, 1);
> + if (op == 0xe8)
> + {
> + gdb_byte buf[4];
> +
> + if (target_read_memory (pc + 1, buf, sizeof buf) == 0)
> + {
> + CORE_ADDR call_dest = pc + 5 + extract_unsigned_integer (buf, 4);
> +
> + struct minimal_symbol *s = lookup_minimal_symbol_by_pc
> (call_dest);
> +
> + if (s != NULL
> + && SYMBOL_LINKAGE_NAME (s) != NULL
> + && strcmp (SYMBOL_LINKAGE_NAME (s), "__main") == 0)
> + pc += 5;
> + }
> + }
> +
> + return pc;
> +}
> +