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] [1/8] Remove macro ADDR_BITS_REMOVE


Hello,

this patch removes ADDR_BITS_REMOVE macro from gdbarch.sh


ChangeLog: * gdbarch.sh (ADDR_BITS_REMOVE): Replace by gdbarch_addr_bits_remove.
* value.c (value_as_address): Likewise (comment).
* remote-mips.c (common_breakpoint): Likewise.
* regcache.c (read_pc_pid): Likewise.
* printcmd.c (do_one_display): Likewise.
* monitor.c (monitor_write_memory, monitor_read_memory)
(monitor_insert_breakpoint): Likewise.
* mips-tdep.c (heuristic_proc_start): Likewise.
* infrun.c (insert_step_resume_breakpoint_at_frame)
(insert_step_resume_breakpoint_at_caller): Likewise.
* buildsym.c (record_line): Likewise.
* arm-tdep.c (arm_scan_prologue, thumb_get_next_pc)
(arm_get_next_pc): Likewise.
* armnbsd-nat.c (arm_supply_gregset, fetch_register,store_register)
(store_regs): Likewise.
* arm-linux-tdep.c (arm_linux_supply_gregset): Likewise.
* arm-linux-nat.c (fetch_register, fetch_regs): Likewise.
* gdbarch.c, gdbarch.h: Regenerate.




Is this ok to commit?

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






diff -urN src_neu/gdb/arm-linux-nat.c dev_neu/gdb/arm-linux-nat.c
--- src_neu/gdb/arm-linux-nat.c	2007-05-06 16:34:36.000000000 +0200
+++ dev_neu/gdb/arm-linux-nat.c	2007-06-08 06:49:25.000000000 +0200
@@ -255,7 +255,8 @@
     
   if (ARM_PC_REGNUM == regno)
     { 
-      regs[ARM_PC_REGNUM] = ADDR_BITS_REMOVE (regs[ARM_PC_REGNUM]);
+      regs[ARM_PC_REGNUM] = gdbarch_addr_bits_remove
+			      (current_gdbarch, regs[ARM_PC_REGNUM]);
       regcache_raw_supply (regcache, ARM_PC_REGNUM,
 			   (char *) &regs[ARM_PC_REGNUM]);
     }
@@ -290,7 +291,8 @@
     regcache_raw_supply (regcache, ARM_PS_REGNUM,
 			 (char *) &regs[ARM_PC_REGNUM]);
 
-  regs[ARM_PC_REGNUM] = ADDR_BITS_REMOVE (regs[ARM_PC_REGNUM]);
+  regs[ARM_PC_REGNUM] = gdbarch_addr_bits_remove
+			  (current_gdbarch, regs[ARM_PC_REGNUM]);
   regcache_raw_supply (regcache, ARM_PC_REGNUM,
 		       (char *) &regs[ARM_PC_REGNUM]);
 }
diff -urN src_neu/gdb/arm-linux-tdep.c dev_neu/gdb/arm-linux-tdep.c
--- src_neu/gdb/arm-linux-tdep.c	2007-05-16 17:31:11.000000000 +0200
+++ dev_neu/gdb/arm-linux-tdep.c	2007-06-08 06:47:33.000000000 +0200
@@ -393,7 +393,7 @@
       reg_pc = extract_unsigned_integer (gregs
 					 + INT_REGISTER_SIZE * ARM_PC_REGNUM,
 					 INT_REGISTER_SIZE);
-      reg_pc = ADDR_BITS_REMOVE (reg_pc);
+      reg_pc = gdbarch_addr_bits_remove (current_gdbarch, reg_pc);
       store_unsigned_integer (pc_buf, INT_REGISTER_SIZE, reg_pc);
       regcache_raw_supply (regcache, ARM_PC_REGNUM, pc_buf);
     }
diff -urN src_neu/gdb/armnbsd-nat.c dev_neu/gdb/armnbsd-nat.c
--- src_neu/gdb/armnbsd-nat.c	2007-05-06 16:34:37.000000000 +0200
+++ dev_neu/gdb/armnbsd-nat.c	2007-06-08 06:50:58.000000000 +0200
@@ -52,7 +52,7 @@
   regcache_raw_supply (regcache, ARM_LR_REGNUM,
 		       (char *) &gregset->r_lr);
   /* This is ok: we're running native...  */
