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

Mike Frysinger vapier at gentoo.org
Sat Nov 10 05:20:34 UTC 2012


On Thursday 08 November 2012 12:36:05 Steve McIntyre wrote:
> The patch looks big due to renaming/moving
> linux/aarch64/syscallent.h to linux/aarch64/syscallent2.h.

you can use the -C -M flags so that the git patch shows the rename.  `git am` 
will apply it correctly (as will patch-2.6.1+).

> To reduce build-time complexity, I've copied in the arm_pt_regs def
> from the ARM system headers; I don't know if people are happy with
> that. Otherwise, building on AArch64 is likely to get harder. :-/

the defs.h logic looks pretty well self-contained.  usually bi-arch systems 
have a structure that magically works, but considering aarch64 is basically a 
new isa, i can see why that isn't happening here.  plus, as i'm sure you've 
already seen in defs.h, other arches have done similar (if not worse) things.

> --- a/syscall.c
> +++ b/syscall.c
>
> +	switch(io.iov_len)
> +	{

cuddle that brace up and add a space before the paren:
	switch (io.iov_len) {

> +		case sizeof(aarch64_regs):
> +			/* We are in 64-bit mode */
> +			memcpy(&aarch64_regs, buf, sizeof(aarch64_regs));
> +			scno = aarch64_regs.regs[8];
> +			update_personality(tcp, 2);
> +			break;
> +		case sizeof(regs):
> +			/* We are in 32-bit mode */
> +			memcpy(&regs, buf, sizeof(regs));
> +			scno = regs.uregs[7];
> +			update_personality(tcp, 0);
> +			break;
> +		default:
> +			return -1;

i see personality 2 and 0 here, but unless i missed some merged code, i don't 
see any setup of personality 1 ...

> +	switch(io.iov_len)
> +	{

same style issue here

> +	if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (void *)&regs) == -1)
> +	{
> +		return -1;
> +	}

drop the braces
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20121110/48e7751f/attachment.bin>


More information about the Strace-devel mailing list