This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[hppa64] dwarf reg to gdb reg number mapping


This patch sets up the mapping of dwarf register numbers to gdb register numbers. Tested on hppa64-hp-hpux11.11. Committed.

randolph
2005-12-09  Randolph Chung  <tausq@debian.org>

	* hppa-tdep.c (hppa64_dwarf_reg_to_regnum): New funtion.
	(hppa_gdbarch_init): Set dwarf_reg_to_regnum and 
	dwarf2_reg_to_regnum methods.

Index: gdb/hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.214
diff -u -p -r1.214 hppa-tdep.c
--- gdb/hppa-tdep.c	19 Nov 2005 12:39:50 -0000	1.214
+++ gdb/hppa-tdep.c	26 Nov 2005 16:39:04 -0000
@@ -662,6 +662,21 @@ hppa64_register_name (int i)
     return names[i];
 }
 
+static int
+hppa64_dwarf_reg_to_regnum (int reg)
+{
+  /* r0-r31 and sar map one-to-one.  */
+  if (reg <= 32)
+    return reg;
+
+  /* fr4-fr31 are mapped from 72 in steps of 2.  */
+  if (reg >= 72 || reg < 72 + 28 * 2)
+    return HPPA64_FP4_REGNUM + (reg - 72) / 2;
+
+  error ("Invalid DWARF register num %d.", reg);
+  return -1;
+}
+
 /* This function pushes a stack frame with arguments as part of the
    inferior function calling mechanism.
 
@@ -2747,6 +2823,8 @@ hppa_gdbarch_init (struct gdbarch_info i
         set_gdbarch_num_regs (gdbarch, hppa64_num_regs);
         set_gdbarch_register_name (gdbarch, hppa64_register_name);
         set_gdbarch_register_type (gdbarch, hppa64_register_type);
+        set_gdbarch_dwarf_reg_to_regnum (gdbarch, hppa64_dwarf_reg_to_regnum);
+        set_gdbarch_dwarf2_reg_to_regnum (gdbarch, hppa64_dwarf_reg_to_regnum);
 	set_gdbarch_cannot_store_register (gdbarch,
 					   hppa64_cannot_store_register);
 	set_gdbarch_cannot_fetch_register (gdbarch,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]