On Thu, 2008-12-04 at 05:06 +0300, Dmitry V. Levin wrote:
> 2008-11-13 Kirill A. Shutemov <[EMAIL PROTECTED]>
>
> Fix compilation warnings on ARM.
> * signal.c (sys_sigreturn) [ARM]: Fix cast.
> * syscall.c (decode_subcall) Do not define on ARM EABI.
> (get_scno) [ARM]: Fix cast.
> (syscall_fixup, syscall_enter): Do not define pid variable on ARM.
>
> --- signal.c
> +++ signal.c
> @@ -1242,7 +1242,7 @@ struct tcb *tcp;
> if (entering(tcp)) {
> tcp->u_arg[0] = 0;
>
> - if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (void *)®s) == -1)
> + if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (unsigned
> long)®s) == -1)
1. Why? I am sure whoever will read this code later won't
understand why it is cast to long, not ptr.
2. Can we somehow make it so that we can ensure proper casts
on all ptrace calls at once?
> return 0;
>
> if (umove(tcp, regs.ARM_sp, &sc) < 0)
> --- syscall.c
> +++ syscall.c
> @@ -582,7 +582,7 @@ static const struct subcall subcalls_table[] = {
> };
> #endif /* FREEBSD */
>
> -#if !(defined(LINUX) && ( defined(ALPHA) || defined(MIPS) ))
> +#if !(defined(LINUX) && ( defined(ALPHA) || defined(MIPS) ||
> defined(__ARM_EABI__) ))
>
> static void
> decode_subcall(tcp, subcall, nsubcalls, style)
> @@ -1006,7 +1006,7 @@ struct tcb *tcp;
> /*
> * Read complete register set in one go.
> */
> - if (ptrace(PTRACE_GETREGS, pid, NULL, (void *)®s) == -1)
> + if (ptrace(PTRACE_GETREGS, pid, NULL, (unsigned long)®s) == -1)
> return -1;
>
> /*
> @@ -1034,7 +1034,7 @@ struct tcb *tcp;
> * Get the ARM-mode system call number
> */
> errno = 0;
> - scno = ptrace(PTRACE_PEEKTEXT, pid, (void
> *)(regs.ARM_pc - 4), NULL);
> + scno = ptrace(PTRACE_PEEKTEXT, pid, (void
> *)(regs.ARM_pc - 4), 0);
Why is it better? If anything, it has bigger chances to be wrong,
int can be narrower than long or void*, if kernel would fetch
3rd param as long, it might end up != 0 (on some arches).
--
vda
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel