public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Aditya Kamath1 <Aditya.Kamath1@ibm.com>
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	"simon.marchi@efficios.com" <simon.marchi@efficios.com>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>,
	Sanket Rathi <sanrathi@in.ibm.com>
Subject: Re: [PATCH] Fix call functions command bug in 64-bit programs for AIX
Date: Mon, 14 Nov 2022 18:28:41 +0000	[thread overview]
Message-ID: <BY5PR15MB354036A43C04223678848396D6059@BY5PR15MB3540.namprd15.prod.outlook.com> (raw)
In-Reply-To: <881bbbcc3646f5df9c2f334133907d3ca37149a6.camel@de.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 3134 bytes --]

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 <Ulrich.Weigand@de.ibm.com>
Sent: 14 November 2022 23:49
To: gdb-patches@sourceware.org <gdb-patches@sourceware.org>; Aditya Kamath1 <Aditya.Kamath1@ibm.com>; simon.marchi@efficios.com <simon.marchi@efficios.com>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>; Sanket Rathi <sanrathi@in.ibm.com>
Subject: Re: [PATCH] Fix call functions command bug in 64-bit programs for AIX

Aditya Kamath1 <Aditya.Kamath1@ibm.com> 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


  reply	other threads:[~2022-11-14 18:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 11:00 Aditya Kamath1
2022-11-08 13:30 ` Ulrich Weigand
2022-11-11 17:53   ` Aditya Kamath1
2022-11-14 15:54     ` Ulrich Weigand
2022-11-14 17:32       ` Aditya Kamath1
2022-11-14 18:19         ` Ulrich Weigand
2022-11-14 18:28           ` Aditya Kamath1 [this message]
2022-11-14 18:43             ` Ulrich Weigand
2022-11-14 18:52               ` Aditya Kamath1
2022-11-14 19:10                 ` Ulrich Weigand
2022-11-16 11:27                   ` Aditya Kamath1
2022-11-16 15:15                     ` Ulrich Weigand
2022-11-16 18:07                       ` Aditya Kamath1
2022-11-16 18:30                         ` Tom Tromey
2022-11-17 12:54                         ` Ulrich Weigand
2022-11-24 17:56                           ` Aditya Kamath1
2022-11-24 18:15                             ` Tom Tromey
2023-04-14  7:38                               ` [PATCH] Fix call functions command bug in 64-bit programs for AIX and PC read in psymtab-symtab warning Aditya Kamath1
2023-04-14 14:45                                 ` Tom Tromey
2023-04-17 13:08                                   ` Aditya Kamath1
2023-04-17 13:16                                     ` Aditya Kamath1
2023-04-18 10:12                                       ` Ulrich Weigand
2023-04-21 13:00                                         ` Aditya Kamath1
2023-04-24 15:44                                           ` Ulrich Weigand
2023-04-27 10:13                                             ` Aditya Kamath1
2023-04-27 12:23                                               ` Ulrich Weigand
2023-04-27 10:14                                   ` Aditya Kamath1

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=BY5PR15MB354036A43C04223678848396D6059@BY5PR15MB3540.namprd15.prod.outlook.com \
    --to=aditya.kamath1@ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sangamesh.swamy@in.ibm.com \
    --cc=sanrathi@in.ibm.com \
    --cc=simon.marchi@efficios.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).