From 17a912b6825ef7feaad6d9b4f5419f045fe3c8d0 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Wed, 13 Jun 2007 17:59:51 +0000 Subject: [PATCH] 2007-06-13 Markus Deuling * 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. --- gdb/ChangeLog | 26 ++++++++++++++++++++++++++ gdb/breakpoint.c | 4 ++-- gdb/dwarf2expr.c | 27 +++++++++++++++++---------- gdb/dwarf2loc.c | 2 +- gdb/dwarf2read.c | 4 +++- gdb/exec.c | 4 ++-- gdb/gdbarch.c | 5 ----- gdb/gdbarch.h | 10 ++-------- gdb/gdbarch.sh | 6 +++--- gdb/gdbtypes.c | 4 ++-- gdb/linux-nat.c | 4 ++-- gdb/memattr.c | 8 ++++---- gdb/printcmd.c | 6 +++--- gdb/procfs.c | 2 +- gdb/prologue-value.c | 3 ++- gdb/remote.c | 2 +- gdb/solib-irix.c | 16 ++++++++++++---- gdb/symtab.c | 2 +- gdb/tracepoint.c | 6 +++--- gdb/ui-out.c | 4 ++-- gdb/utils.c | 8 ++++---- gdb/valops.c | 2 +- 22 files changed, 94 insertions(+), 61 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f642adb18d..22cab68274 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,29 @@ +2007-06-13 Markus Deuling + + * 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 * gdbarch.sh (TARGET_ARCHITECTURE): Replace by gdbarch_bfd_arch_info. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index c8e1b4a4d8..5e36d93acd 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3443,7 +3443,7 @@ print_one_breakpoint (struct breakpoint *b, strcpy (wrap_indent, " "); if (addressprint) { - if (TARGET_ADDR_BIT <= 32) + if (gdbarch_addr_bit (current_gdbarch) <= 32) strcat (wrap_indent, " "); else strcat (wrap_indent, " "); @@ -3802,7 +3802,7 @@ breakpoint_1 (int bnum, int allflag) { 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 */ diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index 92d9e16e35..ab2b109dfa 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -202,10 +202,10 @@ dwarf2_read_address (gdb_byte *buf, gdb_byte *buf_end, int *bytes_read) { 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 @@ -233,7 +233,8 @@ dwarf2_read_address (gdb_byte *buf, gdb_byte *buf_end, int *bytes_read) (unsigned_address_type (), extract_unsigned_integer (buf, - TARGET_ADDR_BIT / TARGET_CHAR_BIT))); + gdbarch_addr_bit (current_gdbarch) + / TARGET_CHAR_BIT))); return result; } @@ -243,7 +244,7 @@ dwarf2_read_address (gdb_byte *buf, gdb_byte *buf_end, int *bytes_read) 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; @@ -262,7 +263,7 @@ unsigned_address_type (void) 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; @@ -550,13 +551,16 @@ execute_stack_op (struct dwarf_expr_context *ctx, { 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); } @@ -564,12 +568,15 @@ execute_stack_op (struct dwarf_expr_context *ctx, 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); } diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 320da9f99e..c0c323b4ab 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -55,7 +55,7 @@ find_location_expression (struct dwarf2_loclist_baton *baton, 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, diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 87ef4aac4c..6f447a9f0d 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -4930,7 +4930,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) { 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) diff --git a/gdb/exec.c b/gdb/exec.c index e2d6b995c9..4e68d1cf44 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -532,8 +532,8 @@ void 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 (" "); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 8ea41b1f18..2ffc659be6 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -650,11 +650,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) 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)); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index ff52b36f6e..7fd12480fa 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -124,10 +124,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 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. @@ -140,12 +140,6 @@ extern void set_gdbarch_ptr_bit (struct gdbarch *gdbarch, int ptr_bit); 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. */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 2c90ca18b4..a36b30e248 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 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 # diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 93c1e55eaf..d96d5feead 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3574,7 +3574,7 @@ Show resolution of opaque struct/class/union types (if set before loading symbol 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 = @@ -3725,7 +3725,7 @@ gdbtypes_post_init (struct gdbarch *gdbarch) 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); diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 695dbb0bfc..c2f67de169 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -2862,7 +2862,7 @@ linux_nat_info_proc_cmd (char *args, int from_tty) 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", @@ -2888,7 +2888,7 @@ linux_nat_info_proc_cmd (char *args, int from_tty) 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 */ diff --git a/gdb/memattr.c b/gdb/memattr.c index f8e073226c..1fe9e90b9d 100644 --- a/gdb/memattr.c +++ b/gdb/memattr.c @@ -434,10 +434,10 @@ mem_info_command (char *args, int from_tty) 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"); @@ -448,14 +448,14 @@ mem_info_command (char *args, int from_tty) 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"; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 6da10aa196..b03c65ea09 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -346,9 +346,9 @@ print_scalar_formatted (const void *valaddr, struct type *type, /* 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 @@ -669,7 +669,7 @@ deprecated_print_address_numeric (CORE_ADDR addr, int use_local, 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; diff --git a/gdb/procfs.c b/gdb/procfs.c index 7916944eef..cbb59b87bc 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -5735,7 +5735,7 @@ info_mappings_callback (struct prmap *map, int (*ignore) (), void *unused) { 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"; diff --git a/gdb/prologue-value.c b/gdb/prologue-value.c index d95588a3dc..8576f38448 100644 --- a/gdb/prologue-value.c +++ b/gdb/prologue-value.c @@ -330,7 +330,8 @@ make_pv_area (int base_reg) /* 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; } diff --git a/gdb/remote.c b/gdb/remote.c index e7a7d35caa..9fa700e585 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6411,7 +6411,7 @@ show_remote_cmd (char *args, int from_tty) 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. */ diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c index d060c2d72a..a2a0d59dda 100644 --- a/gdb/solib-irix.c +++ b/gdb/solib-irix.c @@ -503,8 +503,12 @@ irix_current_sos (void) 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) { @@ -605,8 +609,12 @@ irix_open_symbol_file_object (void *from_ttyp) 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... */ diff --git a/gdb/symtab.c b/gdb/symtab.c index 8f3aa60018..83ff938755 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -3246,7 +3246,7 @@ print_msymbol_info (struct minimal_symbol *msymbol) { 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); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 02d2e80b76..b9b9f5ee8c 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -480,7 +480,7 @@ tracepoints_info (char *tpnum_exp, int from_tty) 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 "); @@ -490,7 +490,7 @@ tracepoints_info (char *tpnum_exp, int from_tty) strcpy (wrap_indent, " "); if (addressprint) { - if (TARGET_ADDR_BIT <= 32) + if (gdbarch_addr_bit (current_gdbarch) <= 32) strcat (wrap_indent, " "); else strcat (wrap_indent, " "); @@ -502,7 +502,7 @@ tracepoints_info (char *tpnum_exp, int from_tty) { 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 diff --git a/gdb/ui-out.c b/gdb/ui-out.c index eec2d401d5..a85ca48ea6 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -493,7 +493,7 @@ ui_out_field_core_addr (struct ui_out *uiout, 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)) @@ -501,7 +501,7 @@ ui_out_field_core_addr (struct ui_out *uiout, /* 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)); diff --git a/gdb/utils.c b/gdb/utils.c index 6f3719adc6..c8abeec020 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -2535,19 +2535,19 @@ get_cell (void) 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 * @@ -2562,7 +2562,7 @@ paddress (CORE_ADDR addr) 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; diff --git a/gdb/valops.c b/gdb/valops.c index 1163756cd9..35f6558f53 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -402,7 +402,7 @@ value_cast (struct type *type, struct value *arg2) 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) -- 2.34.1