summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-06-13 17:30:01 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-06-13 17:30:01 +0000
commit56c5a93512dec53231a6901c3313fa755ee02604 (patch)
tree80ac54c39e1e3e2373d1676ebd59ed8eb6b995f4
parent260a328196dd69da7313d3a29c2fa3b8d5be1485 (diff)
downloadgdb-56c5a93512dec53231a6901c3313fa755ee02604.tar.gz
2007-06-13 Markus Deuling <deuling@de.ibm.com>
* 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.
-rw-r--r--gdb/ChangeLog25
-rw-r--r--gdb/gdbarch.c7
-rw-r--r--gdb/gdbarch.h10
-rwxr-xr-xgdb/gdbarch.sh8
-rw-r--r--gdb/gdbtypes.c6
-rw-r--r--gdb/gnu-v3-abi.c3
-rw-r--r--gdb/hppa-hpux-tdep.c18
-rw-r--r--gdb/hppa-tdep.c19
-rw-r--r--gdb/jv-lang.c2
-rw-r--r--gdb/jv-valprint.c6
-rw-r--r--gdb/m68k-tdep.c13
-rw-r--r--gdb/mips-linux-tdep.c22
-rw-r--r--gdb/nto-tdep.c4
-rw-r--r--gdb/p-valprint.c3
-rw-r--r--gdb/printcmd.c8
-rw-r--r--gdb/procfs.c2
-rw-r--r--gdb/s390-nat.c2
-rw-r--r--gdb/solib-legacy.c2
-rw-r--r--gdb/solib-pa64.c2
-rw-r--r--gdb/solib-svr4.c6
-rw-r--r--gdb/solib.c2
21 files changed, 104 insertions, 66 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 52d6181e34f..da8af0aa973 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,28 @@
+2007-06-13 Markus Deuling <deuling@de.ibm.com>
+
+ * 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.
+
2007-06-13 Daniel Jacobowitz <dan@codesourcery.com>
* mips-tdep.c (mips_print_register): Remove unused ALL argument.
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 358d03b35ba..66498c54266 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -519,7 +519,7 @@ verify_gdbarch (struct gdbarch *current_gdbarch)
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;
@@ -1012,11 +1012,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
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 --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 36425bd9b45..6767bf73e2b 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -130,10 +130,10 @@ extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struc
/* 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_format (struct gdbarch *gdbarch, const struc
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 --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 9c297bd5769..d401b4d1e2a 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -403,17 +403,17 @@ v::const struct floatformat **:long_double_format:::::floatformats_ieee_double::
# 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 --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 377f73a0b86..9c093adbfcd 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -313,7 +313,7 @@ make_pointer_type (struct type *type, struct type **typeptr)
/* 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, struct type **typeptr)
/* 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 *type, struct type *domain,
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 --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index d7f00fc221c..0f9f420844a 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -117,7 +117,8 @@ build_gdb_vtable_type (struct gdbarch *arch)
/* 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 --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c
index ba2390cd6b0..1510d87edc9 100644
--- a/gdb/hppa-hpux-tdep.c
+++ b/gdb/hppa-hpux-tdep.c
@@ -316,12 +316,14 @@ hppa_hpux_skip_trampoline_code (CORE_ADDR pc)
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_ADDR pc)
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_ADDR pc)
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 frame_info *next_frame, CORE_ADDR base,
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 --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 7658aec2935..cf660adbfe7 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -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 *next_frame, void **this_cache)
/* 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 --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 17516e09750..fb2b419d191 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -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 --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
index 1a73534c52c..90861621309 100644
--- a/gdb/jv-valprint.c
+++ b/gdb/jv-valprint.c
@@ -95,7 +95,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
{
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, struct ui_file *stream, int format,
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, struct ui_file *stream, int format,
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 --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 9d9f334ad07..7fbfc003bde 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -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 --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 1c612464b82..8b851f3467a 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -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 --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 428dd8b112f..1949f6f5789 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -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 --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 5b791eb641a..79519b437a5 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -256,7 +256,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
/* 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 --git a/gdb/printcmd.c b/gdb/printcmd.c
index e156d8453f9..6da10aa1962 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -212,14 +212,14 @@ decode_format (char **string_ptr, int oformat, int osize)
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 --git a/gdb/procfs.c b/gdb/procfs.c
index 10baaf9223b..7916944eef7 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -5765,7 +5765,7 @@ info_proc_mappings (procinfo *pi, int summary)
{
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 --git a/gdb/s390-nat.c b/gdb/s390-nat.c
index 845b8dd612a..dc56945f709 100644
--- a/gdb/s390-nat.c
+++ b/gdb/s390-nat.c
@@ -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 --git a/gdb/solib-legacy.c b/gdb/solib-legacy.c
index 72af7cec559..5180936534b 100644
--- a/gdb/solib-legacy.c
+++ b/gdb/solib-legacy.c
@@ -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 --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c
index bccb52d695a..6f1a172ba39 100644
--- a/gdb/solib-pa64.c
+++ b/gdb/solib-pa64.c
@@ -211,7 +211,7 @@ read_dynamic_info (asection *dyninfo_sect, dld_cache_t *dld_cache_p)
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 --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index e2026388860..c531ccb1006 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -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);
}
diff --git a/gdb/solib.c b/gdb/solib.c
index d260c12ce78..4cdb3a532cc 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -725,7 +725,7 @@ info_sharedlibrary_command (char *ignore, int from_tty)
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);