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] Remove macro TARGET_PTR_BIT


Hello,

this patch removes TARGET_PTR_BIT macro from gdbarch.sh Tested by building on x86 (testsuite showed no regressions) and gdb_mbuild.sh

ChangeLog:

	* gdbarch.sh (TARGET_PTR_BIT): Replace with gdbarch_ptr_bit.
	* solib-svr4.c (svr4_truncate_ptr): Likewise.
	* solib-pa64.c (read_dynamic_info): Likewise.
	* solib-legacy.c (legacy_svr4_fetch_link_map_offsets): Likewise.
	* solib.c (info_sharedlibrary_command): Likewise.
	* s390-nat.c (SUBOFF): Likewise.
	* p-valprint.c (pascal_val_print): Likewise.
	* procfs.c (info_proc_mappings): Likewise.
	* printcmd.c (decode_format): Likewise.
	* nto-tdep.c (nto_truncate_ptr): Likewise.
	* mips-linux-tdep.c (mips_linux_get_longjmp_target)
	(mips64_linux_get_longjmp_target): Likewise.
	* m68k-tdep.c (m68k_get_longjmp_target): Likewise.
	* jv-valprint.c (java_value_print): Likewise.
	* jv-lang.c (get_java_object_header_size): Likewise.
	* hppa-tdep.c (skip_prologue_hard_way, hppa_frame_cache): Likewise.
	* hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code)
	(hppa_hpux_unwind_adjust_stub): Likewise.
	* gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
	* gdbtypes.c (make_pointer_type, make_reference_type)
	(smash_to_memberptr_type): 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 -urpN src/gdb/gdbarch.c dev/gdb/gdbarch.c
--- src/gdb/gdbarch.c	2007-06-12 18:59:38.000000000 +0200
+++ dev/gdb/gdbarch.c	2007-06-12 19:27:56.000000000 +0200
@@ -521,7 +521,7 @@ verify_gdbarch (struct gdbarch *current_
     current_gdbarch->long_double_format = floatformats_ieee_double;
   /* Skip verify of ptr_bit, invalid_p == 0 */
   if (current_gdbarch->addr_bit == 0)
-    current_gdbarch->addr_bit = TARGET_PTR_BIT;
+    current_gdbarch->addr_bit = gdbarch_ptr_bit (current_gdbarch);
   /* Skip verify of bfd_vma_bit, invalid_p == 0 */
   if (current_gdbarch->char_signed == -1)
     current_gdbarch->char_signed = 1;
@@ -1033,11 +1033,6 @@ gdbarch_dump (struct gdbarch *current_gd
   fprintf_unfiltered (file,
                       "gdbarch_dump: pseudo_register_write = <0x%lx>\n",
                       (long) current_gdbarch->pseudo_register_write);
-#ifdef TARGET_PTR_BIT
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: TARGET_PTR_BIT # %s\n",
-                      XSTRING (TARGET_PTR_BIT));
-#endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: ptr_bit = %s\n",
                       paddr_d (current_gdbarch->ptr_bit));
diff -urpN src/gdb/gdbarch.h dev/gdb/gdbarch.h
--- src/gdb/gdbarch.h	2007-06-12 18:59:38.000000000 +0200
+++ dev/gdb/gdbarch.h	2007-06-12 19:27:03.000000000 +0200
@@ -130,10 +130,10 @@ extern void set_gdbarch_long_double_form
 
 /* For most targets, a pointer on the target and its representation as an
    address in GDB have the same size and "look the same".  For such a
-   target, you need only set TARGET_PTR_BIT / ptr_bit and TARGET_ADDR_BIT
+   target, you need only set gdbarch_ptr_bit and TARGET_ADDR_BIT
    / addr_bit will be set from it.
   
-   If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably
+   If gdbarch_ptr_bit and TARGET_ADDR_BIT are different, you'll probably
    also need to set gdbarch_pointer_to_address and gdbarch_address_to_pointer
    as well.
   
@@ -141,12 +141,6 @@ extern void set_gdbarch_long_double_form
 
 extern int gdbarch_ptr_bit (struct gdbarch *gdbarch);
 extern void set_gdbarch_ptr_bit (struct gdbarch *gdbarch, int ptr_bit);
-#if !defined (GDB_TM_FILE) && defined (TARGET_PTR_BIT)
-#error "Non multi-arch definition of TARGET_PTR_BIT"
-#endif
-#if !defined (TARGET_PTR_BIT)
-#define TARGET_PTR_BIT (gdbarch_ptr_bit (current_gdbarch))
-#endif
 
 /* addr_bit is the size of a target address as represented in gdb */
 