-  r_pc = ADDR_BITS_REMOVE (gregset->r_pc);
+  r_pc = gdbarch_addr_bits_remove (current_gdbarch, gregset->r_pc);
   regcache_raw_supply (regcache, ARM_PC_REGNUM, (char *) &r_pc);
 
   if (arm_apcs_32)
@@ -105,7 +105,8 @@
 
     case ARM_PC_REGNUM:
       /* This is ok: we're running native... */
-      inferior_registers.r_pc = ADDR_BITS_REMOVE (inferior_registers.r_pc);
+      inferior_registers.r_pc = gdbarch_addr_bits_remove
+				  (current_gdbarch, inferior_registers.r_pc);
       regcache_raw_supply (regcache, ARM_PC_REGNUM,
 			   (char *) &inferior_registers.r_pc);
       break;
@@ -249,9 +250,10 @@
 	  regcache_raw_collect (regcache, ARM_PC_REGNUM,
 				(char *) &pc_val);
 	  
-	  pc_val = ADDR_BITS_REMOVE (pc_val);
-	  inferior_registers.r_pc
-	    ^= ADDR_BITS_REMOVE (inferior_registers.r_pc);
+	  pc_val = gdbarch_addr_bits_remove (current_gdbarch, pc_val);
+	  inferior_registers.r_pc ^= gdbarch_addr_bits_remove
+				       (current_gdbarch,
+					inferior_registers.r_pc);
 	  inferior_registers.r_pc |= pc_val;
 	}
       break;
@@ -267,8 +269,10 @@
 	  regcache_raw_collect (regcache, ARM_PS_REGNUM,
 				(char *) &psr_val);
 
-	  psr_val ^= ADDR_BITS_REMOVE (psr_val);
-	  inferior_registers.r_pc = ADDR_BITS_REMOVE (inferior_registers.r_pc);
+	  psr_val ^= gdbarch_addr_bits_remove (current_gdbarch, psr_val);
+	  inferior_registers.r_pc = gdbarch_addr_bits_remove
+				      (current_gdbarch,
+				       inferior_registers.r_pc);
 	  inferior_registers.r_pc |= psr_val;
 	}
       break;
@@ -320,8 +324,8 @@
       regcache_raw_collect (regcache, ARM_PS_REGNUM,
 			    (char *) &psr_val);
 	  
-      pc_val = ADDR_BITS_REMOVE (pc_val);
-      psr_val ^= ADDR_BITS_REMOVE (psr_val);
+      pc_val = gdbarch_addr_bits_remove (current_gdbarch, pc_val);
+      psr_val ^= gdbarch_addr_bits_remove (current_gdbarch, psr_val);
 
       inferior_registers.r_pc = pc_val | psr_val;
     }
diff -urN src_neu/gdb/arm-tdep.c dev_neu/gdb/arm-tdep.c
--- src_neu/gdb/arm-tdep.c	2007-06-08 06:33:08.000000000 +0200
+++ dev_neu/gdb/arm-tdep.c	2007-06-08 06:51:51.000000000 +0200
@@ -724,7 +724,8 @@
         return;
       else
         {
-          prologue_start = ADDR_BITS_REMOVE (return_value) - 8;
+          prologue_start = gdbarch_addr_bits_remove 
+			     (current_gdbarch, return_value) - 8;
           prologue_end = prologue_start + 64;	/* See above.  */
         }
     }
@@ -1623,7 +1624,7 @@
       offset = bitcount (bits (inst1, 0, 7)) * DEPRECATED_REGISTER_SIZE;
       sp = read_register (ARM_SP_REGNUM);
       nextpc = (CORE_ADDR) read_memory_unsigned_integer (sp + offset, 4);
-      nextpc = ADDR_BITS_REMOVE (nextpc);
+      nextpc = gdbarch_addr_bits_remove (current_gdbarch, nextpc);
       if (nextpc == pc)
 	error (_("Infinite loop detected"));
     }
@@ -1654,7 +1655,7 @@
       else
 	nextpc = read_register (bits (inst1, 3, 6));
 
-      nextpc = ADDR_BITS_REMOVE (nextpc);
+      nextpc = gdbarch_addr_bits_remove (current_gdbarch, nextpc);
       if (nextpc == pc)
 	error (_("Infinite loop detected"));
     }
