This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
breakpoint on varargs function not working with PowerPC and hard-float
- From: "DARIN JOHNSON" <darin at usa dot net>
- To: <gdb at sourceware dot org>
- Date: Fri, 23 Jan 2009 18:25:06 -0800
- Subject: breakpoint on varargs function not working with PowerPC and hard-float
- Z-usanet-msgid: XID301NaXcZH1472X36
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