Re: gdb unable to print fn argument correctly

Daniel Jacobowitz
2005-07-21T20:10:15Z

On Thu, Jul 21, 2005 at 02:40:23PM -0500, Manoj Iyer wrote:
>
> I have an test program which has a function of the nature 'void fn(double
> c){}', which is compiled as a PwerPC 64bit application. When I set a
> breakpoint and stop on this function, GDB is not printing the arguments
> passed to this function correctly.
>
> I did some initial debugging, the dwarf information and dissassembly of
> the function looks good to me. But I am not able to pin point who is
> corrupting the stack. I believe gdb is just printing what is avaiable in
> the stack to output.
>
> Any pointers to help me identify the culprit deeply appreciated.

Check what instruction ($pc) GDB has stopped on. The debug info is
valid only at or after 0x10000458. What does the line table look like?

> ==== Disassembly of void fn3(double c){} =======================
> fn3()
> [5] 10000448: 94 21 ff e0 stwu r1, -32(r1)
> 1000044c: 93 e1 00 1c stw r31, 28(r1)
> 10000450: 7c 3f 0b 78 mr r31, r1
> 10000454: d8 3f 00 08 stfd fr1, 8(r31)
> 10000458: 81 61 00 00 lwz r11, 0(r1)
> 1000045c: 83 eb ff fc lwz r31, -4(r11)
> 10000460: 7d 61 5b 78 mr r1, r11
> 10000464: 4e 80 00 20 blr
> ==================================================================