This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [01/14] Const-correctness fix - irix5nat.c
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 1 May 2007 03:26:32 +0200 (CEST)
- Subject: [rfc] [01/14] Const-correctness fix - irix5nat.c
Hello,
this patch changes irix5-nat.c fill_ routines to use
regcache_raw_collect instead of regcache_raw_read and
related routines.
Bye,
Ulrich
ChangeLog:
* irix5-nat.c (fill_gregset): Use regcache_raw_collect instead
of regcache_raw_read_signed.
(fill_fpregset): Use regcache_raw_collect instead of
regcache_raw_read.
diff -urNp gdb-orig/gdb/irix5-nat.c gdb-head/gdb/irix5-nat.c
--- gdb-orig/gdb/irix5-nat.c 2007-04-30 23:02:43.239210187 +0200
+++ gdb-head/gdb/irix5-nat.c 2007-05-01 00:00:13.060193421 +0200
@@ -81,9 +81,9 @@ supply_gregset (gregset_t *gregsetp)
void
fill_gregset (gregset_t *gregsetp, int regno)
{
- int regi;
+ int regi, size;
greg_t *regp = &(*gregsetp)[0];
- LONGEST regval;
+ gdb_byte buf[MAX_REGISTER_SIZE];
/* Under Irix6, if GDB is built with N32 ABI and is debugging an O32
executable, we have to sign extend the registers to 64 bits before
@@ -92,37 +92,41 @@ fill_gregset (gregset_t *gregsetp, int r
for (regi = 0; regi <= CTX_RA; regi++)
if ((regno == -1) || (regno == regi))
{
- regcache_raw_read_signed (current_regcache, regi, ®val);
- *(regp + regi) = regval;
+ size = register_size (current_gdbarch, regi);
+ regcache_raw_collect (current_regcache, regi, buf);
+ *(regp + regi) = extract_signed_integer (buf, size);
}
if ((regno == -1) || (regno == PC_REGNUM))
{
- regcache_raw_read_signed
- (current_regcache, mips_regnum (current_gdbarch)->pc, ®val);
- *(regp + CTX_EPC) = regval;
+ regi = mips_regnum (current_gdbarch)->pc;
+ size = register_size (current_gdbarch, regi);
+ regcache_raw_collect (current_regcache, regi, buf);
+ *(regp + CTX_EPC) = extract_signed_integer (buf, size);
}
if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->cause))
{
- regcache_raw_read_signed
- (current_regcache, mips_regnum (current_gdbarch)->cause, ®val);
- *(regp + CTX_CAUSE) = regval;
+ regi = mips_regnum (current_gdbarch)->cause;
+ size = register_size (current_gdbarch, regi);
+ regcache_raw_collect (current_regcache, regi, buf);
+ *(regp + CTX_CAUSE) = extract_signed_integer (buf, size);
}
- if ((regno == -1)
- || (regno == mips_regnum (current_gdbarch)->hi))
- {
- regcache_raw_read_signed
- (current_regcache, mips_regnum (current_gdbarch)->hi, ®val);
- *(regp + CTX_MDHI) = regval;
+ if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->hi))
+ {
+ regi = mips_regnum (current_gdbarch)->hi;
+ size = register_size (current_gdbarch, regi);
+ regcache_raw_collect (current_regcache, regi, buf);
+ *(regp + CTX_MDHI) = extract_signed_integer (buf, size);
}
if ((regno == -1) || (regno == mips_regnum (current_gdbarch)->lo))
{
- regcache_raw_read_signed
- (current_regcache, mips_regnum (current_gdbarch)->lo, ®val);
- *(regp + CTX_MDLO) = regval;
+ regi = mips_regnum (current_gdbarch)->lo;
+ size = register_size (current_gdbarch, regi);
+ regcache_raw_collect (current_regcache, regi, buf);
+ *(regp + CTX_MDLO) = extract_signed_integer (buf, size);
}
}
@@ -178,7 +182,7 @@ fill_fpregset (fpregset_t *fpregsetp, in
if ((regno == -1) || (regno == regi))
{
to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]);
- regcache_raw_read (current_regcache, regi, to);
+ regcache_raw_collect (current_regcache, regi, to);
}
}
@@ -192,9 +196,9 @@ fill_fpregset (fpregset_t *fpregsetp, in
is 32bits long, while the regcache expects a 64bits long buffer.
So we use a buffer of the correct size and copy the register
value from that buffer. */
- regcache_raw_read (current_regcache,
- mips_regnum (current_gdbarch)->fp_control_status,
- fsrbuf);
+ regcache_raw_collect (current_regcache,
+ mips_regnum (current_gdbarch)->fp_control_status,
+ fsrbuf);
memcpy (&fpregsetp->fp_csr, fsrbuf + 4, 4);
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com