@@ -1704,7 +1705,8 @@
 	      {
 		rn = bits (this_instr, 0, 3);
 		result = (rn == 15) ? pc_val + 8 : read_register (rn);
-		nextpc = (CORE_ADDR) ADDR_BITS_REMOVE (result);
+		nextpc = (CORE_ADDR) gdbarch_addr_bits_remove
+				       (current_gdbarch, result);
 
 		if (nextpc == pc)
 		  error (_("Infinite loop detected"));
@@ -1785,7 +1787,8 @@
 		result = ~operand2;
 		break;
 	      }
-	    nextpc = (CORE_ADDR) ADDR_BITS_REMOVE (result);
+	    nextpc = (CORE_ADDR) gdbarch_addr_bits_remove
+				   (current_gdbarch, result);
 
 	    if (nextpc == pc)
 	      error (_("Infinite loop detected"));
@@ -1828,7 +1831,7 @@
 		  nextpc = (CORE_ADDR) read_memory_integer ((CORE_ADDR) base,
 							    4);
 
-		  nextpc = ADDR_BITS_REMOVE (nextpc);
+		  nextpc = gdbarch_addr_bits_remove (current_gdbarch, nextpc);
 
 		  if (nextpc == pc)
 		    error (_("Infinite loop detected"));
@@ -1865,7 +1868,8 @@
 								  + offset),
 						       4);
 		  }
-		  nextpc = ADDR_BITS_REMOVE (nextpc);
+		  nextpc = gdbarch_addr_bits_remove
+			     (current_gdbarch, nextpc);
 		  if (nextpc == pc)
 		    error (_("Infinite loop detected"));
 		}
@@ -1881,7 +1885,7 @@
 	    if (bits (this_instr, 28, 31) == INST_NV)
 	      nextpc |= bit (this_instr, 24) << 1;
 
-	    nextpc = ADDR_BITS_REMOVE (nextpc);
+	    nextpc = gdbarch_addr_bits_remove (current_gdbarch, nextpc);
 	    if (nextpc == pc)
 	      error (_("Infinite loop detected"));
 	    break;
diff -urN src_neu/gdb/buildsym.c dev_neu/gdb/buildsym.c
--- src_neu/gdb/buildsym.c	2007-05-14 16:10:35.000000000 +0200
+++ dev_neu/gdb/buildsym.c	2007-06-08 06:47:33.000000000 +0200
@@ -756,7 +756,7 @@
 
   e = subfile->line_vector->item + subfile->line_vector->nitems++;
   e->line = line;
-  e->pc = ADDR_BITS_REMOVE(pc);
+  e->pc = gdbarch_addr_bits_remove (current_gdbarch, pc);
 }
 
 /* Needed in order to sort line tables from IBM xcoff files.  Sigh!  */
diff -urN src_neu/gdb/gdbarch.c dev_neu/gdb/gdbarch.c
--- src_neu/gdb/gdbarch.c	2007-06-08 05:38:50.000000000 +0200
+++ dev_neu/gdb/gdbarch.c	2007-06-08 06:47:33.000000000 +0200
@@ -661,12 +661,6 @@
   fprintf_unfiltered (file,
                       "gdbarch_dump: addr_bit = %s\n",
                       paddr_d (current_gdbarch->addr_bit));
-#ifdef ADDR_BITS_REMOVE
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "ADDR_BITS_REMOVE(addr)",
-                      XSTRING (ADDR_BITS_REMOVE (addr)));
-#endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: addr_bits_remove = <0x%lx>\n",
                       (long) current_gdbarch->addr_bits_remove);
diff -urN src_neu/gdb/gdbarch.h dev_neu/gdb/gdbarch.h
--- src_neu/gdb/gdbarch.h	2007-06-08 06:33:08.000000000 +0200
+++ dev_neu/gdb/gdbarch.h	2007-06-08 06:47:33.000000000 +0200
@@ -877,7 +877,7 @@
 
 /* On some machines there are bits in addresses which are not really
    part of the address, but are used by the kernel, the hardware, etc.
-   for special purposes.  ADDR_BITS_REMOVE takes out any such bits so
+   for special purposes.  gdbarch_addr_bits_remove takes out any such bits so
    we get a "real" address such as one would find in a symbol table.
    This is used only for addresses of instructions, and even then I'm
    not sure it's used in all contexts.  It exists to deal with there
@@ -888,15 +888,9 @@
 typedef CORE_ADDR (gdbarch_addr_bits_remove_ftype) (CORE_ADDR addr);
 extern CORE_ADDR gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr);
 extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_bits_remove_ftype *addr_bits_remove);
-#if !defined (GDB_TM_FILE) && defined (ADDR_BITS_REMOVE)
-#error "Non multi-arch definition of ADDR_BITS_REMOVE"
-#endif
-#if !defined (ADDR_BITS_REMOVE)
-#define ADDR_BITS_REMOVE(addr) (gdbarch_addr_bits_remove (current_gdbarch, addr))
-#endif
 
 /* It is not at all clear why SMASH_TEXT_ADDRESS is not folded into
-   ADDR_BITS_REMOVE. */
+   gdbarch_addr_bits_remove. */
 
 typedef CORE_ADDR (gdbarch_smash_text_address_ftype) (CORE_ADDR addr);
 extern CORE_ADDR gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr);
