[PATCH] Factor out printing of 64bit syscall argument

Andreas Schwab schwab at redhat.com
Wed Nov 4 16:01:31 UTC 2009


"Dmitry V. Levin" <ldv-u2l5PoMzF/Vg9hUCZPvPmw at public.gmane.org> writes:

> 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?

Accidentally dropped the ball 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.

I guess you mean printllval?  Yes, that breaks ARM.

Andreas.

-- 
Andreas Schwab, schwab at redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."




More information about the Strace-devel mailing list