Fix pread/pwrite display for SH and MIPS
Daniel Jacobowitz
drow at false.org
Wed Jul 16 11:45:11 UTC 2003
Both SH and MIPS calling conventions mandate a blank padding register before
the 64-bit off_t argument to pread or pwrite. How's this patch?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
--- strace-4.4/io.c.orig 2003-07-16 14:30:56.000000000 -0400
+++ strace-4.4/io.c 2003-07-16 14:33:59.000000000 -0400
@@ -231,6 +231,14 @@ struct tcb *tcp;
#endif /* FREEBSD */
#ifdef LINUX
+
+/* On MIPS and SH (as of 2.4.20) there is a padding word before the off_t. */
+#if defined(MIPS) || defined(SH)
+#define PREAD_OFF_ARG 4
+#else
+#define PREAD_OFF_ARG 3
+#endif
+
int
sys_pread(tcp)
struct tcb *tcp;
@@ -243,7 +251,7 @@ struct tcb *tcp;
else
printstr(tcp, tcp->u_arg[1], tcp->u_rval);
tprintf(", %lu, %llu", tcp->u_arg[2],
- *(unsigned long long *)&tcp->u_arg[3]);
+ *(unsigned long long *)&tcp->u_arg[PREAD_OFF_ARG]);
}
return 0;
}
@@ -256,7 +264,7 @@ struct tcb *tcp;
tprintf("%ld, ", tcp->u_arg[0]);
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
tprintf(", %lu, %llu", tcp->u_arg[2],
- *(unsigned long long *)&tcp->u_arg[3]);
+ *(unsigned long long *)&tcp->u_arg[PREAD_OFF_ARG]);
}
return 0;
}
--- strace-4.4/linux/syscallent.h.orig 2003-07-16 14:34:20.000000000 -0400
+++ strace-4.4/linux/syscallent.h 2003-07-16 14:36:22.000000000 -0400
@@ -221,7 +221,12 @@
{ 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo"}, /* 178 */
{ 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" }, /* 179 */
+#ifdef SH
+ { 6, TF, sys_pread, "pread" }, /* 180 */
+ { 6, TF, sys_pwrite, "pwrite" }, /* 181 */
+#else
{ 5, TF, sys_pread, "pread" }, /* 180 */
{ 5, TF, sys_pwrite, "pwrite" }, /* 181 */
+#endif
#ifdef M68K
{ 3, TF, sys_chown, "lchown" }, /* 182 */
--- strace-4.4/linux/mips/syscallent.h.orig 2003-07-16 14:34:24.000000000 -0400
+++ strace-4.4/linux/mips/syscallent.h 2003-07-16 14:34:32.000000000 -0400
@@ -4198,7 +4198,7 @@
{ 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait"},/* 4197 */
{ 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo"},/* 4198 */
{ 2, TS, sys_rt_sigsuspend, "rt_siguspend" }, /* 4199 */
- { 5, TF, sys_pread, "pread" }, /* 4200 */
- { 5, TF, sys_pwrite, "pwrite" }, /* 4201 */
+ { 6, TF, sys_pread, "pread" }, /* 4200 */
+ { 6, TF, sys_pwrite, "pwrite" }, /* 4201 */
{ 3, TF, sys_chown, "chown" }, /* 4202 */
{ 2, TF, sys_getcwd, "getcwd" }, /* 4203 */
More information about the Strace-devel
mailing list