diff -urpN src/gdb/gdbarch.sh dev/gdb/gdbarch.sh
--- src/gdb/gdbarch.sh	2007-06-12 18:59:38.000000000 +0200
+++ dev/gdb/gdbarch.sh	2007-06-12 19:26:30.000000000 +0200
@@ -403,17 +403,17 @@ v::const struct floatformat **:long_doub
 
 # For most targets, a pointer on the target and its representation as an
 # address in GDB have the same size and "look the same".  For such a
-# target, you need only set TARGET_PTR_BIT / ptr_bit and TARGET_ADDR_BIT
+# target, you need only set gdbarch_ptr_bit and TARGET_ADDR_BIT
 # / addr_bit will be set from it.
 #
-# If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably
+# If gdbarch_ptr_bit and TARGET_ADDR_BIT are different, you'll probably
 # also need to set gdbarch_pointer_to_address and gdbarch_address_to_pointer
 # as well.
 #
 # ptr_bit is the size of a pointer on the target
-v:TARGET_PTR_BIT:int:ptr_bit:::8 * sizeof (void*):current_gdbarch->int_bit::0
+v::int:ptr_bit:::8 * sizeof (void*):current_gdbarch->int_bit::0
 # addr_bit is the size of a target address as represented in gdb
-v:TARGET_ADDR_BIT:int:addr_bit:::8 * sizeof (void*):0:TARGET_PTR_BIT:
+v:TARGET_ADDR_BIT:int:addr_bit:::8 * sizeof (void*):0:gdbarch_ptr_bit (current_gdbarch):
 # Number of bits in a BFD_VMA for the target object file format.
 v:TARGET_BFD_VMA_BIT:int:bfd_vma_bit:::8 * sizeof (void*):TARGET_ARCHITECTURE->bits_per_address::0
 #
