From: Andrew Cagney Date: Tue, 11 Jul 2000 05:42:25 +0000 (+0000) Subject: Add read_signed_register{,_pid}(). Change return type of X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=173155e86672ba4294d2687fe1758137b80b6d61;p=binutils-gdb.git Add read_signed_register{,_pid}(). Change return type of read_register{,_pid}() to ULONGEST. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 06d4b1bb592..fb767fd9202 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +Tue Jul 11 12:52:31 2000 Andrew Cagney + + * 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 * mips-tdep.c (mips_push_arguments): Always align struct_addr on a diff --git a/gdb/regcache.c b/gdb/regcache.c index 3cfafa82d6e..ec64eac8447 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 (®isters[REGISTER_BYTE (regno)], + return (extract_unsigned_integer (®isters[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 (®isters[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 95f5a2c7991..e87582e579c 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);