This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 02/13] regcache: Add functions suitable for regset_supply/collect.
- From: Omair Javaid <omair dot javaid at linaro dot org>
- To: Andreas Arnez <arnez at linux dot vnet dot ibm dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, Yao Qi <yao at codesourcery dot com>, Mark Kettenis <kettenis at gnu dot org>
- Date: Sat, 19 Jul 2014 14:17:23 +0500
- Subject: Re: [PATCH v2 02/13] regcache: Add functions suitable for regset_supply/collect.
- Authentication-results: sourceware.org; auth=none
- References: <1403714949-28133-1-git-send-email-arnez at linux dot vnet dot ibm dot com> <1403714949-28133-3-git-send-email-arnez at linux dot vnet dot ibm dot com> <CANW4E-0cEaQ=DLN5SVjWtCiHCK5iDDqUFnEgKbACig+pe4pW_A at mail dot gmail dot com> <87lhs4f5ng dot fsf at br87z6lw dot de dot ibm dot com> <CANW4E-3S6+JApYt=uNiznJQOxDU=B54zXVyf0L0N2JuLpJKrMQ at mail dot gmail dot com> <87ha2pfy3m dot fsf at br87z6lw dot de dot ibm dot com>
On 10 July 2014 12:54, Andreas Arnez <arnez@linux.vnet.ibm.com> wrote:
> On Tue, Jul 08 2014, Omair Javaid wrote:
>
>> I think you are right its better off if we leave the single register
>> variants to target specific *-tdep where they can be retrieved using
>> regcache_raw_ supply/collect functions. All other options to get
>> around the loops wont be trivial.
>
> Hm, I'd actually prefer if the new functions could be used for any
> case where registers are supplied to the regcache from a buffer, or
> collected from the regcache to a buffer.
>
> Which variants do you mean? Do you have examples where they are used?
>
Here's one implementation I saw for PPC, this is done for rs6000-tdep.c
ppc_supply_reg (struct regcache *regcache, int regnum,
const gdb_byte *regs, size_t offset, int regsize)
{
if (regnum != -1 && offset != -1)
{
if (regsize > 4)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
int gdb_regsize = register_size (gdbarch, regnum);
if (gdb_regsize < regsize
&& gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
offset += regsize - gdb_regsize;
}
regcache_raw_supply (regcache, regnum, regs + offset);
}
}
But I agree that its better the way its been done already.