This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] ppc64le/gdbserver: Fix ppc_collect/supply_ptrace_register() routines


Sergio Durigan Junior wrote:
> On Friday, September 05 2014, Edjunior Barbosa Machado wrote:
> > gdb/gdbserver/
> > 2014-09-05  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>
> >
> > 	* linux-ppc-low.c (ppc_collect_ptrace_register): Adjust routine to take
> > 	endianness into account.
> > 	(ppc_supply_ptrace_register): Likewise.

> > +  if (__BYTE_ORDER == __LITTLE_ENDIAN)
> 
> Why not use gdbarch_byte_order here?  We don't use __BYTE_ORDER anywhere
> in the code.

Well, this is gdbserver code, so there is no gdbarch ...

In gdbserver, we usually check for host properties, so the above check
seems fine to me.

> Same applies for this chunk.
> 
> Otherwise, looks good (it's not an approval).

I agree with the rest of Sergio's comments.

However, there is one additional problem:

>+      /* Big-endian values sit at the right end of the buffer. In case of
>+         registers whose size is smaller than sizeof (long), we must use a
>+         padding to access it correctly.  */
>+      int padding = (sizeof (long) - register_size (regcache->tdesc, regno));
>+      collect_register (regcache, regno, buf + padding);

This will be wrong for registers larger than "long", e.g. vector registers.
The old code handled them correctly, but this new code does not.


Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]