* 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 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.
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;
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));
/* 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.
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 */
# 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
#
/* 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
/* 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. */
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;
}
/* 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
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));
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
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.
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);
}
}
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);
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);
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);
/* 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]",
{
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);
}
{
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));
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
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
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;
}
\f
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;
}
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;
}
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 *
/* 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);
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;
{
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";
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
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;
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);
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);
}
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);