This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[Committed] avr: Add dwarf2_reg_to_regnum method
- From: Tristan Gingold <gingold at adacore dot com>
- To: gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Tue, 10 Nov 2009 10:49:29 +0100
- Subject: [Committed] avr: Add dwarf2_reg_to_regnum method
Hi,
dwarf2 register number for SP is not the same as the SP regnum. The
avr_dwarf2_reg_to_regnum function
is added by this patch to fix this discrepancy.
committed.
Tristan.
gdb/
2009-11-10 Tristan Gingold <gingold@adacore.com>
* avr-tdep.c (avr_dwarf_reg_to_regnum): New function.
(avr_gdbarch_init): Call set_gdbarch_dwarf2_reg_to_regnum.
*** avr-tdep.c 26 Oct 2009 16:53:57 -0000 1.116
--- avr-tdep.c 10 Nov 2009 09:47:10 -0000
***************
*** 1263,1268 ****
--- 1263,1283 ----
return sp + call_length;
}
+ /* Unfortunately dwarf2 register for SP is 32. */
+
+ static int
+ avr_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
+ {
+ if (reg >= 0 && reg < 32)
+ return reg;
+ if (reg == 32)
+ return AVR_SP_REGNUM;
+
+ warning (_("Unmapped DWARF Register #%d encountered."), reg);
+
+ return -1;
+ }
+
/* Initialize the gdbarch structure for the AVR's. */
static struct gdbarch *
***************
*** 1335,1340 ****
--- 1350,1357 ----
set_gdbarch_push_dummy_call (gdbarch, avr_push_dummy_call);
+ set_gdbarch_dwarf2_reg_to_regnum (gdbarch, avr_dwarf_reg_to_regnum);
+
set_gdbarch_address_to_pointer (gdbarch, avr_address_to_pointer);
set_gdbarch_pointer_to_address (gdbarch, avr_pointer_to_address);