diff -urpN src/gdb/gdbtypes.c dev/gdb/gdbtypes.c
--- src/gdb/gdbtypes.c	2007-06-12 18:37:17.000000000 +0200
+++ dev/gdb/gdbtypes.c	2007-06-12 19:25:35.000000000 +0200
@@ -313,7 +313,7 @@ make_pointer_type (struct type *type, st
 
   /* FIXME!  Assume the machine has only one representation for pointers!  */
 
-  TYPE_LENGTH (ntype) = TARGET_PTR_BIT / TARGET_CHAR_BIT;
+  TYPE_LENGTH (ntype) = gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT;
   TYPE_CODE (ntype) = TYPE_CODE_PTR;
 
   /* Mark pointers as unsigned.  The target converts between pointers
@@ -392,7 +392,7 @@ make_reference_type (struct type *type, 
   /* FIXME!  Assume the machine has only one representation for references,
      and that it matches the (only) representation for pointers!  */
 
-  TYPE_LENGTH (ntype) = TARGET_PTR_BIT / TARGET_CHAR_BIT;
+  TYPE_LENGTH (ntype) = gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT;
   TYPE_CODE (ntype) = TYPE_CODE_REF;
 
   if (!TYPE_REFERENCE_TYPE (type))	/* Remember it, if don't have one.  */
@@ -1073,7 +1073,7 @@ smash_to_memberptr_type (struct type *ty
   TYPE_DOMAIN_TYPE (type) = domain;
   /* Assume that a data member pointer is the same size as a normal
      pointer.  */
-  TYPE_LENGTH (type) = TARGET_PTR_BIT / TARGET_CHAR_BIT;
+  TYPE_LENGTH (type) = gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT;
   TYPE_CODE (type) = TYPE_CODE_MEMBERPTR;
 }
 
diff -urpN src/gdb/gnu-v3-abi.c dev/gdb/gnu-v3-abi.c
--- src/gdb/gnu-v3-abi.c	2007-06-11 11:31:56.000000000 +0200
+++ dev/gdb/gnu-v3-abi.c	2007-06-12 19:24:12.000000000 +0200
@@ -117,7 +117,8 @@ build_gdb_vtable_type (struct gdbarch *a
 
   /* ARCH can't give us the true ptrdiff_t type, so we guess.  */
   struct type *ptrdiff_type
-    = init_type (TYPE_CODE_INT, TARGET_PTR_BIT / TARGET_CHAR_BIT, 0,
+    = init_type (TYPE_CODE_INT,
+		 gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT, 0,
                  "ptrdiff_t", 0);
 
   /* We assume no padding is necessary, since GDB doesn't know
diff -urpN src/gdb/hppa-hpux-tdep.c dev/gdb/hppa-hpux-tdep.c
--- src/gdb/hppa-hpux-tdep.c	2007-06-06 05:21:54.000000000 +0200
+++ dev/gdb/hppa-hpux-tdep.c	2007-06-12 19:23:32.000000000 +0200
@@ -316,12 +316,14 @@ hppa_hpux_skip_trampoline_code (CORE_ADD
          the PLT entry for this function, not the address of the function
          itself.  Bit 31 has meaning too, but only for MPE.  */
       if (pc & 0x2)
-	pc = (CORE_ADDR) read_memory_integer (pc & ~0x3, TARGET_PTR_BIT / 8);
+	pc = (CORE_ADDR) read_memory_integer
+			   (pc & ~0x3, gdbarch_ptr_bit (current_gdbarch) / 8);
     }
   if (pc == hppa_symbol_address("$$dyncall_external"))
     {
       pc = (CORE_ADDR) read_register (22);
-      pc = (CORE_ADDR) read_memory_integer (pc & ~0x3, TARGET_PTR_BIT / 8);
+      pc = (CORE_ADDR) read_memory_integer
+			 (pc & ~0x3, gdbarch_ptr_bit (current_gdbarch) / 8);
     }
   else if (pc == hppa_symbol_address("_sr4export"))
     pc = (CORE_ADDR) (read_register (22));
@@ -513,7 +515,8 @@ hppa_hpux_skip_trampoline_code (CORE_ADD
       else if ((curr_inst & 0xffe0f000) == 0xe840d000)
 	{
 	  return (read_memory_integer
-		  (read_register (HPPA_SP_REGNUM) - 24, TARGET_PTR_BIT / 8)) & ~0x3;
+		  (read_register (HPPA_SP_REGNUM) - 24,
+		   gdbarch_ptr_bit (current_gdbarch) / 8)) & ~0x3;
 	}
 
       /* What about be,n 0(sr0,%rp)?  It's just another way we return to
@@ -525,7 +528,8 @@ hppa_hpux_skip_trampoline_code (CORE_ADD
 	     I guess we could check for the previous instruction being
 	     mtsp %r1,%sr0 if we want to do sanity checking.  */
 	  return (read_memory_integer
-		  (read_register (HPPA_SP_REGNUM) - 24, TARGET_PTR_BIT / 8)) & ~0x3;
+		  (read_register (HPPA_SP_REGNUM) - 24,
+		   gdbarch_ptr_bit (current_gdbarch) / 8)) & ~0x3;
 	}
 
       /* Haven't found the branch yet, but we're still in the stub.
@@ -1430,13 +1434,15 @@ hppa_hpux_unwind_adjust_stub (struct fra
   u = find_unwind_entry (val);
   if (u && u->stub_unwind.stub_type == EXPORT)
     {
-      stubpc = read_memory_integer (base - 24, TARGET_PTR_BIT / 8);
+      stubpc = read_memory_integer
+		 (base - 24, gdbarch_ptr_bit (current_gdbarch) / 8);
       trad_frame_set_value (saved_regs, HPPA_PCOQ_HEAD_REGNUM, stubpc);
     }
   else if (hppa_symbol_address ("__gcc_plt_call") 
            == get_pc_function_start (val))
     {
-      stubpc = read_memory_integer (base - 8, TARGET_PTR_BIT / 8);
+      stubpc = read_memory_integer
+		 (base - 8, gdbarch_ptr_bit (current_gdbarch) / 8);
       trad_frame_set_value (saved_regs, HPPA_PCOQ_HEAD_REGNUM, stubpc);
     }
 }
diff -urpN src/gdb/hppa-tdep.c dev/gdb/hppa-tdep.c
--- src/gdb/hppa-tdep.c	2007-06-11 11:31:56.000000000 +0200
+++ dev/gdb/hppa-tdep.c	2007-06-12 19:21:18.000000000 +0200
@@ -1601,9 +1601,11 @@ restart:
 
          FIXME.  Can still die if we have a mix of GR and FR argument
          stores!  */
