diff options
author | Jim Blandy <jimb@codesourcery.com> | 2001-05-09 02:55:21 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2001-05-09 02:55:21 +0000 |
commit | 2343651077b403e5810808286218b7923965bd9f (patch) | |
tree | 47766ec4e8f9a0627db42ff0b03521df10c93f3d | |
parent | ae83b20d8f8eff60f8bd9d7a131f7f60b06db772 (diff) | |
download | gdb-2343651077b403e5810808286218b7923965bd9f.zip gdb-2343651077b403e5810808286218b7923965bd9f.tar.gz gdb-2343651077b403e5810808286218b7923965bd9f.tar.bz2 |
* mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): New function.
(mn10300_gdbarch_init): Register it as the architecture's
dwarf2_reg_to_regnum method.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/mn10300-tdep.c | 30 |
2 files changed, 34 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6714b67..a200519 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2001-05-08 Jim Blandy <jimb@redhat.com> + * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): New function. + (mn10300_gdbarch_init): Register it as the architecture's + dwarf2_reg_to_regnum method. + Correct and expand handling of `movm' instruction, and register saves in general. * config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM, diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index ae7d2f5..d0d710a 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -893,6 +893,35 @@ mn10300_register_raw_size (int reg) return 4; } +/* If DWARF2 is a register number appearing in Dwarf2 debug info, then + mn10300_dwarf2_reg_to_regnum (DWARF2) is the corresponding GDB + register number. Why don't Dwarf2 and GDB use the same numbering? + Who knows? But since people have object files lying around with + the existing Dwarf2 numbering, and other people have written stubs + to work with the existing GDB, neither of them can change. So we + just have to cope. */ +static int +mn10300_dwarf2_reg_to_regnum (int dwarf2) +{ + /* This table is supposed to be shaped like the REGISTER_NAMES + initializer in gcc/config/mn10300/mn10300.h. Registers which + appear in GCC's numbering, but have no counterpart in GDB's + world, are marked with a -1. */ + static int dwarf2_to_gdb[] = { + 0, 1, 2, 3, 4, 5, 6, 7, -1, 8, + 15, 16, 17, 18, 19, 20, 21, 22 + }; + int gdb; + + if (dwarf2 < 0 + || dwarf2 >= (sizeof (dwarf2_to_gdb) / sizeof (dwarf2_to_gdb[0])) + || dwarf2_to_gdb[dwarf2] == -1) + internal_error (__FILE__, __LINE__, + "bogus register number in debug info: %d", dwarf2); + + return dwarf2_to_gdb[dwarf2]; +} + static void mn10300_print_register (const char *name, int regnum, int reg_width) { @@ -1041,6 +1070,7 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_max_register_virtual_size (gdbarch, 4); set_gdbarch_register_virtual_size (gdbarch, mn10300_register_virtual_size); set_gdbarch_register_virtual_type (gdbarch, mn10300_register_virtual_type); + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mn10300_dwarf2_reg_to_regnum); set_gdbarch_do_registers_info (gdbarch, mn10300_do_registers_info); set_gdbarch_fp_regnum (gdbarch, 31); |