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

* Re: breakpoint on varargs function not working with PowerPC and  hard-float
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Machado @ 2009-01-26 12:24 UTC (permalink / raw)
  To: DARIN JOHNSON; +Cc: gdb

Didn't copy the list before, now doing so...


On Fri, 2009-01-23 at 18:25 -0800, DARIN JOHNSON wrote:
> 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.

Yes, i'm aware of this problem and i'm current looking into it from
GCC's side. It's indeed a part of the prologue, that may or may not be
executed, but GCC creates two distinct line number entries, confusing
GDB.

I'm not sure if sticking one extra case on rs6000_skip_prologue is the
best solution since the debugging information must be right for GDB, it
would be more of a workaround to the problem. Might be a temporary
solution until there's a fix on GCC.

Luis


^ 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