Update AArch64 strace to also support tracing 32-bit ARM binaries
Steve McIntyre
steve.mcintyre at linaro.org
Tue Feb 12 13:47:35 UTC 2013
On Tue, Feb 05, 2013 at 05:02:34PM +0100, Denys Vlasenko wrote:
>> @@ -1655,16 +1681,31 @@ get_syscall_result(struct tcb *tcp)
>> return -1;
>> if (upeek(tcp, PT_R10, &r10) < 0)
>> return -1;
>> -#elif defined(ARM)
>> - /* Read complete register set in one go. */
>> - if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (void *)®s) == -1)
>> - return -1;
>> #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(®s, buf, sizeof(regs));
>> + update_personality(tcp, 0);
>> + break;
>> + default:
>> + return -1;
>> + }
>
>No other architecture calls update_personality() on syscall exit
>(get_syscall_result() is called, naturally, only on exit).
>
>I think these update_personality() calls can be safely removed.
Hmmm, maybe. I've possibly got a belt-and-braces solution there. It
made sense to me at the time, but that was quite a while ago now. :-)
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