This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[rfa] Store the CPSR on ARM Linux
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb-patches at sources dot redhat dot com
- Cc: Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- Date: Fri, 25 Mar 2005 16:48:36 -0500
- Subject: [rfa] Store the CPSR on ARM Linux
I noticed when testing Thumb support that calling functions from the
opposite execution mode didn't work very well. Nothing ever caused GDB
to flush the changed CPSR to the inferior, so we would begin executing ARM
functions in Thumb mode or vice versa.
Committed to csl-arm-20050325-branch. OK for HEAD?
--
Daniel Jacobowitz
CodeSourcery, LLC
2005-03-25 Daniel Jacobowitz <dan@codesourcery.com>
* arm-linux-nat.c (store_register, store_regs): Handle
ARM_PS_REGNUM.
Index: gdb/arm-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-linux-nat.c,v
retrieving revision 1.22
diff -u -p -r1.22 arm-linux-nat.c
--- gdb/arm-linux-nat.c 5 Jan 2005 15:43:43 -0000 1.22
+++ gdb/arm-linux-nat.c 25 Mar 2005 21:45:05 -0000
@@ -492,6 +492,12 @@ store_register (int regno)
if (regno >= ARM_A1_REGNUM && regno <= ARM_PC_REGNUM)
regcache_raw_collect (current_regcache, regno, (char *) ®s[regno]);
+ else if (arm_apcs_32 && regno == ARM_PS_REGNUM)
+ regcache_raw_collect (current_regcache, regno,
+ (char *) ®s[ARM_CPSR_REGNUM]);
+ else if (!arm_apcs_32 && regno == ARM_PS_REGNUM)
+ regcache_raw_collect (current_regcache, ARM_PC_REGNUM,
+ (char *) ®s[ARM_PC_REGNUM]);
ret = ptrace (PTRACE_SETREGS, tid, 0, ®s);
if (ret < 0)
@@ -524,6 +530,10 @@ store_regs (void)
regcache_raw_collect (current_regcache, regno, (char *) ®s[regno]);
}
+ if (arm_apcs_32 && register_cached (ARM_PS_REGNUM))
+ regcache_raw_collect (current_regcache, ARM_PS_REGNUM,
+ (char *) ®s[ARM_CPSR_REGNUM]);
+
ret = ptrace (PTRACE_SETREGS, tid, 0, ®s);
if (ret < 0)