Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@chello.nl>
To: gdb-patches@sources.redhat.com
Subject: [PATCH/RFA] regcache_raw_write_signed and regcache_raw_write_unsigned
Date: Sat, 24 Aug 2002 08:27:00 -0000	[thread overview]
Message-ID: <200208241505.g7OF51ma070689@elgar.kettenis.dyndns.org> (raw)

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.  */


             reply	other threads:[~2002-08-24 15:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-24  8:27 Mark Kettenis [this message]
2002-08-24 18:31 ` Andrew Cagney
2002-08-25 22:02   ` Mark Kettenis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200208241505.g7OF51ma070689@elgar.kettenis.dyndns.org \
    --to=kettenis@chello.nl \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox