This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [02/14] Const-correctness fix - m32r-linux-nat.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:55 +0200 (CEST)
- Subject: [rfc] [02/14] Const-correctness fix - m32r-linux-nat.c
Hello,
this patch stops m32r-linux-nat.c supply_gregset from modifying
the contents of the register set pointed to by GREGSETP.
Bye,
Ulrich
ChangeLog:
* m32r-linux-nat.c (supply_gregset): Do not modify contents
pointed to by GREGSETP.
diff -urNp gdb-orig/gdb/m32r-linux-nat.c gdb-head/gdb/m32r-linux-nat.c
--- gdb-orig/gdb/m32r-linux-nat.c 2007-04-30 23:02:43.290202950 +0200
+++ gdb-head/gdb/m32r-linux-nat.c 2007-05-01 00:03:24.346158041 +0200
@@ -80,19 +80,23 @@ supply_gregset (elf_gregset_t * gregsetp
for (i = 0; i < M32R_LINUX_NUM_REGS; i++)
{
+ elf_greg_t regval;
+
switch (i)
{
case PSW_REGNUM:
- *(regp + regmap[i]) =
- ((0x00c1 & bbpsw) << 8) | ((0xc100 & psw) >> 8);
+ regval = ((0x00c1 & bbpsw) << 8) | ((0xc100 & psw) >> 8);
break;
case CBR_REGNUM:
- *(regp + regmap[i]) = ((psw >> 8) & 1);
+ regval = ((psw >> 8) & 1);
+ break;
+ default:
+ regval = *(regp + regmap[i]);
break;
}
if (i != M32R_SP_REGNUM)
- regcache_raw_supply (current_regcache, i, regp + regmap[i]);
+ regcache_raw_supply (current_regcache, i, ®val);
else if (psw & 0x8000)
regcache_raw_supply (current_regcache, i, regp + SPU_REGMAP);
else
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com