2003-03-12 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Wed, 12 Mar 2003 20:50:13 +0000 (20:50 +0000)
committerAndrew Cagney <cagney@redhat.com>
Wed, 12 Mar 2003 20:50:13 +0000 (20:50 +0000)
* 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.

gdb/ChangeLog
gdb/regcache.c
gdb/regcache.h

index 1747b473fe4f86c8b10cb45f43883e3fa1976621..204c20cb57ad62666d76df105facf78ea8e97937 100644 (file)
@@ -1,3 +1,12 @@
+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.
index 5475cf681ef24a6a724c68ecbc94b5c8129b2bba..c66901780aedc5ad54e7a5f13cd63307fe671ea6 100644 (file)
@@ -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.  */
 
index dd629383bebe1b00dad3662ab7d6ef21fe028a06..bc9757e1d5a8f534fe0a7aecbf5f1d05c2d299ea 100644 (file)
@@ -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.  */