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

Denys Vlasenko dvlasenk at redhat.com
Tue Feb 5 14:40:33 UTC 2013


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.

-- 
vda






More information about the Strace-devel mailing list