Skip to contentSkip to conversation

linux-user: Improve strace output of pread64() and pwrite64()

PATCH In review Helge Deller 2 participants 3 messages Jan 15, 2023 – Jan 27, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: Improve strace output of pread64() and pwrite64()

Make the strace look nicer for those two syscalls.

---
 linux-user/strace.list | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/strace.list +2 -2
index 909298099e..41bb6bbfbc 100644
@@ -1061,7 +1061,7 @@
 { TARGET_NR_prctl, "prctl" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_pread64
-{ TARGET_NR_pread64, "pread64" , NULL, NULL, NULL },
+{ TARGET_NR_pread64, "pread64" , "%s(%d,%p,%d,%u,%u)", NULL, NULL },
 #endif
 #ifdef TARGET_NR_preadv
 { TARGET_NR_preadv, "preadv" , NULL, NULL, NULL },
@@ -1092,7 +1092,7 @@
 { TARGET_NR_putpmsg, "putpmsg" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_pwrite64
-{ TARGET_NR_pwrite64, "pwrite64" , NULL, NULL, NULL },
+{ TARGET_NR_pwrite64, "pwrite64" , "%s(%d,%p,%d,%u,%u)", NULL, NULL },
 #endif
 #ifdef TARGET_NR_pwritev
 { TARGET_NR_pwritev, "pwritev" , NULL, NULL, NULL },

--
2.38.1

#1 lore raw

Le 15/01/2023 à 10:04, Helge Deller a écrit :

Quoted 30 lines

Make the strace look nicer for those two syscalls.

---
  linux-user/strace.list | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/strace.list +2 -3
index 909298099e..41bb6bbfbc 100644
@@ -1061,7 +1061,7 @@
  { TARGET_NR_prctl, "prctl" , NULL, NULL, NULL },
  #endif
  #ifdef TARGET_NR_pread64
-{ TARGET_NR_pread64, "pread64" , NULL, NULL, NULL },
+{ TARGET_NR_pread64, "pread64" , "%s(%d,%p,%d,%u,%u)", NULL, NULL },
  #endif
  #ifdef TARGET_NR_preadv
  { TARGET_NR_preadv, "preadv" , NULL, NULL, NULL },
@@ -1092,7 +1092,7 @@
  { TARGET_NR_putpmsg, "putpmsg" , NULL, NULL, NULL },
  #endif
  #ifdef TARGET_NR_pwrite64
-{ TARGET_NR_pwrite64, "pwrite64" , NULL, NULL, NULL },
+{ TARGET_NR_pwrite64, "pwrite64" , "%s(%d,%p,%d,%u,%u)", NULL, NULL },
  #endif
  #ifdef TARGET_NR_pwritev
  { TARGET_NR_pwritev, "pwritev" , NULL, NULL, NULL },
--
Quoted 3 lines

2.38.1

You need to use regpairs_aligned() and target_offset64() to correctly display the offset.

Thanks,
Laurent

#2 lore raw
Quoted 25 lines · Laurent Vivier

Le 15/01/2023 à 10:04, Helge Deller a écrit :

Quoted 24 lines

Make the strace look nicer for those two syscalls.

---
  linux-user/strace.list | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
linux-user/strace.list +1 -1
index 909298099e..41bb6bbfbc 100644
@@ -1061,7 +1061,7 @@
   { TARGET_NR_prctl, "prctl" , NULL, NULL, NULL },
   #endif
   #ifdef TARGET_NR_pread64
-{ TARGET_NR_pread64, "pread64" , NULL, NULL, NULL },
+{ TARGET_NR_pread64, "pread64" , "%s(%d,%p,%d,%u,%u)", NULL, NULL },
   #endif
   #ifdef TARGET_NR_preadv
   { TARGET_NR_preadv, "preadv" , NULL, NULL, NULL },
@@ -1092,7 +1092,7 @@
   { TARGET_NR_putpmsg, "putpmsg" , NULL, NULL, NULL },
   #endif
   #ifdef TARGET_NR_pwrite64
Quoted 8 lines

linux-user/strace.list

Quoted 6 lines
linux-user/strace.list +1 -2
-{ TARGET_NR_pwrite64, "pwrite64" , NULL, NULL, NULL },
+{ TARGET_NR_pwrite64, "pwrite64" , "%s(%d,%p,%d,%u,%u)", NULL, NULL },
   #endif
   #ifdef TARGET_NR_pwritev
   { TARGET_NR_pwritev, "pwritev" , NULL, NULL, NULL },
--

You need to use regpairs_aligned() and target_offset64() to correctly display the offset.

Good catch!
I'll send an fixed patch.

Thanks!
Helge