diff options
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/regcache.c | 12 | ||||
-rw-r--r-- | gdb/regcache.h | 6 |
3 files changed, 25 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e373459..0fe8b83 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2002-08-25 Andrew Cagney <ac131313@redhat.com> + + * regcache.c (max_register_size): New function. + (init_legacy_regcache_descr): Ensure that max_register_size is + large enough for REGISTER_VIRTUAL_SIZE. + * regcache.h (max_register_size): Declare. + 2002-08-24 Andrew Cagney <ac131313@redhat.com> * rs6000-tdep.c (rs6000_gdbarch_init): Use deprecated version of diff --git a/gdb/regcache.c b/gdb/regcache.c index e483de0..384df40 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -112,6 +112,8 @@ init_legacy_regcache_descr (struct gdbarch *gdbarch) descr->sizeof_register[i] = REGISTER_RAW_SIZE (i); if (descr->max_register_size < REGISTER_RAW_SIZE (i)) descr->max_register_size = REGISTER_RAW_SIZE (i); + if (descr->max_register_size < REGISTER_VIRTUAL_SIZE (i)) + descr->max_register_size = REGISTER_VIRTUAL_SIZE (i); } /* Come up with the real size of the registers buffer. */ @@ -239,6 +241,16 @@ xfree_regcache_descr (struct gdbarch *gdbarch, void *ptr) xfree (descr); } +/* Utility functions returning useful register attributes stored in + the regcache descr. */ + +int +max_register_size (struct gdbarch *gdbarch) +{ + struct regcache_descr *descr = regcache_descr (gdbarch); + return descr->max_register_size; +} + /* The register cache for storing raw register values. */ struct regcache diff --git a/gdb/regcache.h b/gdb/regcache.h index da91fd6..6af729a 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -88,6 +88,12 @@ extern void supply_register (int regnum, const void *val); extern void regcache_collect (int regnum, void *buf); +/* Return the size of the largest register. Used when allocating + space for an aribtrary register value. */ + +extern int max_register_size (struct gdbarch *gdbarch); + + /* DEPRECATED: Character array containing an image of the inferior programs' registers for the most recently referenced thread. */ |