bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

breakpoint on varargs function doesn't work on powerpc-eabi


From: Darin Johnson
Subject: breakpoint on varargs function doesn't work on powerpc-eabi
Date: Wed, 21 Jan 2009 19:57:08 -0800 (PST)
User-agent: G2/1.0

Using GDB 6.8, GCC 3.4.4, and PowerPC EABI (an embedded system).

When I set a breakpoint on a function that has variable number of
args,
the breakpoint is set on an instruction that is not reached unless a
floating point argument was given.

Ie, with 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)

The way the ABI works is that a condition code bit is set to
indicate if floating point args should be saved or not.
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
reached if no floating point arguments were passed.  I would have
expected the breakpoint either at the first "stwu", or at .L2.

Has anyone seen similar problems, or know of work arounds?

I have built GDB and GCC myself, so it's possible I've messed up
some configuration somewhere.  Code is compiled with -gdwarf-2,
though I've tried -ggdb which hasn't helped.  Both are built with
--target=powerpc-eabi.

--
Darin Johnson


reply via email to

[Prev in Thread] Current Thread [Next in Thread]