Re: Regression on PowerPC (Re: [patch] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #3)

Joel Brobecker
2012-01-03T15:52:35Z

> > Checked in:
> > http://sourceware.org/ml/gdb-cvs/2012-01/msg00013.html
> > Checked in 7.4:
> > http://sourceware.org/ml/gdb-cvs/2012-01/msg00014.html

ARGH! Thanks for letting us know.

> Switching to the ON_STACK method fixes this for me. But I'm not sure
> if there are other platforms beside PowerPC that have the same problem ...
> Maybe we ought to default to ON_STACK (at least on Linux?)?

But this wouldn't prevent the same sort of problem on other
platforms. I think we don't know enough to keep this change in
as is.

It seems to me, at this point, that indeed the best way to solve
the original problem is to transition the GNU/Linux platforms to
ON_STACK. We then no longer need the patch that causes the regression.

> Note that it's a bit annoying that we need to provide a push_dummy_code
> routine in order to be able to use ON_STACK. Maybe there should be a
> default implementation based on gdbarch_inner_than/gdbarch_frame_align_p
> and the breakpoint length?

Agreed. We actually used to have such as routine, and deleted it
a while ago, after the last caller got removed. I reposted it
when I sent the patch series to add support for VxWorks.

The removal:
http://www.sourceware.org/ml/gdb-patches/2008-09/msg00320.html

The code:

> static CORE_ADDR
> rs6000_vxworks_push_dummy_code (struct gdbarch *gdbarch,
> CORE_ADDR sp, CORE_ADDR funaddr,
> struct value **args, int nargs,
> struct type *value_type,
> CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
> struct regcache *regcache)
> {
> /* Something here to findout the size of a breakpoint and then
> allocate space for it on the stack. */
> int bplen;
> /* This code assumes frame align. */
> gdb_assert (gdbarch_frame_align_p (gdbarch));
> /* Force the stack's alignment. The intent is to ensure that the SP
> is aligned to at least a breakpoint instruction's boundary. */
> sp = gdbarch_frame_align (gdbarch, sp);
> /* Allocate space for, and then position the breakpoint on the stack. */
> if (gdbarch_inner_than (gdbarch, 1, 2))
> {
> CORE_ADDR bppc = sp;
> gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
> sp = gdbarch_frame_align (gdbarch, sp - bplen);
> (*bp_addr) = sp;
> /* Should the breakpoint size/location be re-computed here? */
> }
> else
> {
> (*bp_addr) = sp;
> gdbarch_breakpoint_from_pc (gdbarch, bp_addr, &bplen);
> sp = gdbarch_frame_align (gdbarch, sp + bplen);
> }
> /* Inferior resumes at the function entry point. */
> (*real_pc) = funaddr;
> return sp;
> }

--
Joel