Update AArch64 strace to also support tracing 32-bit ARM binaries

Steve McIntyre steve.mcintyre at linaro.org
Tue Feb 12 13:45:59 UTC 2013


On Tue, Feb 05, 2013 at 03:40:33PM +0100, Denys Vlasenko wrote:
>On 11/10/2012 12:24 PM, Steve McIntyre wrote:
>>  #elif defined(AARCH64)
>>  	struct iovec io;
>> -	io.iov_base = ®s;
>> -	io.iov_len = sizeof(regs);
>> +	char buf[sizeof(aarch64_regs)];
>> +	io.iov_base = &buf;
>> +	io.iov_len = sizeof(aarch64_regs);
>>  	if (ptrace(PTRACE_GETREGSET, tcp->pid, NT_PRSTATUS, (void *)&io) == -1)
>>  		return -1;
>> +	switch (io.iov_len) {
>> +		case sizeof(aarch64_regs):
>> +			/* We are in 64-bit mode */		
>> +			memcpy(&aarch64_regs, buf, sizeof(aarch64_regs));
>> +			update_personality(tcp, 1);
>> +			break;
>> +		case sizeof(regs):
>> +			/* We are in 32-bit mode */		
>> +			memcpy(&regs, buf, sizeof(regs));
>> +			update_personality(tcp, 0);
>> +			break;
>> +		default:
>> +			return -1;
>> +	}
>
>You can eliminate buf[] and one memcpy if you'll set io.iov_base = aarch64_regs.

True, yes.

Cheers,
-- 
Steve McIntyre                                steve.mcintyre at linaro.org
<http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs





More information about the Strace-devel mailing list