diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-03-12 20:50:13 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-03-12 20:50:13 +0000 |
commit | a66a9c23319105b23198e91be27a2e2f442f4671 (patch) | |
tree | c85c046acdb57ad31f483bbaddc62168b96fe953 | |
parent | 3db0a37f8001da3a43a4423be783de7101251ea3 (diff) | |
download | gdb-a66a9c23319105b23198e91be27a2e2f442f4671.zip gdb-a66a9c23319105b23198e91be27a2e2f442f4671.tar.gz gdb-a66a9c23319105b23198e91be27a2e2f442f4671.tar.bz2 |
2003-03-12 Andrew Cagney <cagney@redhat.com>
* regcache.c (regcache_cooked_write_signed): New function.
(regcache_cooked_write_unsigned): New function.
(regcache_cooked_read_unsigned): Fix regnum in range assertion.
(regcache_cooked_read_signed): Fix regnum in range assertion.
* regcache.h (regcache_cooked_write_signed): Declare.
(regcache_cooked_write_unsigned): Declare.
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/regcache.c | 28 | ||||
-rw-r--r-- | gdb/regcache.h | 4 |
3 files changed, 39 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1747b47..204c20c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,14 @@ 2003-03-12 Andrew Cagney <cagney@redhat.com> + * regcache.c (regcache_cooked_write_signed): New function. + (regcache_cooked_write_unsigned): New function. + (regcache_cooked_read_unsigned): Fix regnum in range assertion. + (regcache_cooked_read_signed): Fix regnum in range assertion. + * regcache.h (regcache_cooked_write_signed): Declare. + (regcache_cooked_write_unsigned): Declare. + +2003-03-12 Andrew Cagney <cagney@redhat.com> + * gdbarch.sh (DEPRECATED_FRAME_SAVED_PC): Replace FRAME_SAVED_PC. * gdbarch.h, gdbarch.c: Re-generate. * xstormy16-tdep.c (xstormy16_gdbarch_init): Update. diff --git a/gdb/regcache.c b/gdb/regcache.c index 5475cf68..c669017 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -884,7 +884,7 @@ regcache_cooked_read_signed (struct regcache *regcache, int regnum, { char *buf; gdb_assert (regcache != NULL); - gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); + gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers); buf = alloca (regcache->descr->sizeof_register[regnum]); regcache_cooked_read (regcache, regnum, buf); (*val) = extract_signed_integer (buf, @@ -897,13 +897,37 @@ regcache_cooked_read_unsigned (struct regcache *regcache, int regnum, { char *buf; gdb_assert (regcache != NULL); - gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); + gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers); buf = alloca (regcache->descr->sizeof_register[regnum]); regcache_cooked_read (regcache, regnum, buf); (*val) = extract_unsigned_integer (buf, regcache->descr->sizeof_register[regnum]); } +void +regcache_cooked_write_signed (struct regcache *regcache, int regnum, + LONGEST val) +{ + void *buf; + gdb_assert (regcache != NULL); + gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers); + buf = alloca (regcache->descr->sizeof_register[regnum]); + store_signed_integer (buf, regcache->descr->sizeof_register[regnum], val); + regcache_cooked_write (regcache, regnum, buf); +} + +void +regcache_cooked_write_unsigned (struct regcache *regcache, int regnum, + ULONGEST val) +{ + void *buf; + gdb_assert (regcache != NULL); + gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers); + buf = alloca (regcache->descr->sizeof_register[regnum]); + store_unsigned_integer (buf, regcache->descr->sizeof_register[regnum], val); + regcache_cooked_write (regcache, regnum, buf); +} + /* Write register REGNUM at MYADDR to the target. MYADDR points at REGISTER_RAW_BYTES(REGNUM), which must be in target byte-order. */ diff --git a/gdb/regcache.h b/gdb/regcache.h index dd62938..bc9757e 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -75,6 +75,10 @@ extern void regcache_cooked_read_signed (struct regcache *regcache, int regnum, LONGEST *val); extern void regcache_cooked_read_unsigned (struct regcache *regcache, int regnum, ULONGEST *val); +extern void regcache_cooked_write_signed (struct regcache *regcache, + int regnum, LONGEST val); +extern void regcache_cooked_write_unsigned (struct regcache *regcache, + int regnum, ULONGEST val); /* Partial transfer of a cooked register. These perform read, modify, write style operations. */ |