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