Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@iki.fi>
To: gdb-patches@sourceware.org
Subject: [PATCH] fix ARM CPSR register fetching in linux
Date: Tue, 21 Apr 2009 06:12:00 -0000	[thread overview]
Message-ID: <20090421060715.GC12530@blade.healthdatacare.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

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

[-- Attachment #2: arm-linux-cpsr.patch --]
[-- Type: text/plain, Size: 1331 bytes --]

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.  */

             reply	other threads:[~2009-04-21  6:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-21  6:12 Mika Westerberg [this message]
2009-04-21 10:31 ` Joseph S. Myers
2009-04-21 18:06   ` Mika Westerberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090421060715.GC12530@blade.healthdatacare.com \
    --to=mika.westerberg@iki.fi \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox