summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2013-05-04 19:51:57 +0000
committerDmitry V. Levin <ldv@altlinux.org>2013-05-04 19:51:57 +0000
commit7a498be266b80b7fef70fe74deed269ae3881525 (patch)
tree110e7d646953c276be71e76e5a16c1ba1283695e
parent80acf62207377f67f3245408e24562ed014358e0 (diff)
downloadstrace-7a498be266b80b7fef70fe74deed269ae3881525.tar.gz
strace-7a498be266b80b7fef70fe74deed269ae3881525.tar.bz2
strace-7a498be266b80b7fef70fe74deed269ae3881525.tar.xz
printxval: support more architectures
* configure.ac: Define SIZEOF_LONG_LONG. * util.c (printllval): Handle all architectures with sizeof(long) > 4 and sizeof(long) == sizeof(long long).
-rw-r--r--configure.ac1
-rw-r--r--util.c38
2 files changed, 16 insertions, 23 deletions
diff --git a/configure.ac b/configure.ac
index 28bf86c..c4896f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -298,6 +298,7 @@ AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
fi)
AC_CHECK_SIZEOF([long])
+AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([rlim_t],,[#include <sys/resource.h>])
AC_CHECK_HEADERS([libaio.h], [
diff --git a/util.c b/util.c
index 83fdf29..970faa4 100644
--- a/util.c
+++ b/util.c
@@ -177,29 +177,26 @@ printxval(const struct xlat *xlat, int val, const char *dflt)
int
printllval(struct tcb *tcp, const char *format, int arg_no)
{
-#if defined(X86_64) || defined(POWERPC64) || defined(TILE) || defined(AARCH64) || \
- defined(LINUX_MIPSN64) || defined(SPARC64)
- if (current_personality == 0) {
- /* Technically, format expects "long long",
- * but we supply "long". We expect that
- * on this arch, they are the same.
- */
+#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+# if SUPPORTED_PERSONALITIES > 1
+ if (current_wordsize > 4) {
+# endif
tprintf(format, tcp->u_arg[arg_no]);
arg_no++;
+# if SUPPORTED_PERSONALITIES > 1
} else {
-# if defined(AARCH64) || defined(POWERPC64)
+# if defined(AARCH64) || defined(POWERPC64)
/* Align arg_no to the next even number. */
arg_no = (arg_no + 1) & 0xe;
-# endif
+# endif
tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
arg_no += 2;
}
-#elif defined IA64 || defined ALPHA || defined S390X
- /* Technically, format expects "long long",
- * but we supply "long". We expect that
- * on this arch, they are the same.
- */
- tprintf(format, tcp->u_arg[arg_no]);
+# endif /* SUPPORTED_PERSONALITIES */
+#elif SIZEOF_LONG > 4
+# error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
+#elif defined LINUX_MIPSN32
+ tprintf(format, tcp->ext_arg[arg_no]);
arg_no++;
#elif defined X32
if (current_personality == 0) {
@@ -209,20 +206,15 @@ printllval(struct tcb *tcp, const char *format, int arg_no)
tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
arg_no += 2;
}
-#elif defined LINUX_MIPSN32
- tprintf(format, tcp->ext_arg[arg_no]);
- arg_no++;
#else
-# if SIZEOF_LONG > 4
-# error BUG: must not combine two args for long long on this arch
-# endif
-#if defined(ARM) || defined(POWERPC)
+# if defined(ARM) || defined(POWERPC)
/* Align arg_no to the next even number. */
arg_no = (arg_no + 1) & 0xe;
-#endif
+# endif
tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
arg_no += 2;
#endif
+
return arg_no;
}