[GSOC 2014][PATCH] Add arch dependent file autil.c

Edson xcr33d at gmail.com
Thu Jun 26 18:12:31 UTC 2014


---
 Makefile.am |  3 ++-
 defs.h      | 11 ++++++-----
 util.c      | 54 ------------------------------------------------------
 3 files changed, 8 insertions(+), 60 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index a789b8c..94aec57 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -50,7 +50,8 @@ strace_SOURCES =	\
 	term.c		\
 	time.c		\
 	util.c		\
-	vsprintf.c
+	vsprintf.c	\
+	linux/$(ARCH)/autil.c
 
 noinst_HEADERS = defs.h
 # Enable this to get link map generated
diff --git a/defs.h b/defs.h
index 4e06a92..b90dfae 100644
--- a/defs.h
+++ b/defs.h
@@ -647,11 +647,7 @@ extern int next_set_bit(const void *bit_array, unsigned cur_bit, unsigned size_b
 # define LONG_LONG(a,b) \
 	((long long)((unsigned long long)(unsigned)(b) | ((unsigned long long)(a)<<32)))
 #endif
-extern int printllval(struct tcb *, const char *, int, bool);
-#define printllval_aligned(tcp, fmt, arg)	\
-	printllval((tcp), (fmt), (arg), true)
-#define printllval_unaligned(tcp, fmt, arg)	\
-	printllval((tcp), (fmt), (arg), false)
+/*extern int printllval(struct tcb *, const char *, int, bool);*/
 
 extern void printxval(const struct xlat *, int, const char *);
 extern int printargs(struct tcb *);
@@ -804,3 +800,8 @@ extern unsigned num_quals;
 /* Only ensures that sysent[scno] isn't out of range */
 #define SCNO_IN_RANGE(scno) \
 	((unsigned long)(scno) < nsyscalls)
+#define printllval_aligned(tcp, fmt, arg)	\
+	printllval((tcp), (fmt), (arg), true)
+#define printllval_unaligned(tcp, fmt, arg)	\
+	printllval((tcp), (fmt), (arg), false)
+
diff --git a/util.c b/util.c
index ff18b87..ea9ada8 100644
--- a/util.c
+++ b/util.c
@@ -220,60 +220,6 @@ printxval(const struct xlat *xlat, int val, const char *dflt)
 		tprintf("%#x /* %s */", val, dflt);
 }
 
-/*
- * Print 64bit argument at position arg_no and return the index of the next
- * argument.
- */
-int
-printllval(struct tcb *tcp, const char *format, int arg_no, bool align)
-{
-#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 (align) {
-			/* 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 /* 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 defined __ARM_EABI__ || \
-     defined LINUX_MIPSO32 || \
-     defined POWERPC || \
-     defined XTENSA
-	if (align) {
-		/* 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;
-}
 
 /*
  * Interpret `xlat' as an array of flags
-- 
1.8.4





More information about the Strace-devel mailing list