From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11759 invoked by alias); 15 Dec 2010 10:48:07 -0000 Received: (qmail 11744 invoked by uid 22791); 15 Dec 2010 10:48:06 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 15 Dec 2010 10:48:01 +0000 Received: (qmail 26930 invoked from network); 15 Dec 2010 10:47:59 -0000 Received: from unknown (HELO ?192.168.0.102?) (yao@127.0.0.2) by mail.codesourcery.com with ESMTPA; 15 Dec 2010 10:47:59 -0000 Message-ID: <4D089CD6.5030500@codesourcery.com> Date: Wed, 15 Dec 2010 10:48:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [patch 2/2] Implement gdbarch hook user_register_name on ARM References: <4D0896E0.1030707@codesourcery.com> In-Reply-To: <4D0896E0.1030707@codesourcery.com> Content-Type: multipart/mixed; boundary="------------020609080001080301020507" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-12/txt/msg00287.txt.bz2 This is a multi-part message in MIME format. --------------020609080001080301020507 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-length: 412 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 (齐尧) --------------020609080001080301020507 Content-Type: text/x-patch; name="gdbarch_user_register_name_p2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gdbarch_user_register_name_p2.patch" Content-length: 1611 2010-12-15 Yao Qi * 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. */ --------------020609080001080301020507--