From: Carl Love via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org, Rogerio Alves <rogealve@br.ibm.com>,
will schmidt <will_schmidt@vnet.ibm.com>,
Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Subject: Re: [PATCH] Powerpc: Add support for openat and fstatat syscalls
Date: Wed, 13 Oct 2021 14:55:43 -0700 [thread overview]
Message-ID: <0395c04977602476887fec6bdff16f1148d72ffd.camel@us.ibm.com> (raw)
In-Reply-To: <OF8D70D176.67629273-ONC125876D.00479F81-C125876D.004826BA@us.ibm.com>
Ulrich:
On Wed, 2021-10-13 at 15:08 +0200, Ulrich Weigand wrot
>
> The two syscalls are similar, but not identical. In particular, they
> differ in the amount of memory that is accessed:
>
> sys_newfstatat accesses a "struct stat"
> (144 bytes on 64-bit / 88 bytes on 32-bit)
> sys_fstatat64 accesses a "struct stat64"
> (104 bytes on both 64-bit and 32-bit)
>
> Since this affects the memory being recorded, it would actually be
> preferable to use the correct system call depending on ABI.
>
> Note that in general, there are more cases of syscall numbers
> refering
> to different system calls depending on the ABI (64-bit vs. 32-bit),
> so it would make sense to add support for that in general.
>
> As an example, you may want to look s390_canonicalize_syscall,
> which does make the distinction between 64-bit and 32-bit ABI
Thanks for the additional info and pointers. I added a word size
argument to ppc_canonicalize_syscall. The argument is then used to
select the correct 64-bit or 32-bit syscall.
The updated patch has been retested on Power 10. Please let me know if
it looks OK now. Thanks.
Carl
--------------------------------------------------------
Powerpc: Add support for openat and fstatat syscalls
[gdb] update ppc-linux-tdep.c
Add argument to ppc_canonicalize_syscall for the wordsize.
Add syscall entries for the openat and fstatat system calls.
---
gdb/ppc-linux-tdep.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index ea8e3b98fa4..1e0e9a0268a 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1371,7 +1371,7 @@ static struct linux_record_tdep ppc64_linux_record_tdep;
SYSCALL. */
static enum gdb_syscall
-ppc_canonicalize_syscall (int syscall)
+ppc_canonicalize_syscall (int syscall, int wordsize)
{
int result = -1;
@@ -1391,6 +1391,13 @@ ppc_canonicalize_syscall (int syscall)
result = syscall += 259 - 240;
else if (syscall >= 250 && syscall <= 251) /* tgkill */
result = syscall + 270 - 250;
+ else if (syscall == 286)
+ result = gdb_sys_openat;
+ else if (syscall == 291)
+ if (wordsize == 64)
+ result = gdb_sys_newfstatat;
+ else
+ result = gdb_sys_fstatat64;
else if (syscall == 336)
result = gdb_sys_recv;
else if (syscall == 337)
@@ -1414,7 +1421,7 @@ ppc_linux_syscall_record (struct regcache *regcache)
int ret;
regcache_raw_read_unsigned (regcache, tdep->ppc_gp0_regnum, &scnum);
- syscall_gdb = ppc_canonicalize_syscall (scnum);
+ syscall_gdb = ppc_canonicalize_syscall (scnum, tdep->wordsize);
if (syscall_gdb < 0)
{
--
2.30.2
next prev parent reply other threads:[~2021-10-13 21:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-05 20:59 Carl Love via Gdb-patches
2021-10-07 17:52 ` Ulrich Weigand via Gdb-patches
2021-10-07 19:43 ` Sergio Durigan Junior via Gdb-patches
[not found] ` <OF499743BD.418B9A20-ONC1258767.0061CCF4-C1258767.006229AD@us.ibm.com>
2021-10-11 21:17 ` Carl Love via Gdb-patches
2021-10-11 21:57 ` will schmidt via Gdb-patches
2021-10-12 19:13 ` Carl Love via Gdb-patches
2021-10-13 13:08 ` Ulrich Weigand via Gdb-patches
[not found] ` <OF8D70D176.67629273-ONC125876D.00479F81-C125876D.004826BA@us.ibm.com>
2021-10-13 21:55 ` Carl Love via Gdb-patches [this message]
2021-10-14 11:21 ` Ulrich Weigand via Gdb-patches
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=0395c04977602476887fec6bdff16f1148d72ffd.camel@us.ibm.com \
--to=gdb-patches@sourceware.org \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=cel@us.ibm.com \
--cc=rogealve@br.ibm.com \
--cc=will_schmidt@vnet.ibm.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