diff -urN src_neu/gdb/gdbarch.sh dev_neu/gdb/gdbarch.sh
--- src_neu/gdb/gdbarch.sh	2007-06-08 06:33:08.000000000 +0200
+++ dev_neu/gdb/gdbarch.sh	2007-06-08 06:47:33.000000000 +0200
@@ -588,16 +588,16 @@
 m::CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr, struct target_ops *targ:addr, targ::convert_from_func_ptr_addr_identity::0
 # On some machines there are bits in addresses which are not really
 # part of the address, but are used by the kernel, the hardware, etc.
-# for special purposes.  ADDR_BITS_REMOVE takes out any such bits so
+# for special purposes.  gdbarch_addr_bits_remove takes out any such bits so
 # we get a "real" address such as one would find in a symbol table.
 # This is used only for addresses of instructions, and even then I'm
 # not sure it's used in all contexts.  It exists to deal with there
 # being a few stray bits in the PC which would mislead us, not as some
 # sort of generic thing to handle alignment or segmentation (it's
 # possible it should be in TARGET_READ_PC instead).
-f:=:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr::core_addr_identity::0
+f::CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr::core_addr_identity::0
 # It is not at all clear why SMASH_TEXT_ADDRESS is not folded into
-# ADDR_BITS_REMOVE.
+# gdbarch_addr_bits_remove.
 f:=:CORE_ADDR:smash_text_address:CORE_ADDR addr:addr::core_addr_identity::0
 
 # FIXME/cagney/2001-01-18: This should be split in two.  A target method that
diff -urN src_neu/gdb/infrun.c dev_neu/gdb/infrun.c
--- src_neu/gdb/infrun.c	2007-06-08 05:38:50.000000000 +0200
+++ dev_neu/gdb/infrun.c	2007-06-08 06:54:07.000000000 +0200
@@ -2808,7 +2808,8 @@
 
   init_sal (&sr_sal);		/* initialize to zeros */
 
-  sr_sal.pc = ADDR_BITS_REMOVE (get_frame_pc (return_frame));
+  sr_sal.pc = gdbarch_addr_bits_remove
+		(current_gdbarch, get_frame_pc (return_frame));
   sr_sal.section = find_pc_overlay (sr_sal.pc);
 
   insert_step_resume_breakpoint_at_sal (sr_sal, get_frame_id (return_frame));
@@ -2840,7 +2841,8 @@
 
   init_sal (&sr_sal);		/* initialize to zeros */
 
-  sr_sal.pc = ADDR_BITS_REMOVE (frame_pc_unwind (next_frame));
+  sr_sal.pc = gdbarch_addr_bits_remove
+		(current_gdbarch, frame_pc_unwind (next_frame));
   sr_sal.section = find_pc_overlay (sr_sal.pc);
 
   insert_step_resume_breakpoint_at_sal (sr_sal, frame_unwind_id (next_frame));
diff -urN src_neu/gdb/mips-tdep.c dev_neu/gdb/mips-tdep.c
--- src_neu/gdb/mips-tdep.c	2007-06-08 06:33:08.000000000 +0200
+++ dev_neu/gdb/mips-tdep.c	2007-06-08 06:47:33.000000000 +0200
@@ -2245,7 +2245,7 @@
   int instlen;
   int seen_adjsp = 0;
 
-  pc = ADDR_BITS_REMOVE (pc);
+  pc = gdbarch_addr_bits_remove (current_gdbarch, pc);
   start_pc = pc;
   fence = start_pc - heuristic_fence_post;
   if (start_pc == 0)
