diff options
author | Stephane Carrez <stcarrez@nerim.fr> | 2003-02-22 15:59:49 +0000 |
---|---|---|
committer | Stephane Carrez <stcarrez@nerim.fr> | 2003-02-22 15:59:49 +0000 |
commit | b631436bb9381026916d8f10ba0e115a189502c0 (patch) | |
tree | bad9e17998c649268073da57ce372043d253bb29 | |
parent | 0aa8c1e41b6231d91a91f0f86945d9ed66412df0 (diff) | |
download | gdb-b631436bb9381026916d8f10ba0e115a189502c0.zip gdb-b631436bb9381026916d8f10ba0e115a189502c0.tar.gz gdb-b631436bb9381026916d8f10ba0e115a189502c0.tar.bz2 |
* m68hc11-tdep.c (m68hc11_init_reggroups): New function.
(m68hc11_add_reggroups): New function.
(m68hc11_register_reggroup_p): New to register hard/soft reggroups.
(m68hc11_gdbarch_init): Install the reggroups.
(_initialize_m68hc11_tdep): Initialize them.
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/m68hc11-tdep.c | 65 |
2 files changed, 73 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dd93a88..6ebce84 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2003-02-22 Stephane Carrez <stcarrez@nerim.fr> + + * m68hc11-tdep.c (m68hc11_init_reggroups): New function. + (m68hc11_add_reggroups): New function. + (m68hc11_register_reggroup_p): New to register hard/soft reggroups. + (m68hc11_gdbarch_init): Install the reggroups. + (_initialize_m68hc11_tdep): Initialize them. + 2003-02-21 James E Wilson <wilson@tuliptree.org> * MAINTAINERS: Update my email address. diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 69c54d1..77baa3d 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "objfiles.h" #include "arch-utils.h" #include "regcache.h" +#include "reggroups.h" #include "target.h" #include "opcode/m68hc11.h" @@ -1205,6 +1206,66 @@ gdb_print_insn_m68hc11 (bfd_vma memaddr, disassemble_info *info) return print_insn_m68hc12 (memaddr, info); } + + +/* 68HC11/68HC12 register groups. + Identify real hard registers and soft registers used by gcc. */ + +static struct reggroup *m68hc11_soft_reggroup; +static struct reggroup *m68hc11_hard_reggroup; + +static void +m68hc11_init_reggroups (void) +{ + m68hc11_hard_reggroup = reggroup_new ("hard", USER_REGGROUP); + m68hc11_soft_reggroup = reggroup_new ("soft", USER_REGGROUP); +} + +static void +m68hc11_add_reggroups (struct gdbarch *gdbarch) +{ + reggroup_add (gdbarch, m68hc11_hard_reggroup); + reggroup_add (gdbarch, m68hc11_soft_reggroup); + reggroup_add (gdbarch, general_reggroup); + reggroup_add (gdbarch, float_reggroup); + reggroup_add (gdbarch, all_reggroup); + reggroup_add (gdbarch, save_reggroup); + reggroup_add (gdbarch, restore_reggroup); + reggroup_add (gdbarch, vector_reggroup); + reggroup_add (gdbarch, system_reggroup); +} + +static int +m68hc11_register_reggroup_p (struct gdbarch *gdbarch, int regnum, + struct reggroup *group) +{ + /* We must save the real hard register as well as gcc + soft registers including the frame pointer. */ + if (group == save_reggroup || group == restore_reggroup) + { + return (regnum <= gdbarch_num_regs (gdbarch) + || ((regnum == SOFT_FP_REGNUM + || regnum == SOFT_TMP_REGNUM + || regnum == SOFT_ZS_REGNUM + || regnum == SOFT_XY_REGNUM) + && m68hc11_register_name (regnum))); + } + + /* Group to identify gcc soft registers (d1..dN). */ + if (group == m68hc11_soft_reggroup) + { + return regnum >= SOFT_D1_REGNUM && m68hc11_register_name (regnum); + } + + if (group == m68hc11_hard_reggroup) + { + return regnum == HARD_PC_REGNUM || regnum == HARD_SP_REGNUM + || regnum == HARD_X_REGNUM || regnum == HARD_D_REGNUM + || regnum == HARD_Y_REGNUM || regnum == HARD_CCR_REGNUM; + } + return default_register_reggroup_p (gdbarch, regnum, group); +} + static struct gdbarch * m68hc11_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) @@ -1358,6 +1419,9 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_stack_align (gdbarch, m68hc11_stack_align); set_gdbarch_print_insn (gdbarch, gdb_print_insn_m68hc11); + m68hc11_add_reggroups (gdbarch); + set_gdbarch_register_reggroup_p (gdbarch, m68hc11_register_reggroup_p); + /* Minsymbol frobbing. */ set_gdbarch_elf_make_msymbol_special (gdbarch, m68hc11_elf_make_msymbol_special); @@ -1372,6 +1436,7 @@ _initialize_m68hc11_tdep (void) { register_gdbarch_init (bfd_arch_m68hc11, m68hc11_gdbarch_init); register_gdbarch_init (bfd_arch_m68hc12, m68hc11_gdbarch_init); + m68hc11_init_reggroups (); add_com ("regs", class_vars, show_regs, "Print all registers"); } |