[PATCH] fix ARM CPSR register fetching in linux
Mika Westerberg
mika.westerberg@iki.fi
Tue Apr 21 06:12:00 GMT 2009
Hi,
Current version of gdb cannot read CPSR register correctly through
ptrace(2) when debugging live process on ARM linux. Problem is caused
by change where ARM_CPSR_REGNUM (16) was aliased to ARM_PS_REGNUM (25).
This is easy to test on ARM linux targets: just run 'info registers'.
Following patch should fix it.
2009-04-21 Mika Westerberg <mika.westerberg@iki.fi>
* arm-linux-tdep.h, arm-tdep.h: Changed ARM_CPSR_REGNUM to be
correct (16) again.
Thanks,
MW
-------------- next part --------------
Index: gdb/arm-linux-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/arm-linux-tdep.h,v
retrieving revision 1.6
diff -u -r1.6 arm-linux-tdep.h
--- gdb/arm-linux-tdep.h 3 Jan 2009 05:57:50 -0000 1.6
+++ gdb/arm-linux-tdep.h 21 Apr 2009 05:35:35 -0000
@@ -20,6 +20,11 @@
struct regset;
struct regcache;
+/* This is regnum that is used to fetch cpsr from regset that
+ ptrace(2) gives us. It is different than ARM_PS_REGNUM which
+ is used to access cpsr from regcache. */
+#define ARM_CPSR_REGNUM 16
+
#define ARM_LINUX_SIZEOF_NWFPE (8 * FP_REGISTER_SIZE \
+ 2 * INT_REGISTER_SIZE \
+ 8 + INT_REGISTER_SIZE)
Index: gdb/arm-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.h,v
retrieving revision 1.33
diff -u -r1.33 arm-tdep.h
--- gdb/arm-tdep.h 3 Jan 2009 05:57:50 -0000 1.33
+++ gdb/arm-tdep.h 21 Apr 2009 05:35:35 -0000
@@ -38,7 +38,6 @@
ARM_F7_REGNUM = 23, /* last floating point register */
ARM_FPS_REGNUM = 24, /* floating point status register */
ARM_PS_REGNUM = 25, /* Contains processor status */
- ARM_CPSR_REGNUM = ARM_PS_REGNUM,
ARM_WR0_REGNUM, /* WMMX data registers. */
ARM_WR15_REGNUM = ARM_WR0_REGNUM + 15,
ARM_WC0_REGNUM, /* WMMX control registers. */
More information about the Gdb-patches
mailing list