Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH/RFA] regcache_raw_write_signed and regcache_raw_write_unsigned
@ 2002-08-24  8:27 Mark Kettenis
  2002-08-24 18:31 ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Kettenis @ 2002-08-24  8:27 UTC (permalink / raw)
  To: gdb-patches

To supplement regcache_raw_read_signed and regcache_raw_read_unsigned.
They would be might convenient for me as a replacement for
write_register.

OK to check this in?

Mark

Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* regcache.c (regcache_raw_write_signed,
	regcache_raw_write_unsigned): New functions.
	* regcache.h (regcache_raw_write_signed,
	regcache_raw_write_unsigned): New prototypes.

Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.54
diff -u -p -r1.54 regcache.c
--- regcache.c 19 Aug 2002 00:43:41 -0000 1.54
+++ regcache.c 24 Aug 2002 15:00:26 -0000
@@ -693,6 +693,29 @@ regcache_raw_read_unsigned (struct regca
 }
 
 void
+regcache_raw_write_signed (struct regcache *regcache, int regnum, LONGEST val)
+{
+  void *buf;
+  gdb_assert (regcache != NULL);
+  gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers);
+  buf = alloca (regcache->descr->sizeof_register[regnum]);
+  store_signed_integer (buf, regcache->descr->sizeof_register[regnum], val);
+  regcache_raw_write (regcache, regnum, buf);
+}
+
+void
+regcache_raw_write_unsigned (struct regcache *regcache, int regnum,
+			     ULONGEST val)
+{
+  void *buf;
+  gdb_assert (regcache != NULL);
+  gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers);
+  buf = alloca (regcache->descr->sizeof_register[regnum]);
+  store_unsigned_integer (buf, regcache->descr->sizeof_register[regnum], val);
+  regcache_raw_write (regcache, regnum, buf);
+}
+
+void
 read_register_gen (int regnum, char *buf)
 {
   gdb_assert (current_regcache != NULL);
Index: regcache.h
===================================================================
RCS file: /cvs/src/src/gdb/regcache.h,v
retrieving revision 1.15
diff -u -p -r1.15 regcache.h
--- regcache.h 19 Aug 2002 00:43:41 -0000 1.15
+++ regcache.h 24 Aug 2002 15:00:26 -0000
@@ -42,6 +42,10 @@ extern void regcache_raw_read_signed (st
 				      int regnum, LONGEST *val);
 extern void regcache_raw_read_unsigned (struct regcache *regcache,
 					int regnum, ULONGEST *val);
+extern void regcache_raw_write_signed (struct regcache *regcache,
+				       int regnum, LONGEST val);
+extern void regcache_raw_write_unsigned (struct regcache *regcache,
+					 int regnum, ULONGEST val);
 
 /* Partial transfer of a raw registers.  These perform read, modify,
    write style operations.  */


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-08-25 23:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-24  8:27 [PATCH/RFA] regcache_raw_write_signed and regcache_raw_write_unsigned Mark Kettenis
2002-08-24 18:31 ` Andrew Cagney
2002-08-25 22:02   ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox