[RFC,05/23] X86: Replace regset_alloc() invocations by static regset structures.
Commit Message
On Mon, Apr 28 2014, Mark Kettenis wrote:
>> From: Andreas Arnez <arnez@linux.vnet.ibm.com>
>> Date: Mon, 28 Apr 2014 11:47:03 +0200
>>
>> diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c
>> index c5ed731..e7041c9 100644
>> --- a/gdb/amd64obsd-tdep.c
>> +++ b/gdb/amd64obsd-tdep.c
>> @@ -49,11 +49,17 @@ amd64obsd_supply_regset (const struct regset *regset,
>>
>> gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE);
>>
>> - i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset);
>> + i386_gregset.supply_regset (regset, regcache, regnum, regs,
>> + tdep->sizeof_gregset);
>
> I'm not too happy with the additional level of indirection you're
> introducing here. Don't particularly see the need to do this...
Sure, I can keep i386_supply_gregset as a global function, if you
prefer. I'll adjust [RFC 05/23] by the patch below. OK?
--
@@ -49,8 +49,7 @@ amd64obsd_supply_regset (const struct regset *regset,
gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE);
- i386_gregset.supply_regset (regset, regcache, regnum, regs,
- tdep->sizeof_gregset);
+ i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset);
amd64_supply_fxsave (regcache, regnum,
((const gdb_byte *)regs) + tdep->sizeof_gregset);
}
@@ -3720,7 +3720,7 @@ i386_value_to_register (struct frame_info *frame, int regnum,
in the general-purpose register set REGSET to register cache
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
-static void
+void
i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
@@ -377,6 +377,13 @@ extern int i386_sigtramp_p (struct frame_info *this_frame);
extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
struct reggroup *group);
+/* Supply register REGNUM from the general-purpose register set REGSET
+ to register cache REGCACHE. If REGNUM is -1, do this for all
+ registers in REGSET. */
+extern void i386_supply_gregset (const struct regset *regset,
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len);
+
/* General-purpose register set. */
extern const struct regset i386_gregset;
@@ -147,8 +147,7 @@ i386obsd_aout_supply_regset (const struct regset *regset,
gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE);
- i386_gregset.supply_regset (regset, regcache, regnum, regs,
- tdep->sizeof_gregset);
+ i386_supply_gregset (regset, regcache, regnum, regs, tdep->sizeof_gregset);
i387_supply_fsave (regcache, regnum, gregs + tdep->sizeof_gregset);
}