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]

Re: [rfc] Remove macros {SP,PC,PS,FP0}_REGNUM from gdbarch.sh


Markus Deuling wrote:

> there were lots of changes to various parts of GDB so it was necessary to rebase the REGNUM patch. So here it
> is again. Build and tested on x86. Build with gdb_mbuild.sh

Thanks for re-doing that patch.  It looks like a small number of
places were overlooked; I've now committed this patch together with
those (see patch below).

Longer-term, most uses of those gdbarch callbacks -in particular 
those in platform-specific code- are probably bogus and should be
removed.  But that's a different issue ...

Bye,
Ulrich


diff -urNp gdb-orig/gdb/core-regset.c gdb-head/gdb/core-regset.c
--- gdb-orig/gdb/core-regset.c	2007-06-18 19:36:30.333801855 +0200
+++ gdb-head/gdb/core-regset.c	2007-06-18 19:33:09.217153836 +0200
@@ -85,7 +85,7 @@ fetch_core_registers (struct regcache *r
       else
 	{
 	  memcpy (&fpregset, core_reg_sect, sizeof (fpregset));
-	  if (FP0_REGNUM >= 0)
+	  if (gdbarch_fp0_regnum (current_gdbarch) >= 0)
 	    supply_fpregset (regcache, (const gdb_fpregset_t *) &fpregset);
 	}
       break;
diff -urNp gdb-orig/gdb/i386v4-nat.c gdb-head/gdb/i386v4-nat.c
--- gdb-orig/gdb/i386v4-nat.c	2007-06-18 19:36:30.475781429 +0200
+++ gdb-head/gdb/i386v4-nat.c	2007-06-18 19:32:49.853013932 +0200
@@ -139,7 +139,7 @@ fill_gregset (const struct regcache *reg
 void
 supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
 {
-  if (FP0_REGNUM == 0)
+  if (gdbarch_fp0_regnum (current_gdbarch) == 0)
     return;
 
   i387_supply_fsave (regcache, -1, fpregsetp);
@@ -153,7 +153,7 @@ void
 fill_fpregset (const struct regcache *regcache,
 	       fpregset_t *fpregsetp, int regno)
 {
-  if (FP0_REGNUM == 0)
+  if (gdbarch_fp0_regnum (current_gdbarch) == 0)
     return;
 
   i387_collect_fsave (regcache, regno, fpregsetp);
diff -urNp gdb-orig/gdb/libunwind-frame.c gdb-head/gdb/libunwind-frame.c
--- gdb-orig/gdb/libunwind-frame.c	2007-06-18 19:36:30.505777114 +0200
+++ gdb-head/gdb/libunwind-frame.c	2007-06-18 19:31:19.648301803 +0200
@@ -179,7 +179,7 @@ libunwind_frame_cache (struct frame_info
     }
 
   /* To get base address, get sp from previous frame.  */
-  uw_sp_regnum = descr->gdb2uw (SP_REGNUM);
+  uw_sp_regnum = descr->gdb2uw (gdbarch_sp_regnum (current_gdbarch));
   ret = unw_get_reg_p (&cache->cursor, uw_sp_regnum, &fp);
   if (ret < 0)
     {
diff -urNp gdb-orig/gdb/mips-linux-tdep.c gdb-head/gdb/mips-linux-tdep.c
--- gdb-orig/gdb/mips-linux-tdep.c	2007-06-18 19:36:35.255759461 +0200
+++ gdb-head/gdb/mips-linux-tdep.c	2007-06-18 19:32:08.925656282 +0200
@@ -1067,7 +1067,8 @@ mips_linux_n32n64_sigframe_init (const s
 static void
 mips_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
 {
-  regcache_cooked_write_unsigned (regcache, PC_REGNUM, pc);
+  regcache_cooked_write_unsigned (regcache,
+				  gdbarch_pc_regnum (current_gdbarch), pc);
 
   /* Clear the syscall restart flag.  */
   if (mips_linux_restart_reg_p (current_gdbarch))


-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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