Add regcache_map_supplies helper routine.
This helper can be used in the fetch_registers and store_registers target methods to determine if a register set includes a specific register.
This commit is contained in:
parent
3a76f8f489
commit
30a696c543
2 changed files with 36 additions and 0 deletions
|
@ -1264,6 +1264,33 @@ regcache::collect_regset (const struct regset *regset,
|
||||||
transfer_regset (regset, nullptr, regnum, nullptr, (gdb_byte *) buf, size);
|
transfer_regset (regset, nullptr, regnum, nullptr, (gdb_byte *) buf, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See regcache.h */
|
||||||
|
|
||||||
|
bool
|
||||||
|
regcache_map_supplies (const struct regcache_map_entry *map, int regnum,
|
||||||
|
struct gdbarch *gdbarch, size_t size)
|
||||||
|
{
|
||||||
|
int offs = 0, count;
|
||||||
|
|
||||||
|
for (; (count = map->count) != 0; map++)
|
||||||
|
{
|
||||||
|
int regno = map->regno;
|
||||||
|
int slot_size = map->size;
|
||||||
|
|
||||||
|
if (slot_size == 0 && regno != REGCACHE_MAP_SKIP)
|
||||||
|
slot_size = register_size (gdbarch, regno);
|
||||||
|
|
||||||
|
if (regno != REGCACHE_MAP_SKIP && regnum >= regno
|
||||||
|
&& regnum < regno + count)
|
||||||
|
return offs + (regnum - regno + 1) * slot_size <= size;
|
||||||
|
|
||||||
|
offs += count * slot_size;
|
||||||
|
if (offs >= size)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* See gdbsupport/common-regcache.h. */
|
/* See gdbsupport/common-regcache.h. */
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -150,6 +150,15 @@ extern void regcache_collect_regset (const struct regset *regset,
|
||||||
int regnum, void *buf, size_t size);
|
int regnum, void *buf, size_t size);
|
||||||
|
|
||||||
|
|
||||||
|
/* Return true if a set of registers contains the value of the
|
||||||
|
register numbered REGNUM. The size of the set of registers is
|
||||||
|
given in SIZE, and the layout of the set of registers is described
|
||||||
|
by MAP. */
|
||||||
|
|
||||||
|
extern bool regcache_map_supplies (const struct regcache_map_entry *map,
|
||||||
|
int regnum, struct gdbarch *gdbarch,
|
||||||
|
size_t size);
|
||||||
|
|
||||||
/* The type of a register. This function is slightly more efficient
|
/* The type of a register. This function is slightly more efficient
|
||||||
then its gdbarch vector counterpart since it returns a precomputed
|
then its gdbarch vector counterpart since it returns a precomputed
|
||||||
value stored in a table. */
|
value stored in a table. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue