This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/14864] New: Incorrect breakpoint address forfunctions with variable number of parameters (PPC)


http://sourceware.org/bugzilla/show_bug.cgi?id=14864

             Bug #: 14864
           Summary: Incorrect breakpoint address for functions with
                    variable number of parameters (PPC)
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned@sourceware.org
        ReportedBy: pam@oktetlabs.ru
    Classification: Unclassified


This is PowerPC problem.
Breakpoints at functions with variable number of arguments do not work because
of incorrect computation of address at which breakpoint should be set.

Example:
Code:
int
function (int x, ...)
{
    return x+1;
}

...
function(1);
...

(gdb) break function
Breakpoint 1 at 0x10620: file ../src/test.c, line 44.
(gdb) disassemble function
Dump of assembler code for function function:
   0x000105fc <+0>:    stwu    r1,-112(r1)
   0x00010600 <+4>:    stw     r4,12(r1)
   0x00010604 <+8>:    stw     r5,16(r1)
   0x00010608 <+12>:    stw     r6,20(r1)
   0x0001060c <+16>:    stw     r7,24(r1)
   0x00010610 <+20>:    stw     r8,28(r1)
   0x00010614 <+24>:    stw     r9,32(r1)
   0x00010618 <+28>:    stw     r10,36(r1)
   0x0001061c <+32>:    bne     cr1,0x10640 <function+68>
   0x00010620 <+36>:    stfd    f1,40(r1)
   0x00010624 <+40>:    stfd    f2,48(r1)
   0x00010628 <+44>:    stfd    f3,56(r1)
   0x0001062c <+48>:    stfd    f4,64(r1)
   0x00010630 <+52>:    stfd    f5,72(r1)
   0x00010634 <+56>:    stfd    f6,80(r1)
   0x00010638 <+60>:    stfd    f7,88(r1)
   0x0001063c <+64>:    stfd    f8,96(r1)
   0x00010640 <+68>:    stw     r3,104(r1)
   0x00010644 <+72>:    lwz     r0,104(r1)
   0x00010648 <+76>:    addic   r0,r0,1
   0x0001064c <+80>:    mr      r3,r0
   0x00010650 <+84>:    addi    r1,r1,112
   0x00010654 <+88>:    blr
End of assembler dump.

As you can see, breakpoint at 0x10620, but function(1) call does not reach this
address because of bne instruction at 0x0001061c:

(gdb) disassemble
Dump of assembler code for function function:
....
   0x00010618 <+28>:    stw     r10,36(r1)
=> 0x0001061c <+32>:    bne     cr1,0x10640 <function+68>
   0x00010620 <+36>:    stfd    f1,40(r1)
   0x00010624 <+40>:    stfd    f2,48(r1)
   0x00010628 <+44>:    stfd    f3,56(r1)
   0x0001062c <+48>:    stfd    f4,64(r1)
   0x00010630 <+52>:    stfd    f5,72(r1)
   0x00010634 <+56>:    stfd    f6,80(r1)
   0x00010638 <+60>:    stfd    f7,88(r1)
   0x0001063c <+64>:    stfd    f8,96(r1)
   0x00010640 <+68>:    stw     r3,104(r1)
...
End of assembler dump.
(gdb) si
0x00010640    44    {
(gdb) disassemble
Dump of assembler code for function function:
...
   0x00010618 <+28>:    stw     r10,36(r1)
   0x0001061c <+32>:    bne     cr1,0x10640 <function+68>
   0x00010620 <+36>:    stfd    f1,40(r1)
   0x00010624 <+40>:    stfd    f2,48(r1)
   0x00010628 <+44>:    stfd    f3,56(r1)
   0x0001062c <+48>:    stfd    f4,64(r1)
   0x00010630 <+52>:    stfd    f5,72(r1)
   0x00010634 <+56>:    stfd    f6,80(r1)
   0x00010638 <+60>:    stfd    f7,88(r1)
   0x0001063c <+64>:    stfd    f8,96(r1)
=> 0x00010640 <+68>:    stw     r3,104(r1)
...

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]