Re: sparc gdbserver bug? (Re: [RFA] handle android bionic ptrace in gdbserver.)

H.J. Lu
2012-03-29T17:23:10Z

On Thu, Mar 29, 2012 at 10:02 AM, Pedro Alves <palves@redhat.com> wrote:
> On 03/28/2012 01:26 AM, Thiago Jung Bauermann wrote:
>
>>  #ifndef __sparc__
>> -      res = ptrace (regset->get_request, pid, nt_type, data);
>> +      res = ptrace (regset->get_request, pid,
>> +                 (PTRACE_ARG3_TYPE) nt_type, data);
>>  #else
>>        res = ptrace (regset->get_request, pid, &iov, data);
>>  #endif
>
>
> BTW, I notice the __sparc__ branch here appears to be broken?
> (sparc has the last two ptrace arguments reversed...).
>
>  $ git show d0aa472c
>  commit d0aa472c6770baccb29dc37d0e64a81afda99911
>  Author: H.J. Lu <hjl.tools@gmail.com>
>  Date:   Wed Apr 7 18:49:43 2010 +0000
>
>     Add x86 AVX support to gdbserver.
>  ...
>
>  +
>  +      nt_type = regset->nt_type;
>  +      if (nt_type)
>  +       {
>  +         iov.iov_base = buf;
>  +         iov.iov_len = regset->size;
>  +         data = (void *) &iov;
>  +       }
>  +      else
>  +       data = buf;
>  +
>  #ifndef __sparc__
>  -      res = ptrace (regset->get_request, pid, 0, buf);
>  +      res = ptrace (regset->get_request, pid, nt_type, data);
>  #else
>  -      res = ptrace (regset->get_request, pid, buf, 0);
>  +      res = ptrace (regset->get_request, pid, &iov, data);
>  #endif
>
> I think that should have ended up with:
>
>  #ifndef __sparc__
>       res = ptrace (regset->get_request, pid, nt_type, data);
>  #else
>       res = ptrace (regset->get_request, pid, data, nt_type);
>  #endif
>

It may be a typo for sparc branch.

--
H.J.