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]

[rfc] [05/16] Get rid of current_gdbarch in amd64-{tdep, linux-tdep, nat}.c


Hi,

this patch gets rid of some of the current_gdbarch's in amd64-{tdep, linux-tdep, nat}.c

Is this ok to commit?


ChangeLog:


	* amd64-tdep.c (amd64_frame_prev_register, amd64_sigtramp_frame_cache):
	Use get_regcache_arch or get_frame_arch to get at the current
	architecture by regcache or by frame, respectively.
	* amd64-linux-tdep.c (amd64_linux_sigcontext_addr): Likewise.
	* amd64-nat.c (amd64_supply_native_gregset)
	(amd64_collect_native_gregset): Replace current_gdbarch by gdbarch.


-- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com




diff -urpN src/gdb/amd64-linux-tdep.c dev/gdb/amd64-linux-tdep.c
--- src/gdb/amd64-linux-tdep.c	2007-08-24 04:24:03.000000000 +0200
+++ dev/gdb/amd64-linux-tdep.c	2007-08-27 10:32:39.000000000 +0200
@@ -154,7 +154,8 @@ amd64_linux_sigcontext_addr (struct fram
   CORE_ADDR sp;
   gdb_byte buf[8];
 
-  frame_unwind_register (next_frame, gdbarch_sp_regnum (current_gdbarch), buf);
+  frame_unwind_register (next_frame,
+			 gdbarch_sp_regnum (get_frame_arch (next_frame)), buf);
   sp = extract_unsigned_integer (buf, 8);
 
   /* The sigcontext structure is part of the user context.  A pointer
diff -urpN src/gdb/amd64-nat.c dev/gdb/amd64-nat.c
--- src/gdb/amd64-nat.c	2007-08-24 04:24:03.000000000 +0200
+++ dev/gdb/amd64-nat.c	2007-08-27 10:32:39.000000000 +0200
@@ -98,8 +98,8 @@ amd64_supply_native_gregset (struct regc
   if (gdbarch_ptr_bit (gdbarch) == 32)
     num_regs = amd64_native_gregset32_num_regs;
 
-  if (num_regs > gdbarch_num_regs (current_gdbarch))
-    num_regs = gdbarch_num_regs (current_gdbarch);
+  if (num_regs > gdbarch_num_regs (gdbarch))
+    num_regs = gdbarch_num_regs (gdbarch);
 
   for (i = 0; i < num_regs; i++)
     {
@@ -145,8 +145,8 @@ amd64_collect_native_gregset (const stru
 	}
     }
 
-  if (num_regs > gdbarch_num_regs (current_gdbarch))
-    num_regs = gdbarch_num_regs (current_gdbarch);
+  if (num_regs > gdbarch_num_regs (gdbarch))
+    num_regs = gdbarch_num_regs (gdbarch);
 
   for (i = 0; i < num_regs; i++)
     {
diff -urpN src/gdb/amd64-tdep.c dev/gdb/amd64-tdep.c
--- src/gdb/amd64-tdep.c	2007-08-24 04:24:04.000000000 +0200
+++ dev/gdb/amd64-tdep.c	2007-08-27 10:32:39.000000000 +0200
@@ -863,12 +863,13 @@ amd64_frame_prev_register (struct frame_
 			   enum lval_type *lvalp, CORE_ADDR *addrp,
 			   int *realnump, gdb_byte *valuep)
 {
+  struct gdbarch *gdbarch = get_frame_arch (next_frame);
   struct amd64_frame_cache *cache =
     amd64_frame_cache (next_frame, this_cache);
 
   gdb_assert (regnum >= 0);
 
-  if (regnum == gdbarch_sp_regnum (current_gdbarch) && cache->saved_sp)
+  if (regnum == gdbarch_sp_regnum (gdbarch) && cache->saved_sp)
     {
       *optimizedp = 0;
       *lvalp = not_lval;
@@ -892,7 +893,7 @@ amd64_frame_prev_register (struct frame_
 	{
 	  /* Read the value in from memory.  */
 	  read_memory (*addrp, valuep,
-		       register_size (current_gdbarch, regnum));
+		       register_size (gdbarch, regnum));
 	}
       return;
     }
@@ -929,7 +930,7 @@ static struct amd64_frame_cache *
 amd64_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
 {
   struct amd64_frame_cache *cache;
-  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
   CORE_ADDR addr;
   gdb_byte buf[8];
   int i;




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