From: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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
Date: Mon, 14 Nov 2022 19:10:56 +0000 [thread overview]
Message-ID: <ab76d46b82949cc347ca8d08b2f1bb6661aa78ec.camel@de.ibm.com> (raw)
In-Reply-To: <BY5PR15MB35402C24EC55CAE8F9BDA79FD6059@BY5PR15MB3540.namprd15.prod.outlook.com>
Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:
>(gdb) call num2print (2, 3, 4, 6)
>val in regno = 3 via buf is 2 and *addr is 0, regsize = 8
>val in regno = 4 via buf is 4629700416936869888 and *addr is 1077936128, regsize = 8
>val in regno = 5 via buf is 17179869184 and *addr is 4, regsize = 8
>val in regno = 6 via buf is 25769803776 and *addr is 6, regsize = 8....
Thanks!
This indicates that value is already placed incorrectly
into the register cache, before store_register was even
called.
Looking at rs6000_push_dummy_call in rs6000-aix-tdep.c, I see:
> /* Argument can fit in one register. No problem. */
> gdb_byte word[PPC_MAX_REGISTER_SIZE];
>
> memset (word, 0, reg_size);
> memcpy (word, value_contents (arg).data (), len);
> regcache->cooked_write (tdep->ppc_gp0_regnum + 3 +ii, word);
which places an "int" argument in the *high* bytes of a register
on a 64-bit system. This seems clearly wrong, and would be the
root cause of the problem you're seeing.
I think you'll need to have a closer look at this function and
make sure it implements the AIX ABI correctly, in particular
also on 64-bit systems. (You might want to have a look at the
ppc64_sysv_abi_push_dummy_call routine for comparison, which
implements the Linux 64-bit ABI; I understand this is similar
to the AIX ABI.)
I assume that once you've fixed the push_dummy_call implementation,
no changes to the store_register / fetch_register routines will
be needed at all.
Bye,
Ulrich
next prev parent reply other threads:[~2022-11-14 19:11 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
2022-11-14 18:43 ` Ulrich Weigand
2022-11-14 18:52 ` Aditya Kamath1
2022-11-14 19:10 ` Ulrich Weigand [this message]
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=ab76d46b82949cc347ca8d08b2f1bb6661aa78ec.camel@de.ibm.com \
--to=ulrich.weigand@de.ibm.com \
--cc=Aditya.Kamath1@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).