-      if (reg_num >= (TARGET_PTR_BIT == 64 ? 19 : 23) && reg_num <= 26)
+      if (reg_num >= (gdbarch_ptr_bit (current_gdbarch) == 64 ? 19 : 23)
+	  && reg_num <= 26)
 	{
-	  while (reg_num >= (TARGET_PTR_BIT == 64 ? 19 : 23) && reg_num <= 26)
+	  while (reg_num >= (gdbarch_ptr_bit (current_gdbarch) == 64 ? 19 : 23)
+		 && reg_num <= 26)
 	    {
 	      pc += 4;
 	      status = read_memory_nobpt (pc, buf, 4);
@@ -1630,7 +1632,8 @@ restart:
          save.  */
       if ((inst & 0xfc000000) == 0x34000000
 	  && inst_saves_fr (next_inst) >= 4
-	  && inst_saves_fr (next_inst) <= (TARGET_PTR_BIT == 64 ? 11 : 7))
+	  && inst_saves_fr (next_inst)
+	       <= (gdbarch_ptr_bit (current_gdbarch) == 64 ? 11 : 7))
 	{
 	  /* So we drop into the code below in a reasonable state.  */
 	  reg_num = inst_saves_fr (next_inst);
@@ -1641,9 +1644,12 @@ restart:
          This is a kludge as on the HP compiler sets this bit and it
          never does prologue scheduling.  So once we see one, skip past
          all of them.  */
-      if (reg_num >= 4 && reg_num <= (TARGET_PTR_BIT == 64 ? 11 : 7))
+      if (reg_num >= 4
+	  && reg_num <= (gdbarch_ptr_bit (current_gdbarch) == 64 ? 11 : 7))
 	{
-	  while (reg_num >= 4 && reg_num <= (TARGET_PTR_BIT == 64 ? 11 : 7))
+	  while (reg_num >= 4
+		 && reg_num
+		      <= (gdbarch_ptr_bit (current_gdbarch) == 64 ? 11 : 7))
 	    {
 	      pc += 8;
 	      status = read_memory_nobpt (pc, buf, 4);
@@ -2101,7 +2107,8 @@ hppa_frame_cache (struct frame_info *nex
             /* Both we're expecting the SP to be saved and the SP has been
 	       saved.  The entry SP value is saved at this frame's SP
 	       address.  */
-            cache->base = read_memory_integer (this_sp, TARGET_PTR_BIT / 8);
+            cache->base = read_memory_integer
+			    (this_sp, gdbarch_ptr_bit (current_gdbarch) / 8);
 
 	    if (hppa_debug)
 	      fprintf_unfiltered (gdb_stdlog, " (base=0x%s) [saved]",
diff -urpN src/gdb/jv-lang.c dev/gdb/jv-lang.c
--- src/gdb/jv-lang.c	2007-05-14 18:44:26.000000000 +0200
+++ dev/gdb/jv-lang.c	2007-06-12 19:19:12.000000000 +0200
@@ -591,7 +591,7 @@ get_java_object_header_size (void)
 {
   struct type *objtype = get_java_object_type ();
   if (objtype == NULL)
-    return (2 * TARGET_PTR_BIT / TARGET_CHAR_BIT);
+    return (2 * gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT);
   else
     return TYPE_LENGTH (objtype);
 }
diff -urpN src/gdb/jv-valprint.c dev/gdb/jv-valprint.c
--- src/gdb/jv-valprint.c	2007-01-09 18:58:51.000000000 +0100
+++ dev/gdb/jv-valprint.c	2007-06-12 19:18:25.000000000 +0200
@@ -95,7 +95,7 @@ java_value_print (struct value *val, str
 	    {
 	      gdb_byte *buf;
 
-	      buf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT);
+	      buf = alloca (gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT);
 	      fputs_filtered (", ", stream);
 	      wrap_here (n_spaces (2));
 
@@ -104,7 +104,7 @@ java_value_print (struct value *val, str
 	      else
 		{
 		  read_memory (address, buf, sizeof (buf));
-		  address += TARGET_PTR_BIT / HOST_CHAR_BIT;
+		  address += gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT;
 		  /* FIXME: cagney/2003-05-24: Bogus or what.  It
                      pulls a host sized pointer out of the target and
                      then extracts that as an address (while assuming
@@ -115,7 +115,7 @@ java_value_print (struct value *val, str
 	      for (reps = 1; i + reps < length; reps++)
 		{
 		  read_memory (address, buf, sizeof (buf));
-		  address += TARGET_PTR_BIT / HOST_CHAR_BIT;
+		  address += gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT;
 		  /* FIXME: cagney/2003-05-24: Bogus or what.  It
                      pulls a host sized pointer out of the target and
                      then extracts that as an address (while assuming
diff -urpN src/gdb/m68k-tdep.c dev/gdb/m68k-tdep.c
--- src/gdb/m68k-tdep.c	2007-06-08 05:38:50.000000000 +0200
+++ dev/gdb/m68k-tdep.c	2007-06-12 19:17:21.000000000 +0200
@@ -962,20 +962,23 @@ m68k_get_longjmp_target (CORE_ADDR *pc)
       return 0;
     }
 
-  buf = alloca (TARGET_PTR_BIT / TARGET_CHAR_BIT);
+  buf = alloca (gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT);
   sp = read_register (SP_REGNUM);
 
   if (target_read_memory (sp + SP_ARG0,	/* Offset of first arg on stack */
-			  buf, TARGET_PTR_BIT / TARGET_CHAR_BIT))
+			  buf,
+			  gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT))
     return 0;
 
-  jb_addr = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+  jb_addr = extract_unsigned_integer (buf, gdbarch_ptr_bit (current_gdbarch)
+					     / TARGET_CHAR_BIT);
 
   if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
-			  TARGET_PTR_BIT / TARGET_CHAR_BIT))
+			  gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT))
     return 0;
 
-  *pc = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+  *pc = extract_unsigned_integer (buf, gdbarch_ptr_bit (current_gdbarch)
+					 / TARGET_CHAR_BIT);
   return 1;
 }
 
