From: "DARIN JOHNSON" <darin@usa.net>
To: <gdb@sourceware.org>
Subject: breakpoint on varargs function not working with PowerPC and hard-float
Date: Sat, 24 Jan 2009 02:25:00 -0000 [thread overview]
Message-ID: <617NaXcyg3898S07.1232763906@cmsweb07.cms.usa.net> (raw)
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
next reply other threads:[~2009-01-24 2:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-24 2:25 DARIN JOHNSON [this message]
2009-01-26 12:24 ` Luis Machado
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=617NaXcyg3898S07.1232763906@cmsweb07.cms.usa.net \
--to=darin@usa.net \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox