aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2000-07-11 05:42:25 +0000
committerAndrew Cagney <cagney@redhat.com>2000-07-11 05:42:25 +0000
commit173155e86672ba4294d2687fe1758137b80b6d61 (patch)
tree2afe9926a7ddf82940e64c4537a08e784bd28fb7 /gdb
parentb71e277823b0b8e12b2f53f6fe77a9b401357407 (diff)
downloadbinutils-173155e86672ba4294d2687fe1758137b80b6d61.zip
binutils-173155e86672ba4294d2687fe1758137b80b6d61.tar.gz
binutils-173155e86672ba4294d2687fe1758137b80b6d61.tar.bz2
Add read_signed_register{,_pid}(). Change return type of
read_register{,_pid}() to ULONGEST.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/regcache.c49
-rw-r--r--gdb/value.h10
3 files changed, 60 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 06d4b1b..fb767fd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+Tue Jul 11 12:52:31 2000 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * value.h (read_register, read_signed_register): Change return
+ type to ULONGEST.
+ (read_signed_register, read_signed_register_pid): Declare.
+
+ * regcache.c (read_register, read_register_pid): Update.
+ (read_signed_register_pid, read_signed_register): New functions.
+
Mon Jul 10 18:06:18 2000 Andrew Cagney <cagney@b1.cygnus.com>
* mips-tdep.c (mips_push_arguments): Always align struct_addr on a
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 3cfafa8..ec64eac 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -497,10 +497,9 @@ write_register_bytes (int myregstart, char *myaddr, int inlen)
/* Return the raw contents of register REGNO, regarding it as an
- integer. This probably should be returning LONGEST rather than
- CORE_ADDR. */
+ UNSIGNED integer. */
-CORE_ADDR
+ULONGEST
read_register (int regno)
{
if (registers_pid != inferior_pid)
@@ -512,12 +511,11 @@ read_register (int regno)
if (!register_valid[regno])
target_fetch_registers (regno);
- return ((CORE_ADDR)
- extract_unsigned_integer (&registers[REGISTER_BYTE (regno)],
+ return (extract_unsigned_integer (&registers[REGISTER_BYTE (regno)],
REGISTER_RAW_SIZE (regno)));
}
-CORE_ADDR
+ULONGEST
read_register_pid (int regno, int pid)
{
int save_pid;
@@ -537,6 +535,45 @@ read_register_pid (int regno, int pid)
return retval;
}
+/* Return the raw contents of register REGNO, regarding it a SIGNED
+ integer. */
+
+LONGEST
+read_signed_register (int regno)
+{
+ if (registers_pid != inferior_pid)
+ {
+ registers_changed ();
+ registers_pid = inferior_pid;
+ }
+
+ if (!register_valid[regno])
+ target_fetch_registers (regno);
+
+ return (extract_signed_integer (&registers[REGISTER_BYTE (regno)],
+ REGISTER_RAW_SIZE (regno)));
+}
+
+LONGEST
+read_signed_register_pid (int regno, int pid)
+{
+ int save_pid;
+ LONGEST retval;
+
+ if (pid == inferior_pid)
+ return read_signed_register (regno);
+
+ save_pid = inferior_pid;
+
+ inferior_pid = pid;
+
+ retval = read_signed_register (regno);
+
+ inferior_pid = save_pid;
+
+ return retval;
+}
+
/* Store VALUE, into the raw contents of register number REGNO. */
void
diff --git a/gdb/value.h b/gdb/value.h
index 95f5a2c..e87582e 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -461,9 +461,15 @@ extern void read_register_gen (int regno, char *myaddr);
extern void write_register_gen (int regno, char *myaddr);
-extern CORE_ADDR read_register (int regno);
+/* Rename to read_unsigned_register()? */
+extern ULONGEST read_register (int regno);
-extern CORE_ADDR read_register_pid (int regno, int pid);
+extern LONGEST read_signed_register (int regno);
+
+/* Rename to read_unsigned_register_pid()? */
+extern ULONGEST read_register_pid (int regno, int pid);
+
+extern LONGEST read_signed_register_pid (int regno, int pid);
extern void write_register (int regno, LONGEST val);