aboutsummaryrefslogtreecommitdiff
path: root/gdb/m68k-tdep.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2006-06-08 19:11:45 +0000
committerNathan Sidwell <nathan@codesourcery.com>2006-06-08 19:11:45 +0000
commit6dd0fba6719503d5e659547eaefeadb49b737ebd (patch)
tree41817221d9a1c966b4e09179b0ef2352efd18a1a /gdb/m68k-tdep.c
parentad9a8f3f0088e383aa284d3f654af2852ed59dac (diff)
downloadgdb-6dd0fba6719503d5e659547eaefeadb49b737ebd.zip
gdb-6dd0fba6719503d5e659547eaefeadb49b737ebd.tar.gz
gdb-6dd0fba6719503d5e659547eaefeadb49b737ebd.tar.bz2
* m68k-tdep.c (m68k_dwarf_reg_to_regnum): New.
(m68k_gdbarch_init): Set it for dwarf & dwarf2 reg number conversion. Use M68K_NUM_REGS for number of regs.
Diffstat (limited to 'gdb/m68k-tdep.c')
-rw-r--r--gdb/m68k-tdep.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 1761996..1ddd652 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -467,6 +467,28 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
frame's CFA. */
return sp + 8;
}
+
+/* Convert a dwarf or dwarf2 regnumber to a GDB regnum. */
+
+static int
+m68k_dwarf_reg_to_regnum (int num)
+{
+ if (num < 8)
+ /* d0..7 */
+ return (num - 0) + M68K_D0_REGNUM;
+ else if (num < 16)
+ /* a0..7 */
+ return (num - 8) + M68K_A0_REGNUM;
+ else if (num < 24)
+ /* fp0..7 */
+ return (num - 16) + M68K_FP0_REGNUM;
+ else if (num == 25)
+ /* pc */
+ return M68K_PC_REGNUM;
+ else
+ return NUM_REGS + NUM_PSEUDO_REGS;
+}
+
struct m68k_frame_cache
{
@@ -1138,10 +1160,12 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_decr_pc_after_break (gdbarch, 2);
set_gdbarch_frame_args_skip (gdbarch, 8);
+ set_gdbarch_dwarf_reg_to_regnum (gdbarch, m68k_dwarf_reg_to_regnum);
+ set_gdbarch_dwarf2_reg_to_regnum (gdbarch, m68k_dwarf_reg_to_regnum);
set_gdbarch_register_type (gdbarch, m68k_register_type);
set_gdbarch_register_name (gdbarch, m68k_register_name);
- set_gdbarch_num_regs (gdbarch, 29);
+ set_gdbarch_num_regs (gdbarch, M68K_NUM_REGS);
set_gdbarch_register_bytes_ok (gdbarch, m68k_register_bytes_ok);
set_gdbarch_sp_regnum (gdbarch, M68K_SP_REGNUM);
set_gdbarch_pc_regnum (gdbarch, M68K_PC_REGNUM);