diff -urpN src/gdb/mips-linux-tdep.c dev/gdb/mips-linux-tdep.c
--- src/gdb/mips-linux-tdep.c	2007-05-31 22:58:08.000000000 +0200
+++ dev/gdb/mips-linux-tdep.c	2007-06-12 19:15:50.000000000 +0200
@@ -54,16 +54,19 @@ static int
 mips_linux_get_longjmp_target (CORE_ADDR *pc)
 {
   CORE_ADDR jb_addr;
-  char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
+  char buf[gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT];
 
   jb_addr = read_register (MIPS_A0_REGNUM);
 
   if (target_read_memory (jb_addr
-			  + MIPS_LINUX_JB_PC * MIPS_LINUX_JB_ELEMENT_SIZE,
-			  buf, TARGET_PTR_BIT / TARGET_CHAR_BIT))
+			    + MIPS_LINUX_JB_PC * MIPS_LINUX_JB_ELEMENT_SIZE,
+			  buf,
+			  gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT))
     return 0;
 
-  *pc = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+  *pc = extract_unsigned_integer (buf,
+				  gdbarch_ptr_bit (current_gdbarch)
+				    / TARGET_CHAR_BIT);
 
   return 1;
 }
@@ -245,16 +248,19 @@ static int
 mips64_linux_get_longjmp_target (CORE_ADDR *pc)
 {
   CORE_ADDR jb_addr;
-  void *buf = alloca (TARGET_PTR_BIT / TARGET_CHAR_BIT);
-  int element_size = TARGET_PTR_BIT == 32 ? 4 : 8;
+  void *buf = alloca (gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT);
+  int element_size = gdbarch_ptr_bit (current_gdbarch) == 32 ? 4 : 8;
 
   jb_addr = read_register (MIPS_A0_REGNUM);
 
   if (target_read_memory (jb_addr + MIPS64_LINUX_JB_PC * element_size,
-			  buf, TARGET_PTR_BIT / TARGET_CHAR_BIT))
+			  buf,
+			  gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT))
     return 0;
 
