[PATCH] Factor out printing of 64bit syscall argument

Dmitry V. Levin ldv at altlinux.org
Wed Nov 4 15:52:50 UTC 2009


On Wed, Nov 04, 2009 at 12:55:46PM +0100, Andreas Schwab wrote:
> This patch refactors the printing of 64bit syscall arguments.

I like the change, but I have two questions about particular hunks of
the patch.

> @@ -631,7 +625,6 @@ sys_lseek64(struct tcb *tcp)
>  {
>  	if (entering(tcp)) {
>  		long long offset;
> -		ALIGN64 (tcp, 1);	/* FreeBSD aligns off_t args */
>  		offset = LONG_LONG(tcp->u_arg [1], tcp->u_arg[2]);
>  		if (tcp->u_arg[3] == SEEK_SET)
>  			tprintf("%ld, %llu, ", tcp->u_arg[0], offset);

Why printllval() is not used here?

> @@ -2836,22 +2822,14 @@ int
>  sys_fadvise64_64(struct tcb *tcp)
>  {
>  	if (entering(tcp)) {
> -		tprintf("%ld, %lld, %lld, ",
> -			tcp->u_arg[0],
> -#if defined LINUX_MIPSN32
> -			tcp->ext_arg[1], tcp->ext_arg[2]);
> -		printxval(advise, tcp->u_arg[3], "POSIX_FADV_???");
> -#elif defined IA64 || defined X86_64 || defined ALPHA || defined LINUX_MIPSN64
> -			(long long int) tcp->u_arg[1], (long long int) tcp->u_arg[2]);
> -		printxval(advise, tcp->u_arg[3], "POSIX_FADV_???");
> -#elif defined ARM || defined POWERPC
> -			LONG_LONG(tcp->u_arg[2], tcp->u_arg[3]),
> -			LONG_LONG(tcp->u_arg[4], tcp->u_arg[5]));
> +		int argn;
> +		tprintf("%ld, ", tcp->u_arg[0]);
> +		argn = printllval(tcp, "%lld, ", 1);
> +		argn = printllval(tcp, "%lld, ", argn);
> +#if defined ARM || defined POWERPC
>  		printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
>  #else
> -			LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]),
> -			LONG_LONG(tcp->u_arg[3], tcp->u_arg[4]));
> -		printxval(advise, tcp->u_arg[5], "POSIX_FADV_???");
> +		printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
>  #endif
>  	}
>  	return 0;

I'm afraid that this change breaks ARM because printxval() does no
special handling for ARM.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20091104/21ffc852/attachment.bin>


More information about the Strace-devel mailing list