diff options
author | Kevin Buettner <kevinb@redhat.com> | 2005-09-03 01:12:21 +0000 |
---|---|---|
committer | Kevin Buettner <kevinb@redhat.com> | 2005-09-03 01:12:21 +0000 |
commit | 336c28c5f7c58b3525fc86091fcf0ba58c702aaf (patch) | |
tree | c2f4f3734d8e87aacbecd1efb8f3957e3dac5894 /gdb | |
parent | 2247615a0efd4e91c56980347259442a2f5f8bf9 (diff) | |
download | gdb-336c28c5f7c58b3525fc86091fcf0ba58c702aaf.zip gdb-336c28c5f7c58b3525fc86091fcf0ba58c702aaf.tar.gz gdb-336c28c5f7c58b3525fc86091fcf0ba58c702aaf.tar.bz2 |
* mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): New function.
(mn10300_gdbarch_init): Register mn10300_dwarf2_reg_to_regnum().
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/mn10300-tdep.c | 32 |
2 files changed, 37 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ed8d348..3508c49 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2005-09-02 Kevin Buettner <kevinb@redhat.com> + * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): New function. + (mn10300_gdbarch_init): Register mn10300_dwarf2_reg_to_regnum(). + +2005-09-02 Kevin Buettner <kevinb@redhat.com> + * mn10300-tdep.c (is_my_frame_in_sp, is_my_frame_in_fp) (is_my_frame_last): Delete these unused functions. diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 6791436..db9953b 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -937,6 +937,37 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch, return sp; } +/* 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, + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63 + }; + + 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 struct gdbarch * mn10300_gdbarch_init (struct gdbarch_info info, @@ -977,6 +1008,7 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_write_pc (gdbarch, mn10300_write_pc); set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM); set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM); + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mn10300_dwarf2_reg_to_regnum); /* Stack unwinding. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); |