Hi Ulrich, >Can you show the specific debug code you have added to get this >output? I have added the printf in the store_register (struct regcache *regcache, int regno) function.. This is where ptrace will put the contents in the register.. I have pasted it below.. Have a nice day ahead. Thanks and regards, Aditya. else { /* PT_WRITE_GPR requires the buffer parameter to point to an 8-byte area, even if the register is really only 32 bits. */ long long buf; if (register_size (gdbarch, regno) == 8) memcpy (&buf, addr, 8); else buf = *addr; printf ("val in regno = %d via buf is %d and *addr is %d\n", regno, bu f, *addr); rs6000_ptrace64 (PT_WRITE_GPR, pid, nr, 0, &buf); } ________________________________ From: Ulrich Weigand Sent: 14 November 2022 23:49 To: gdb-patches@sourceware.org ; Aditya Kamath1 ; simon.marchi@efficios.com Cc: Sangamesh Mallayya ; Sanket Rathi Subject: Re: [PATCH] Fix call functions command bug in 64-bit programs for AIX Aditya Kamath1 wrote: >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