-  *pc = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+  *pc = extract_unsigned_integer (buf,
+				  gdbarch_ptr_bit (current_gdbarch)
+				    / TARGET_CHAR_BIT);
 
   return 1;
 }
diff -urpN src/gdb/nto-tdep.c dev/gdb/nto-tdep.c
--- src/gdb/nto-tdep.c	2007-05-31 22:58:08.000000000 +0200
+++ dev/gdb/nto-tdep.c	2007-06-12 19:13:48.000000000 +0200
@@ -270,12 +270,12 @@ LM_ADDR (struct so_list *so)
 static CORE_ADDR
 nto_truncate_ptr (CORE_ADDR addr)
 {
-  if (TARGET_PTR_BIT == sizeof (CORE_ADDR) * 8)
+  if (gdbarch_ptr_bit (current_gdbarch) == sizeof (CORE_ADDR) * 8)
     /* We don't need to truncate anything, and the bit twiddling below
        will fail due to overflow problems.  */
     return addr;
   else
-    return addr & (((CORE_ADDR) 1 << TARGET_PTR_BIT) - 1);
+    return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (current_gdbarch)) - 1);
 }
 
 Elf_Internal_Phdr *
diff -urpN src/gdb/printcmd.c dev/gdb/printcmd.c
--- src/gdb/printcmd.c	2007-06-11 11:31:58.000000000 +0200
+++ dev/gdb/printcmd.c	2007-06-12 19:13:09.000000000 +0200
@@ -212,14 +212,14 @@ decode_format (char **string_ptr, int of
       case 'a':
       case 's':
 	/* Pick the appropriate size for an address.  */
-	if (TARGET_PTR_BIT == 64)
+	if (gdbarch_ptr_bit (current_gdbarch) == 64)
 	  val.size = osize ? 'g' : osize;
-	else if (TARGET_PTR_BIT == 32)
+	else if (gdbarch_ptr_bit (current_gdbarch) == 32)
 	  val.size = osize ? 'w' : osize;
-	else if (TARGET_PTR_BIT == 16)
+	else if (gdbarch_ptr_bit (current_gdbarch) == 16)
 	  val.size = osize ? 'h' : osize;
 	else
-	  /* Bad value for TARGET_PTR_BIT.  */
+	  /* Bad value for gdbarch_ptr_bit.  */
 	  internal_error (__FILE__, __LINE__,
 			  _("failed internal consistency check"));
 	break;
diff -urpN src/gdb/procfs.c dev/gdb/procfs.c
--- src/gdb/procfs.c	2007-06-08 05:38:51.000000000 +0200
+++ dev/gdb/procfs.c	2007-06-12 19:11:39.000000000 +0200
@@ -5765,7 +5765,7 @@ info_proc_mappings (procinfo *pi, int su
 {
   char *header_fmt_string;
 
-  if (TARGET_PTR_BIT == 32)
+  if (gdbarch_ptr_bit (current_gdbarch) == 32)
     header_fmt_string = "\t%10s %10s %10s %10s %7s\n";
   else
     header_fmt_string = "  %18s %18s %10s %10s %7s\n";
diff -urpN src/gdb/p-valprint.c dev/gdb/p-valprint.c
--- src/gdb/p-valprint.c	2007-03-22 00:57:14.000000000 +0100
+++ dev/gdb/p-valprint.c	2007-06-12 19:11:03.000000000 +0200
@@ -256,7 +256,8 @@ pascal_val_print (struct type *type, con
 	  /* Extract the address, assume that it is unsigned.  */
 	  deprecated_print_address_numeric
 	    (extract_unsigned_integer (valaddr + embedded_offset,
-				       TARGET_PTR_BIT / HOST_CHAR_BIT),
+				       gdbarch_ptr_bit (current_gdbarch)
+					 / HOST_CHAR_BIT),
 	     1, stream);
 	  if (deref_ref)
 	    fputs_filtered (": ", stream);
diff -urpN src/gdb/s390-nat.c dev/gdb/s390-nat.c
--- src/gdb/s390-nat.c	2007-05-06 16:34:38.000000000 +0200
+++ dev/gdb/s390-nat.c	2007-06-12 19:10:03.000000000 +0200
@@ -53,7 +53,7 @@
    to make them look like 32-bit registers.  */
 #ifdef __s390x__
 #define SUBOFF(i) \
-	((TARGET_PTR_BIT == 32 \
+	((gdbarch_ptr_bit (current_gdbarch) == 32 \
 	  && ((i) == S390_PSWA_REGNUM \
 	      || ((i) >= S390_R0_REGNUM && (i) <= S390_R15_REGNUM)))? 4 : 0)
 #else
diff -urpN src/gdb/solib.c dev/gdb/solib.c
--- src/gdb/solib.c	2007-05-16 16:07:56.000000000 +0200
+++ dev/gdb/solib.c	2007-06-12 19:09:27.000000000 +0200
@@ -725,7 +725,7 @@ info_sharedlibrary_command (char *ignore
   int addr_width;
 
   /* "0x", a little whitespace, and two hex digits per byte of pointers.  */
-  addr_width = 4 + (TARGET_PTR_BIT / 4);
+  addr_width = 4 + (gdbarch_ptr_bit (current_gdbarch) / 4);
 
   update_solib_list (from_tty, 0);
 
diff -urpN src/gdb/solib-legacy.c dev/gdb/solib-legacy.c
--- src/gdb/solib-legacy.c	2007-04-10 10:47:53.000000000 +0200
+++ dev/gdb/solib-legacy.c	2007-06-12 19:08:57.000000000 +0200
@@ -115,7 +115,7 @@ legacy_svr4_fetch_link_map_offsets (void
       if (bfd_get_arch_size (exec_bfd) == 32)
 	return lmp32;
     }
-  if (TARGET_PTR_BIT == 32)
+  if (gdbarch_ptr_bit (current_gdbarch) == 32)
     return lmp32;
 #endif
   return lmp;
diff -urpN src/gdb/solib-pa64.c dev/gdb/solib-pa64.c
--- src/gdb/solib-pa64.c	2007-01-09 18:58:58.000000000 +0100
+++ dev/gdb/solib-pa64.c	2007-06-12 19:08:17.000000000 +0200
@@ -211,7 +211,7 @@ read_dynamic_info (asection *dyninfo_sec
       CORE_ADDR	dyn_ptr;
       char *pbuf;
 
-      pbuf = alloca (TARGET_PTR_BIT / HOST_CHAR_BIT);
+      pbuf = alloca (gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT);
       dyn_tag = bfd_h_get_64 (symfile_objfile->obfd, 
 			      (bfd_byte*) &x_dynp->d_tag);
 
diff -urpN src/gdb/solib-svr4.c dev/gdb/solib-svr4.c
--- src/gdb/solib-svr4.c	2007-06-04 05:41:43.000000000 +0200
+++ dev/gdb/solib-svr4.c	2007-06-12 19:07:16.000000000 +0200
@@ -1405,17 +1405,17 @@ svr4_free_so (struct so_list *so)
    natural pointer/address correspondence.  (For example, on the MIPS,
    converting a 32-bit pointer to a 64-bit CORE_ADDR requires you to
    sign-extend the value.  There, simply truncating the bits above
-   TARGET_PTR_BIT, as we do below, is no good.)  This should probably
+   gdbarch_ptr_bit, as we do below, is no good.)  This should probably
    be a new gdbarch method or something.  */
 static CORE_ADDR
 svr4_truncate_ptr (CORE_ADDR addr)
 {
-  if (TARGET_PTR_BIT == sizeof (CORE_ADDR) * 8)
+  if (gdbarch_ptr_bit (current_gdbarch) == sizeof (CORE_ADDR) * 8)
     /* We don't need to truncate anything, and the bit twiddling below
        will fail due to overflow problems.  */
     return addr;
   else
-    return addr & (((CORE_ADDR) 1 << TARGET_PTR_BIT) - 1);
+    return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (current_gdbarch)) - 1);
 }
 
 


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