This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Clear *VAL in regcache_raw_read_unsigned
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Yao Qi <qiyaoltc at gmail dot com>, gdb-patches at sourceware dot org
- Date: Thu, 11 Feb 2016 15:15:44 +0000
- Subject: Re: [PATCH] Clear *VAL in regcache_raw_read_unsigned
- Authentication-results: sourceware.org; auth=none
- References: <1455029644-6197-1-git-send-email-yao dot qi at linaro dot org> <86egckqztq dot fsf at gmail dot com> <56BB6ADB dot 6070909 at redhat dot com> <86a8n8qxyp dot fsf at gmail dot com> <56BB7512 dot 2030507 at redhat dot com> <8660xvr1wr dot fsf at gmail dot com> <56BC829B dot 8060102 at redhat dot com>
Pedro Alves <palves@redhat.com> writes:
> uint8_t u8;
> uint16_t u16;
> uint32_t u32;
> uint64_t u64;
>
> switch (size)
> {
> case 1:
> collect_register (regcache, regnum, &u8);
> *val = u8;
> break;
> case 2:
> collect_register (regcache, regnum, &u16);
> *val = u16;
> break;
> case 4:
> collect_register (regcache, regnum, &u32);
> *val = u32;
> break;
> case 8:
> collect_register (regcache, regnum, &u64);
> *val = u64;
> break;
> }
>
> This should work in either endianess, and the '*val = 0' is no longer
> necessary either.
I think this is better than 'make gdbserver use extract_unsigned_integer',
which looks overkill to me.
>
> Or maybe better, just byte the bullet and make gdbserver use
> extract_unsigned_integer, like gdb.
>
> The problem with that is that gdbserver can't currently use 'enum bfd_endian',
> which IIRC, was already an issue in the get-next-pcs stuff. I've attached a
get-next-pcs stuff needs endianness in GDB side. In GDBserver,
endianness is not needed.
> patch series that handles that by moving bfd_endian to a separate header.
> I've pushed it to the users/palves/gdbserver-extract-unsigned-integer branch
> as well.
>
> If you agree with this, I'll run the bfd_endian patch by the binutils folks.
Since the endianness of GDBserver is always identical to the endianness
of the program, I am not sure sharing extract_unsigned_integer between
GDB and GDBserver is necessary.
--
Yao (éå)