diff -urN src_neu/gdb/monitor.c dev_neu/gdb/monitor.c
--- src_neu/gdb/monitor.c	2007-05-31 19:31:37.000000000 +0200
+++ dev_neu/gdb/monitor.c	2007-06-08 06:47:33.000000000 +0200
@@ -1388,7 +1388,7 @@
   monitor_debug ("MON write %d %s\n", len, paddr (memaddr));
 
   if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
-    memaddr = ADDR_BITS_REMOVE (memaddr);
+    memaddr = gdbarch_addr_bits_remove (current_gdbarch, memaddr);
 
   /* Use memory fill command for leading 0 bytes.  */
 
@@ -1787,7 +1787,7 @@
 		 paddr_nz (memaddr), (long) myaddr, len);
 
   if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
-    memaddr = ADDR_BITS_REMOVE (memaddr);
+    memaddr = gdbarch_addr_bits_remove (current_gdbarch, memaddr);
 
   if (current_monitor->flags & MO_GETMEM_READ_SINGLE)
     return monitor_read_memory_single (memaddr, myaddr, len);
@@ -2013,7 +2013,7 @@
     error (_("No set_break defined for this monitor"));
 
   if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
-    addr = ADDR_BITS_REMOVE (addr);
+    addr = gdbarch_addr_bits_remove (current_gdbarch, addr);
 
   /* Determine appropriate breakpoint size for this address.  */
   bp = gdbarch_breakpoint_from_pc (current_gdbarch, &addr, &bplen);
diff -urN src_neu/gdb/printcmd.c dev_neu/gdb/printcmd.c
--- src_neu/gdb/printcmd.c	2007-06-08 06:33:08.000000000 +0200
+++ dev_neu/gdb/printcmd.c	2007-06-08 06:47:33.000000000 +0200
@@ -1519,7 +1519,7 @@
       val = evaluate_expression (d->exp);
       addr = value_as_address (val);
       if (d->format.format == 'i')
-	addr = ADDR_BITS_REMOVE (addr);
+	addr = gdbarch_addr_bits_remove (current_gdbarch, addr);
 
       annotate_display_value ();
 
diff -urN src_neu/gdb/regcache.c dev_neu/gdb/regcache.c
--- src_neu/gdb/regcache.c	2007-06-08 06:33:08.000000000 +0200
+++ dev_neu/gdb/regcache.c	2007-06-08 06:47:33.000000000 +0200
@@ -900,7 +900,7 @@
   else if (PC_REGNUM >= 0)
     {
       CORE_ADDR raw_val = read_register_pid (PC_REGNUM, ptid);
-      pc_val = ADDR_BITS_REMOVE (raw_val);
+      pc_val = gdbarch_addr_bits_remove (current_gdbarch, raw_val);
     }
   else
     internal_error (__FILE__, __LINE__, _("read_pc_pid: Unable to find PC"));
diff -urN src_neu/gdb/remote-mips.c dev_neu/gdb/remote-mips.c
--- src_neu/gdb/remote-mips.c	2007-05-31 19:31:37.000000000 +0200
+++ dev_neu/gdb/remote-mips.c	2007-06-08 06:47:34.000000000 +0200
@@ -2404,7 +2404,7 @@
   int rpid, rerrflg, rresponse, rlen;
   int nfields;
 
-  addr = ADDR_BITS_REMOVE (addr);
+  addr = gdbarch_addr_bits_remove (current_gdbarch, addr);
 
   if (mips_monitor == MON_LSI)
     {
diff -urN src_neu/gdb/value.c dev_neu/gdb/value.c
--- src_neu/gdb/value.c	2007-05-31 19:11:18.000000000 +0200
+++ dev_neu/gdb/value.c	2007-06-08 06:47:34.000000000 +0200
@@ -962,10 +962,10 @@
   /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
      whether we want this to be true eventually.  */
 #if 0
-  /* ADDR_BITS_REMOVE is wrong if we are being called for a
+  /* gdbarch_addr_bits_remove is wrong if we are being called for a
      non-address (e.g. argument to "signal", "info break", etc.), or
      for pointers to char, in which the low bits *are* significant.  */
-  return ADDR_BITS_REMOVE (value_as_long (val));
+  return gdbarch_addr_bits_remove (current_gdbarch, value_as_long (val));
 #else
 
   /* There are several targets (IA-64, PowerPC, and others) which



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