summaryrefslogtreecommitdiff
path: root/mem.c
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-08-23 17:51:58 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2011-08-23 17:51:58 +0200
commitd5e66c4b971c7f2480d2ff37eb06038cda517b6f (patch)
tree6c494ce197655b6423737484ad3df30ed8268d78 /mem.c
parent4b887a5a9a9892f064b238c8672fb89f42c8d5e0 (diff)
downloadstrace-d5e66c4b971c7f2480d2ff37eb06038cda517b6f.tar.gz
strace-d5e66c4b971c7f2480d2ff37eb06038cda517b6f.tar.bz2
strace-d5e66c4b971c7f2480d2ff37eb06038cda517b6f.tar.xz
Fix argument printing in sys_mmap64
* mem.c (sys_mmap64): Fix a bug where we used tcp->u_args[i] instead of argument values copied from memory. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'mem.c')
-rw-r--r--mem.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/mem.c b/mem.c
index 7ae8b5c..763bea1 100644
--- a/mem.c
+++ b/mem.c
@@ -334,6 +334,11 @@ sys_mmap(struct tcb *tcp)
#endif /* !HAVE_LONG_LONG_OFF_T */
#if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
+/* TODO: comment which arches use this routine.
+ * For one, does ALPHA on Linux use this??
+ * From code it seems that it might use 7 or 8 registers,
+ * which is strange - Linux syscalls can pass maximum of 6 parameters!
+ */
int
sys_mmap64(struct tcb *tcp)
{
@@ -362,12 +367,17 @@ sys_mmap64(struct tcb *tcp)
#endif
/* fd */
tprintf(", ");
- /* BUG?! should be u_arg[4] (without tcp->)? */
- printfd(tcp, tcp->u_arg[4]);
+ printfd(tcp, u_arg[4]);
/* offset */
- /* BUG?! on non-ALPHA linux, offset will be not in tcp->u_arg,
- * but in local u_arg, but printllval prints tcp->u_arg! */
+#if !defined(LINUX) || defined(ALPHA)
printllval(tcp, ", %#llx", 5);
+#else
+ /* NOTE: not verified that [5] and [6] should be used.
+ * It's possible that long long is 64-bit aligned in memory
+ * and we need to use [6] and [7] here instead:
+ */
+ tprintf(", %#llx", LONG_LONG(u_arg[5], u_arg[6]));
+#endif
}
return RVAL_HEX;
}