]> granicus.if.org Git - strace/blobdiff - util.c
Update AF_*, PF_*, MSG_*, and TCP_* constants
[strace] / util.c
diff --git a/util.c b/util.c
index 84ab00eb39a8a9042b51b6f261bf13de8fd4d4f6..6acdbc2946805629294e2c43586b12240ed670b3 100644 (file)
--- a/util.c
+++ b/util.c
 # undef pt_all_user_regs
 #endif
 
-/* macros */
-#ifndef MAX
-# define MAX(a,b)              (((a) > (b)) ? (a) : (b))
-#endif
-#ifndef MIN
-# define MIN(a,b)              (((a) < (b)) ? (a) : (b))
-#endif
-
 int
 string_to_uint(const char *str)
 {
@@ -185,39 +177,47 @@ 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)
-       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(POWERPC64)
-               /* Align arg_no to next even number */
+#  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
-       /* 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]);
-       arg_no++;
-#elif defined LINUX_MIPSN32 || defined X32
+# 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) {
+               tprintf(format, tcp->ext_arg[arg_no]);
+               arg_no++;
+       } else {
+               tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
+               arg_no += 2;
+       }
 #else
-# if SIZEOF_LONG > 4
-#  error BUG: must not combine two args for long long on this arch
+# if defined __ARM_EABI__ || \
+     defined LINUX_MIPSO32 || \
+     defined POWERPC || \
+     defined XTENSA
+       /* Align arg_no to the next even number. */
+       arg_no = (arg_no + 1) & 0xe;
 # endif
        tprintf(format, LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]));
        arg_no += 2;
 #endif
+
        return arg_no;
 }
 
@@ -1401,6 +1401,9 @@ change_syscall(struct tcb *tcp, arg_setup_state *state, int new)
 #elif defined(METAG)
        /* setbpt/clearbpt never used: */
        /* Meta is only supported since linux-3.7 */
+#elif defined(XTENSA)
+       /* setbpt/clearbpt never used: */
+       /* Xtensa is only supported since linux 2.6.13 */
 #else
 #warning Do not know how to handle change_syscall for this architecture
 #endif /* architecture */