* gdbarch.sh (TARGET_ADDR_BIT): Replace by gdbarch_addr_bit.
* valops.c (value_cast): Likewise.
* utils.c (strlen_paddr, paddr, paddr_nz, paddress): Likewise.
* ui-out.c (ui_out_field_core_addr): Likewise.
* tracepoint.c (tracepoints_info): Likewise.
* symtab.c (print_msymbol_info): Likewise.
* solib-irix.c (irix_current_sos)
(irix_open_symbol_file_object): Likewise.
* remote.c (build_remote_gdbarch_data): Likewise.
* prologue-value.c (make_pv_area): Likewise.
* procfs.c (info_mappings_callback): Likewise.
* printcmd.c (print_scalar_formatted)
(deprecated_print_address_numeric): Likewise.
* memattr.c (mem_info_command): Likewise.
* linux-nat.c (linux_nat_info_proc_cmd): Likewise.
* gdbtypes.c (build_flt, gdbtypes_post_init): Likewise.
* exec.c (print_section_info): Likewise.
* dwarf2read.c (read_subrange_type): Likewise.
* dwarf2loc.c (find_location_expression): Likewise.
* dwarf2expr.c (dwarf2_read_address, unsigned_address_type)
(signed_address_type, execute_stack_op): Likewise.
* breakpoint.c (print_one_breakpoint, breakpoint_1): Likewise.
* gdbarch.c, gdbarch.h: Regenerate.
+2007-06-13 Markus Deuling <deuling@de.ibm.com>
+
+ * gdbarch.sh (TARGET_ADDR_BIT): Replace by gdbarch_addr_bit.
+ * valops.c (value_cast): Likewise.
+ * utils.c (strlen_paddr, paddr, paddr_nz, paddress): Likewise.
+ * ui-out.c (ui_out_field_core_addr): Likewise.
+ * tracepoint.c (tracepoints_info): Likewise.
+ * symtab.c (print_msymbol_info): Likewise.
+ * solib-irix.c (irix_current_sos)
+ (irix_open_symbol_file_object): Likewise.
+ * remote.c (build_remote_gdbarch_data): Likewise.
+ * prologue-value.c (make_pv_area): Likewise.
+ * procfs.c (info_mappings_callback): Likewise.
+ * printcmd.c (print_scalar_formatted)
+ (deprecated_print_address_numeric): Likewise.
+ * memattr.c (mem_info_command): Likewise.
+ * linux-nat.c (linux_nat_info_proc_cmd): Likewise.
+ * gdbtypes.c (build_flt, gdbtypes_post_init): Likewise.
+ * exec.c (print_section_info): Likewise.
+ * dwarf2read.c (read_subrange_type): Likewise.
+ * dwarf2loc.c (find_location_expression): Likewise.
+ * dwarf2expr.c (dwarf2_read_address, unsigned_address_type)
+ (signed_address_type, execute_stack_op): Likewise.
+ * breakpoint.c (print_one_breakpoint, breakpoint_1): Likewise.
+ * gdbarch.c, gdbarch.h: Regenerate.
+
2007-06-13 Markus Deuling <deuling@de.ibm.com>
* gdbarch.sh (TARGET_ARCHITECTURE): Replace by gdbarch_bfd_arch_info.
strcpy (wrap_indent, " ");
if (addressprint)
{
- if (TARGET_ADDR_BIT <= 32)
+ if (gdbarch_addr_bit (current_gdbarch) <= 32)
strcat (wrap_indent, " ");
else
strcat (wrap_indent, " ");
{
if (nr_printable_breakpoints > 0)
annotate_field (4);
- if (TARGET_ADDR_BIT <= 32)
+ if (gdbarch_addr_bit (current_gdbarch) <= 32)
ui_out_table_header (uiout, 10, ui_left, "addr", "Address");/* 5 */
else
ui_out_table_header (uiout, 18, ui_left, "addr", "Address");/* 5 */
{
CORE_ADDR result;
- if (buf_end - buf < TARGET_ADDR_BIT / TARGET_CHAR_BIT)
+ if (buf_end - buf < gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT)
error (_("dwarf2_read_address: Corrupted DWARF expression."));
- *bytes_read = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
+ *bytes_read = gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT;
/* For most architectures, calling extract_unsigned_integer() alone
is sufficient for extracting an address. However, some
(unsigned_address_type (),
extract_unsigned_integer
(buf,
- TARGET_ADDR_BIT / TARGET_CHAR_BIT)));
+ gdbarch_addr_bit (current_gdbarch)
+ / TARGET_CHAR_BIT)));
return result;
}
static struct type *
unsigned_address_type (void)
{
- switch (TARGET_ADDR_BIT / TARGET_CHAR_BIT)
+ switch (gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT)
{
case 2:
return builtin_type_uint16;
static struct type *
signed_address_type (void)
{
- switch (TARGET_ADDR_BIT / TARGET_CHAR_BIT)
+ switch (gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT)
{
case 2:
return builtin_type_int16;
{
case DW_OP_deref:
{
- gdb_byte *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+ gdb_byte *buf = alloca (gdbarch_addr_bit (current_gdbarch)
+ / TARGET_CHAR_BIT);
int bytes_read;
(ctx->read_mem) (ctx->baton, buf, result,
- TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+ gdbarch_addr_bit (current_gdbarch)
+ / TARGET_CHAR_BIT);
result = dwarf2_read_address (buf,
- buf + (TARGET_ADDR_BIT
+ buf + (gdbarch_addr_bit
+ (current_gdbarch)
/ TARGET_CHAR_BIT),
&bytes_read);
}
case DW_OP_deref_size:
{
- gdb_byte *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+ gdb_byte *buf
+ = alloca (gdbarch_addr_bit (current_gdbarch)
+ / TARGET_CHAR_BIT);
int bytes_read;
(ctx->read_mem) (ctx->baton, buf, result, *op_ptr++);
result = dwarf2_read_address (buf,
- buf + (TARGET_ADDR_BIT
+ buf + (gdbarch_addr_bit
+ (current_gdbarch)
/ TARGET_CHAR_BIT),
&bytes_read);
}
CORE_ADDR low, high;
gdb_byte *loc_ptr, *buf_end;
int length;
- unsigned int addr_size = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
+ unsigned int addr_size = gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT;
CORE_ADDR base_mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
/* Adjust base_address for relocatable objects. */
CORE_ADDR base_offset = ANOFFSET (baton->objfile->section_offsets,
{
complaint (&symfile_complaints,
_("DW_AT_type missing from DW_TAG_subrange_type"));
- base_type = dwarf_base_type (DW_ATE_signed, TARGET_ADDR_BIT / 8, cu);
+ base_type
+ = dwarf_base_type (DW_ATE_signed,
+ gdbarch_addr_bit (current_gdbarch) / 8, cu);
}
if (cu->language == language_fortran)
print_section_info (struct target_ops *t, bfd *abfd)
{
struct section_table *p;
- /* FIXME: 16 is not wide enough when TARGET_ADDR_BIT > 64. */
- int wid = TARGET_ADDR_BIT <= 32 ? 8 : 16;
+ /* FIXME: 16 is not wide enough when gdbarch_addr_bit > 64. */
+ int wid = gdbarch_addr_bit (current_gdbarch) <= 32 ? 8 : 16;
printf_filtered ("\t`%s', ", bfd_get_filename (abfd));
wrap_here (" ");
fprintf_unfiltered (file,
"gdbarch_dump: GDB_TM_FILE = %s\n",
gdb_tm_file);
-#ifdef TARGET_ADDR_BIT
- fprintf_unfiltered (file,
- "gdbarch_dump: TARGET_ADDR_BIT # %s\n",
- XSTRING (TARGET_ADDR_BIT));
-#endif
fprintf_unfiltered (file,
"gdbarch_dump: addr_bit = %s\n",
paddr_d (current_gdbarch->addr_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 gdbarch_ptr_bit and TARGET_ADDR_BIT
+ target, you need only set gdbarch_ptr_bit and gdbarch_addr_bit
/ addr_bit will be set from it.
- If gdbarch_ptr_bit and TARGET_ADDR_BIT are different, you'll probably
+ If gdbarch_ptr_bit and gdbarch_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_addr_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_addr_bit (struct gdbarch *gdbarch, int addr_bit);
-#if !defined (GDB_TM_FILE) && defined (TARGET_ADDR_BIT)
-#error "Non multi-arch definition of TARGET_ADDR_BIT"
-#endif
-#if !defined (TARGET_ADDR_BIT)
-#define TARGET_ADDR_BIT (gdbarch_addr_bit (current_gdbarch))
-#endif
/* Number of bits in a BFD_VMA for the target object file format. */
# 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 gdbarch_ptr_bit and TARGET_ADDR_BIT
+# target, you need only set gdbarch_ptr_bit and gdbarch_addr_bit
# / addr_bit will be set from it.
#
-# If gdbarch_ptr_bit and TARGET_ADDR_BIT are different, you'll probably
+# If gdbarch_ptr_bit and gdbarch_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::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:gdbarch_ptr_bit (current_gdbarch):
+v::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::int:bfd_vma_bit:::8 * sizeof (void*):gdbarch_bfd_arch_info (current_gdbarch)->bits_per_address::0
#
builtin_type_void_func_ptr
= lookup_pointer_type (lookup_function_type (builtin_type_void));
builtin_type_CORE_ADDR =
- init_type (TYPE_CODE_INT, TARGET_ADDR_BIT / 8,
+ init_type (TYPE_CODE_INT, gdbarch_addr_bit (current_gdbarch) / 8,
TYPE_FLAG_UNSIGNED,
"__CORE_ADDR", (struct objfile *) NULL);
builtin_type_bfd_vma =
builtin_type->builtin_func_ptr
= lookup_pointer_type (lookup_function_type (builtin_type->builtin_void));
builtin_type->builtin_core_addr =
- init_type (TYPE_CODE_INT, TARGET_ADDR_BIT / 8,
+ init_type (TYPE_CODE_INT, gdbarch_addr_bit (current_gdbarch) / 8,
TYPE_FLAG_UNSIGNED,
"__CORE_ADDR", (struct objfile *) NULL);
char permissions[8], device[8], filename[MAXPATHLEN];
printf_filtered (_("Mapped address spaces:\n\n"));
- if (TARGET_ADDR_BIT == 32)
+ if (gdbarch_addr_bit (current_gdbarch) == 32)
{
printf_filtered ("\t%10s %10s %10s %10s %7s\n",
"Start Addr",
a generic local_address_string instead to print out
the addresses; that makes sense to me, too. */
- if (TARGET_ADDR_BIT == 32)
+ if (gdbarch_addr_bit (current_gdbarch) == 32)
{
printf_filtered ("\t%#10lx %#10lx %#10x %#10x %7s\n",
(unsigned long) addr, /* FIXME: pr_addr */
printf_filtered ("Num ");
printf_filtered ("Enb ");
printf_filtered ("Low Addr ");
- if (TARGET_ADDR_BIT > 32)
+ if (gdbarch_addr_bit (current_gdbarch) > 32)
printf_filtered (" ");
printf_filtered ("High Addr ");
- if (TARGET_ADDR_BIT > 32)
+ if (gdbarch_addr_bit (current_gdbarch) > 32)
printf_filtered (" ");
printf_filtered ("Attrs ");
printf_filtered ("\n");
printf_filtered ("%-3d %-3c\t",
m->number,
m->enabled_p ? 'y' : 'n');
- if (TARGET_ADDR_BIT <= 32)
+ if (gdbarch_addr_bit (current_gdbarch) <= 32)
tmp = hex_string_custom ((unsigned long) m->lo, 8);
else
tmp = hex_string_custom ((unsigned long) m->lo, 16);
printf_filtered ("%s ", tmp);
- if (TARGET_ADDR_BIT <= 32)
+ if (gdbarch_addr_bit (current_gdbarch) <= 32)
{
if (m->hi == 0)
tmp = "0x100000000";
/* If the value is a pointer, and pointers and addresses are not the
same, then at this point, the value's length (in target bytes) is
- TARGET_ADDR_BIT/TARGET_CHAR_BIT, not TYPE_LENGTH (type). */
+ gdbarch_addr_bit/TARGET_CHAR_BIT, not TYPE_LENGTH (type). */
if (TYPE_CODE (type) == TYPE_CODE_PTR)
- len = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
+ len = gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT;
/* If we are printing it as unsigned, truncate it in case it is actually
a negative signed value (e.g. "print/u (short)-1" should print 65535
fputs_filtered (paddress (addr), stream);
else
{
- int addr_bit = TARGET_ADDR_BIT;
+ int addr_bit = gdbarch_addr_bit (current_gdbarch);
if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
{
char *data_fmt_string;
- if (TARGET_ADDR_BIT == 32)
+ if (gdbarch_addr_bit (current_gdbarch) == 32)
data_fmt_string = "\t%#10lx %#10lx %#10x %#10x %7s\n";
else
data_fmt_string = " %#18lx %#18lx %#10x %#10x %7s\n";
/* Remember that shift amounts equal to the type's width are
undefined. */
- a->addr_mask = ((((CORE_ADDR) 1 << (TARGET_ADDR_BIT - 1)) - 1) << 1) | 1;
+ a->addr_mask = ((((CORE_ADDR) 1
+ << (gdbarch_addr_bit (current_gdbarch) - 1)) - 1) << 1) | 1;
return a;
}
static void
build_remote_gdbarch_data (void)
{
- remote_address_size = TARGET_ADDR_BIT;
+ remote_address_size = gdbarch_addr_bit (current_gdbarch);
}
/* Function to be called whenever a new objfile (shlib) is detected. */
return 0;
}
- read_memory (debug_base, addr_buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
- lma = extract_mips_address (addr_buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+ read_memory (debug_base,
+ addr_buf,
+ gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT);
+ lma = extract_mips_address (addr_buf,
+ gdbarch_addr_bit (current_gdbarch)
+ / TARGET_CHAR_BIT);
while (lma)
{
return 0; /* failed somehow... */
/* First link map member should be the executable. */
- read_memory (debug_base, addr_buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
- lma = extract_mips_address (addr_buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+ read_memory (debug_base,
+ addr_buf,
+ gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT);
+ lma = extract_mips_address (addr_buf,
+ gdbarch_addr_bit (current_gdbarch)
+ / TARGET_CHAR_BIT);
if (lma == 0)
return 0; /* failed somehow... */
{
char *tmp;
- if (TARGET_ADDR_BIT <= 32)
+ if (gdbarch_addr_bit (current_gdbarch) <= 32)
tmp = hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol)
& (CORE_ADDR) 0xffffffff,
8);
printf_filtered ("Num Enb ");
if (addressprint)
{
- if (TARGET_ADDR_BIT <= 32)
+ if (gdbarch_addr_bit (current_gdbarch) <= 32)
printf_filtered ("Address ");
else
printf_filtered ("Address ");
strcpy (wrap_indent, " ");
if (addressprint)
{
- if (TARGET_ADDR_BIT <= 32)
+ if (gdbarch_addr_bit (current_gdbarch) <= 32)
strcat (wrap_indent, " ");
else
strcat (wrap_indent, " ");
{
char *tmp;
- if (TARGET_ADDR_BIT <= 32)
+ if (gdbarch_addr_bit (current_gdbarch) <= 32)
tmp = hex_string_custom (t->address & (CORE_ADDR) 0xffffffff,
8);
else
CORE_ADDR address)
{
char addstr[20];
- int addr_bit = TARGET_ADDR_BIT;
+ int addr_bit = gdbarch_addr_bit (current_gdbarch);
/* Truncate address to match deprecated_print_address_numeric(). */
if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
/* FIXME: cagney/2002-05-03: Need local_address_string() function
that returns the language localized string formatted to a width
- based on TARGET_ADDR_BIT. */
+ based on gdbarch_addr_bit. */
/* deprecated_print_address_numeric (address, 1, local_stream); */
if (addr_bit <= 32)
strcpy (addstr, hex_string_custom (address, 8));
int
strlen_paddr (void)
{
- return (TARGET_ADDR_BIT / 8 * 2);
+ return (gdbarch_addr_bit (current_gdbarch) / 8 * 2);
}
char *
paddr (CORE_ADDR addr)
{
- return phex (addr, TARGET_ADDR_BIT / 8);
+ return phex (addr, gdbarch_addr_bit (current_gdbarch) / 8);
}
char *
paddr_nz (CORE_ADDR addr)
{
- return phex_nz (addr, TARGET_ADDR_BIT / 8);
+ return phex_nz (addr, gdbarch_addr_bit (current_gdbarch) / 8);
}
const char *
either zero or sign extended. Should gdbarch_address_to_pointer or
some ADDRESS_TO_PRINTABLE() be used to do the conversion? */
- int addr_bit = TARGET_ADDR_BIT;
+ int addr_bit = gdbarch_addr_bit (current_gdbarch);
if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
otherwise occur when dealing with a target having two byte
pointers and four byte addresses. */
- int addr_bit = TARGET_ADDR_BIT;
+ int addr_bit = gdbarch_addr_bit (current_gdbarch);
LONGEST longest = value_as_long (arg2);
if (addr_bit < sizeof (LONGEST) * HOST_CHAR_BIT)