Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* breakpoint on varargs function not working with PowerPC and hard-float
@ 2009-01-24  2:25 DARIN JOHNSON
  2009-01-26 12:24 ` Luis Machado
  0 siblings, 1 reply; 2+ messages in thread
From: DARIN JOHNSON @ 2009-01-24  2:25 UTC (permalink / raw)
  To: gdb

There seems to be a problem on PowerPC when setting
a breakpoint on some functions.  The breakpoint is
placed on an address that will never be reached, so
that GDB will not stop when stepping into that function.

This occurs with PowerPC EABI (or SVR4), using hardware
floating point, and with functions that have a variable
number of arguments.  This is using GDB 6.8.50 and GCC 3.4.4.

I believe the problem is that this is a special case not
handled by rs6000_skip_prologue().

Consider this function:

    void VarTest(const char* fmt, ...)
    {
        va_list argp;
        va_start( argp, fmt );
        vfprintf(stdout, fmt, argp);
    }

The following PowerPC code is generated as the preamble:

        .globl VarTest
        .type   VarTest, @function
    VarTest:
        .loc 1 8 0
        stwu %r1,-144(%r1)
        mflr %r0
        stw %r31,140(%r1)
        stw %r0,148(%r1)
        mr %r31,%r1
        stw %r4,12(%r31)
        stw %r5,16(%r31)
        stw %r6,20(%r31)
        stw %r7,24(%r31)
        stw %r8,28(%r31)
        stw %r9,32(%r31)
        stw %r10,36(%r31)
        bne %cr1,.L2
        .loc 1 8 0
        stfd %f1,40(%r31)
        stfd %f2,48(%r31)
        stfd %f3,56(%r31)
        stfd %f4,64(%r31)
        stfd %f5,72(%r31)
        stfd %f6,80(%r31)
        stfd %f7,88(%r31)
        stfd %f8,96(%r31)
    .L2:
        stw %r3,128(%r31)
    .LBB2:
    .LBB3:
        .loc 1 11 0

In this case, when I do "b VarTest" in GDB it puts the breakpoint
at the first "stfd" instruction.  But that instruction will never
be executed if no floating point arguments were passed.  SVR4
will only set that condition code if a floating point argument
was passed.

What seems to be happening is that skip_prologue_using_sal()
assumes the second line number marker is the end of the
prologue.  Which is true normally, but not in this particular
case.  I suspect GCC is sticking the extra line marker here
because of the branch.  The rs6000_skip_prologue() function
accepts the result from skip_prologue_using_sal().  But it
probably should be checking for this special case.

--
Darin Johnson



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-26 12:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-24  2:25 breakpoint on varargs function not working with PowerPC and hard-float DARIN JOHNSON
2009-01-26 12:24 ` Luis Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox