Re: [PATCH] Fix call functions command bug in 64-bit programs for AIX

Ulrich Weigand via Gdb-patches
2022-11-14T18:19:47Z

>I have added a print statement for what we get in *addr via raw_supply
>and what we copy in long buf that will go in the ptrace. Also, I print
>the regno. As a fact register number R3 to R10 are reserved for
>function parameters.

Yes, of course just looking at "*addr" will be wrong in 64-bit mode,
but that doesn't matter since nobody is actually ever looking at
"*addr" in this case.

>(gdb) call num2print (2, 3, 4, 5)
>val in regno 3 via buf is 0 and *addr is 2
>val in regno 4 via buf is 0 and *addr is 1077936128
>val in regno 5 via buf is 0 and *addr is 4
>val in regno 6 via buf is 0 and *addr is 5
>val in regno 1 via buf is -1696 and *addr is 268435455
>val in regno 67 via buf is 1152 and *addr is 1

Can you show the specific debug code you have added to get this
output?

>(gdb) info reg
>r0 0x1000004f4 4294968564
>r1 0xffffffffffff9e0 1152921504606845408
>r2 0x1100002e0 4563403488
>r3 0x1 1
>r4 0xffffffffffffad0 1152921504606845648
>r5 0xffffffffffffae0 1152921504606845664
>r6 0x800000000000d032 9223372036854829106
>r7 0xfffffffffffffe0 1152921504606846944
>r8 0x0 0
>r9 0x1 1
>r10 0x0 0
>r11 0x1030 4144
>r12 0xf1000600005901d8 17365886760216232408
>r13 0xbadc0ffee0ddf00d 13464654573299691533

From what I can see these are the values after the
num2print routine has returned and the original
values were restored by GDB.

If you want to see the values *in num2print* you need
to set a breakpoint at num2print before calling it.

Bye,
Ulrich