Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: [patch 2/2] Implement gdbarch hook user_register_name on ARM
Date: Wed, 15 Dec 2010 10:48:00 -0000	[thread overview]
Message-ID: <4D089CD6.5030500@codesourcery.com> (raw)
In-Reply-To: <4D0896E0.1030707@codesourcery.com>

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

On 12/15/2010 06:22 PM, Yao Qi wrote:
> Once this patch is applied, we leave more flexibility to backend to
> determine what is the correct register number given a register alias.

This patch is to implement user_register_name on ARM.  With this, we can
handle alias "fp" according to the current frame's mode (ARM or Thumb).

Regression testing is still running on ARM.  Comments are welcome.

-- 
Yao (齐尧)

[-- Attachment #2: gdbarch_user_register_name_p2.patch --]
[-- Type: text/x-patch, Size: 1611 bytes --]

2010-12-15  Yao Qi  <yao@codesourcery.com>

	* arm-tdep.c (arm_user_register_name): New.
	(arm_gdbarch_init): Install arm_user_register_nam on gdbarch hook
	user_register_name.

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 636c1de..618f82f 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -2918,6 +2918,27 @@ arm_neon_quad_type (struct gdbarch *gdbarch)
   return tdep->neon_quad_type;
 }
 
+static int
+arm_user_register_name (struct gdbarch *gdbarch, const char *regname, int len)
+{
+  if ((len < 0 && strcmp ("fp", regname))
+      || (len == strlen ("fp")
+	  && strncmp ("fp", regname, len) == 0))
+    {
+      /* `fp' register means different registers on ARM and Thumb.  Return
+	 the correct `fp' register number according the state of current
+	 frame.  */
+      struct frame_info *frame = get_selected_frame (NULL);
+      if (arm_frame_is_thumb (frame))
+	return THUMB_FP_REGNUM;
+      else
+	return ARM_FP_REGNUM;
+    }
+  else
+    /* Leave search to other registers to default implementation.  */
+    return default_user_register_name (gdbarch, regname, len);
+}
+
 /* Return the GDB type object for the "standard" data type of data in
    register N.  */
 
@@ -7462,6 +7483,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_pc_regnum (gdbarch, ARM_PC_REGNUM);
   set_gdbarch_num_regs (gdbarch, ARM_NUM_REGS);
   set_gdbarch_register_type (gdbarch, arm_register_type);
+  set_gdbarch_user_register_name (gdbarch, arm_user_register_name);
 
   /* This "info float" is FPA-specific.  Use the generic version if we
      do not have FPA.  */

  reply	other threads:[~2010-12-15 10:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-15 10:22 [patch 1/2] New gdbarch hook user_register_name Yao Qi
2010-12-15 10:48 ` Yao Qi [this message]
2010-12-21 19:07   ` [patch 2/2] Implement gdbarch hook user_register_name on ARM Ulrich Weigand
2010-12-22 17:44     ` Yao Qi
2010-12-22 18:12       ` Mark Kettenis
2010-12-23  7:19         ` Yao Qi
2010-12-23  1:54       ` Ulrich Weigand
2010-12-23  4:10         ` Yao Qi
2010-12-23 18:37           ` Ulrich Weigand
2010-12-24  5:16             ` Yao Qi
2010-12-28 14:52               ` Ulrich Weigand
2010-12-22 17:54   ` Richard Earnshaw
2010-12-23  2:05     ` Ulrich Weigand
2010-12-23  3:37       ` Joel Brobecker
2010-12-23 12:08         ` Mark Kettenis

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=4D089CD6.5030500@codesourcery.com \
    --to=yao@codesourcery.com \
    --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